Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

Lobby.h

00001 #ifndef ERIS_LOBBY_H
00002 #define ERIS_LOBBY_H
00003 
00004 #include <Eris/Connection.h>
00005 #include <Eris/Room.h>
00006 
00007 // forward decleration of test cases
00008 class TestLobby;
00009 
00010 namespace Atlas {
00011   namespace Objects {
00012     namespace Entity {
00013       class Account;
00014       class Player;
00015     }
00016     namespace Operation {
00017       class Create;
00018       class Info;
00019     }
00020   }
00021 }
00022 
00023 namespace Eris
00024 {
00025         
00026 class Player;
00027 class Person;
00028         
00031 class Lobby : public Room
00032 {
00033 public: 
00034         Lobby(Connection *c); 
00035         virtual ~Lobby();
00036 
00038         Room* join(const std::string &roomID);
00039 
00040         //Room* Create(const string &nm);
00041 
00043         Person* getPerson(const std::string &acc);
00044                 
00046         Room* getRoom(const std::string &id);
00047 
00049         const std::string& getAccountID();
00050         
00052         Connection* getConnection() const { return _con; }
00053 
00054         // callbacks
00056         SigC::Signal1<void, Person*> SightPerson;
00057         
00059         //SigC::Signal1<void Room*> SightRoom;
00060         
00061         // emitted when someone does a private (direct) chat
00062         SigC::Signal2<void, const std::string&, const std::string&> PrivateTalk;
00063         
00065         SigC::Signal1<void, const Atlas::Objects::Entity::Player&> LoggedIn;
00066         
00070         static Lobby* getPrimary() {return Connection::getPrimary()->getLobby();}
00072         static Lobby* instance() {return getPrimary();}
00073 protected:
00074         friend class Room;
00075         friend class Player; 
00076         
00077         friend class TestLobby; 
00078         
00079         void look(const std::string &id);
00080         void expectInfoRefno(long ref);
00081         
00082         // callbacks    
00083         void recvInfoAccount(const Atlas::Objects::Operation::Info &ifo, 
00084                 const Atlas::Objects::Entity::Account &account);
00085         
00086         void recvSightPerson(const Atlas::Objects::Entity::Account &ac);
00087         void recvSightRoom(const Atlas::Objects::Entity::RootEntity &room);
00088         // FIXME - remove once cyphesis is updated
00089         void recvSightLobby(const Atlas::Objects::Entity::RootEntity &lobby);
00090         
00091         void recvPrivateChat(const Atlas::Objects::Operation::Talk &tk);
00092         
00093         void recvSightCreate(const Atlas::Objects::Operation::Create &cr,
00094             const Atlas::Objects::Entity::RootEntity &ent);
00095 
00097     void processRoomCreate(const Atlas::Objects::Operation::Create &cr,
00098         const Atlas::Objects::Entity::RootEntity &ent);
00099 
00101     void registerCallbacks();
00102 
00106     void addPendingCreate(Room *r, int serialno);
00107 
00108         // should this try a shutdown, or simply wait and hope for resume?
00109         void netFailure(const std::string& msg);
00110         void netConnected();
00111         void netDisconnected();
00112         
00113         std::string _account;
00114         Connection* _con;
00115         //Player* _player;
00116         bool _reconnect;        
00117         long _infoRefno;        
00118         
00119         typedef std::map<std::string, Person*> PersonDict;
00120         PersonDict _peopleDict;
00121         
00122         typedef std::map<std::string, Room*> RoomDict;
00123         RoomDict _roomDict;
00124         
00125     typedef std::map<int, Room*> PendingCreateMap;
00127     PendingCreateMap _pendingCreate;
00128 };
00129         
00130 } // of namespace Eris
00131 
00132 #endif

Generated on Sun Sep 4 14:14:04 2005 for Eris by  doxygen 1.4.4