00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _MOBFACTORY_H
00021 #define _MOBFACTORY_H
00022
00023 #include <string>
00024 #include <vector>
00025 #include "SmallHandler.h"
00026
00027 class SmallSocket;
00028
00030 class MobFactory
00031 {
00033 struct MOB
00034 {
00035 MOB(SmallHandler& handler,int x,int y,const std::string& name) : m_handler(handler),m_x(x),m_y(y),m_name(name) {
00036 }
00037 void Move();
00038 void Create();
00039 void SetNewPos(int,int);
00040
00041 SmallHandler& m_handler;
00042 int m_x;
00043 int m_y;
00044 std::string m_name;
00045 };
00046 typedef std::vector<MOB *> mob_v;
00047 public:
00048 MobFactory(SmallHandler& w);
00049 ~MobFactory();
00050
00051 void Spawn();
00052 void RandomAction();
00053 void ShowNamesAt(SmallSocket *,int x,int y,const std::string& = "");
00054 SmallHandler& Handler() { return m_handler; }
00055 size_t NumberOfMobs() { return m_mobs.size(); }
00056
00057 private:
00058 SmallHandler& m_handler;
00059 mob_v m_mobs;
00060 string_v m_name_beg;
00061 string_v m_name_end;
00062 };
00063
00064
00065
00066
00067 #endif // _MOBFACTORY_H