Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Avatar.h

00001 #ifndef ERIS_AVATAR_H
00002 #define ERIS_AVATAR_H
00003 
00004 #include <assert.h>
00005 #include <string>
00006 #include <map>
00007 #include <vector>
00008 #include <sigc++/object.h>
00009 
00010 namespace Atlas {
00011         namespace Objects {
00012                 namespace Entity {
00013                         class GameEntity;
00014                 }
00015                 
00016                 namespace Operation {
00017                         class Info;
00018                 }
00019         }
00020 }
00021 
00022 #include <Eris/Types.h>
00023 
00024 namespace Eris
00025 {
00026         
00027 // Forward Declerations
00028 class World;
00029 class Player;
00030 class Connection;
00031 
00032 class Avatar : virtual public SigC::Object
00033 {
00034 public:
00038         Avatar(World* world, long refno, const std::string& character_id = "");
00039         virtual ~Avatar();
00040 
00042         World* getWorld() const {return _world;}
00044         const std::string& getID() const {return _id;}
00046         EntityPtr getEntity() const {return _entity;}
00047 
00048         // These two signals just transmit the Entity's
00049         // AddedMember and RemovedMember signals, but
00050         // you're allowed to connect to them as soon as
00051         // the Avatar has been created, instead of having to wait
00052         // for the Entity to be created.
00053 
00055         SigC::Signal1<void,Entity*> InvAdded;
00057         SigC::Signal1<void,Entity*> InvRemoved;
00058 
00060         void drop(Entity*, const WFMath::Point<3>& pos, const std::string& loc);
00062         void drop(Entity*, const WFMath::Vector<3>& offset = WFMath::Vector<3>(0, 0, 0));
00063 
00064         static Avatar* find(Connection*, const std::string&);
00065         static std::vector<Avatar*> getAvatars(Connection*);
00066 
00067         void slotLogout(bool) {delete this;}
00068         void slotDisconnect() {delete this;}
00069 
00070 private:
00071         void recvInfoCharacter(const Atlas::Objects::Operation::Info &ifo,
00072                 const Atlas::Objects::Entity::GameEntity &character);
00073         void recvEntity(Entity*);
00074 
00075         World* _world;
00076         std::string _id;
00077         EntityPtr _entity;
00078         std::string _dispatch_id;
00080         typedef std::pair<Connection*,std::string> AvatarIndex;
00081         typedef std::map<AvatarIndex,Avatar*> AvatarMap;
00082         static AvatarMap _avatars;
00083 };
00084         
00085 } // of namespace Eris
00086 
00087 #endif

Generated on Thu May 22 08:01:02 2003 for Eris by doxygen1.3-rc3