00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef BEINGMANAGER_H
00023 #define BEINGMANAGER_H
00024
00025 #include "being.h"
00026
00027 class LocalPlayer;
00028 class Map;
00029
00030 typedef std::list<Being*> Beings;
00031
00032 class BeingManager
00033 {
00034 public:
00035 BeingManager();
00036
00037 ~BeingManager();
00038
00042 void setMap(Map *map);
00043
00047 void setPlayer(LocalPlayer *player);
00048
00052 Being *createBeing(int id, Being::Type type, int subtype);
00053
00057 void destroyBeing(Being *being);
00058
00062 Being *findBeing(int id) const;
00063
00067 Being *findBeing(int x, int y, Being::Type type = Being::UNKNOWN) const;
00068 Being *findBeingByPixel(int x, int y) const;
00069
00079 Being *findNearestLivingBeing(int x, int y, int maxdist,
00080 Being::Type type = Being::UNKNOWN) const;
00081
00085 Being *findBeingByName(const std::string &name,
00086 Being::Type type = Being::UNKNOWN) const;
00087
00094 Being *findNearestLivingBeing(Being *aroundBeing, int maxdist,
00095 Being::Type type = Being::UNKNOWN) const;
00096
00100 const Beings &getAll() const;
00101
00108 bool hasBeing(Being *being) const;
00109
00114 void logic();
00115
00119 void clear();
00120
00121 protected:
00122 Beings mBeings;
00123 Map *mMap;
00124 };
00125
00126 extern BeingManager *beingManager;
00127
00128 #endif