Logo
~Sockets~
~Examples~
~Contact~


World.h

Go to the documentation of this file.
00001 //World.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 _WORLD_H
00021 #define _WORLD_H
00022 
00023 #include <string>
00024 #include <vector>
00025 //#include <SmallHandler.h>
00026 
00027         typedef std::vector<std::string> string_v;
00028 
00029 class SmallHandler;
00030 
00031 
00033 class World
00034 {
00036         struct CELL
00037         {
00038                 CELL(int x,int y,const std::string& name) : m_x(x)
00039                         ,m_y(y),m_name(name)
00040                         ,m_n(false),m_s(false),m_e(false),m_w(false) {
00041 //                      printf("New cell@(%d,%d): %s\n",x,y,name.c_str());
00042                 }
00043                 int m_x;
00044                 int m_y;
00045                 std::string m_name;
00046                 bool m_n;
00047                 bool m_s;
00048                 bool m_e;
00049                 bool m_w;
00050         };
00051         typedef std::vector<CELL *> cell_v;
00052 
00053 public:
00054         World(SmallHandler& );
00055         ~World();
00056 
00057         void GetRandomLocation(int&,int&,std::string&);
00058         bool FindAt(int,int,std::string& );
00059         bool GetAt(int,int,std::string&,bool&,bool&,bool&,bool&);
00060 
00061         void AddAt(int,int,const std::string& );
00062         SmallHandler& Handler() { return m_handler; }
00063 
00064         void Open(int,int,const std::string& );
00065 
00066         size_t NumberOfCells() { return m_cells.size(); }
00067 
00068 private:
00069         SmallHandler& m_handler;
00070         cell_v m_cells;
00071 };
00072 
00073 
00074 
00075 
00076 #endif // _WORLD_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