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

Avatar.h

00001 #ifndef ERIS_AVATAR_H
00002 #define ERIS_AVATAR_H
00003 
00004 #include <Eris/Types.h>
00005 
00006 #include <wfmath/point.h>
00007 #include <wfmath/vector.h>
00008 
00009 #include <sigc++/object.h>
00010 #include <sigc++/signal.h>
00011 
00012 #include <string>
00013 #include <map>
00014 #include <vector>
00015 
00016 namespace Atlas {
00017         namespace Objects {
00018                 namespace Entity {
00019                         class GameEntity;
00020                 }
00021                 
00022                 namespace Operation {
00023                         class Info;
00024                 }
00025         }
00026 }
00027 
00028 namespace WFMath {
00029   class Quaternion;
00030 }
00031 
00032 namespace Eris
00033 {
00034         
00035 // Forward Declerations
00036 class World;
00037 class Player;
00038 class Connection;
00039 
00040 class Avatar : virtual public SigC::Object
00041 {
00042 public:
00046         Avatar(World* world, long refno, const std::string& character_id = "");
00047         virtual ~Avatar();
00048 
00050         World* getWorld() const {return _world;}
00052         const std::string& getID() const {return _id;}
00054         EntityPtr getEntity() const {return _entity;}
00055 
00056         // These two signals just transmit the Entity's
00057         // AddedMember and RemovedMember signals, but
00058         // you're allowed to connect to them as soon as
00059         // the Avatar has been created, instead of having to wait
00060         // for the Entity to be created.
00061 
00063         SigC::Signal1<void,Entity*> InvAdded;
00065         SigC::Signal1<void,Entity*> InvRemoved;
00066 
00068         void drop(Entity*, const WFMath::Point<3>& pos, const std::string& loc);
00070         void drop(Entity*, const WFMath::Vector<3>& offset = WFMath::Vector<3>(0, 0, 0));
00071 
00073         void take(Entity*);
00074 
00076         void touch(Entity*);
00077 
00079         void say(const std::string&);
00080 
00082         void moveToPoint(const WFMath::Point<3>&);
00083 
00085         void moveInDirection(const WFMath::Vector<3>&);
00086 
00088         void moveInDirection(const WFMath::Vector<3>&, const WFMath::Quaternion&);
00089 
00091         void place(Entity*, Entity* container, const WFMath::Point<3>& pos
00092                 = WFMath::Point<3>(0, 0, 0));
00093 
00094         static Avatar* find(Connection*, const std::string&);
00095         static std::vector<Avatar*> getAvatars(Connection*);
00096 
00097         void slotLogout(bool) {delete this;}
00098         void slotDisconnect() {delete this;}
00099 
00100 private:
00101         void recvInfoCharacter(const Atlas::Objects::Operation::Info &ifo,
00102                 const Atlas::Objects::Entity::GameEntity &character);
00103         void recvEntity(Entity*);
00104 
00105         World* _world;
00106         std::string _id;
00107         EntityPtr _entity;
00108         std::string _dispatch_id;
00110         typedef std::pair<Connection*,std::string> AvatarIndex;
00111         typedef std::map<AvatarIndex,Avatar*> AvatarMap;
00112         static AvatarMap _avatars;
00113 };
00114         
00115 } // of namespace Eris
00116 
00117 #endif

Generated on Fri Nov 12 07:43:30 2004 for Eris by  doxygen 1.3.9.1