Logo
~Sockets~
~Examples~
~Contact~


MobFactory.h

Go to the documentation of this file.
00001 //MobFactory.h
00002 /*
00003 Copyright (C) 2004  Anders Hedstrom
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4