Logo
~Sockets~
~Examples~
~Contact~

Chunk.h

Go to the documentation of this file.
00001 // Chunk.h
00002 // released 2006-09-25
00003 /*
00004 Copyright (C) 2006  Anders Hedstrom (grymse@alhem.net)
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 */
00020 #ifndef _CHUNK_H
00021 #define _CHUNK_H
00022 
00023 #include <map>
00024 #include <list>
00025 #include "Object.h"
00026 
00027 
00028 class InSocket;
00029 namespace db { class Chunk; }
00030 class Database;
00031 class Area;
00032 class Terrain;
00033 
00034 typedef std::map<long,std::list<db::Chunk *> > chunks_t;
00035 
00038 class Chunk : public Object
00039 {
00040 public:
00041         Chunk(Database& ,Area& ,long num);
00042         Chunk(Database& ,Area& ,int x,int y,int z = 0);
00043         ~Chunk();
00044 
00045         void Init(InSocket *,int x,int y,int z,char tchar);
00046 
00047         void Set(int x,int y,char tchar);
00048         char Get(int x,int y);
00049         void Fill(int x,int y,char fromchar,char tochar);
00050         void Edge(Terrain& t,int width);
00051 
00052         bool Exists();
00053         int GetX();
00054         int GetY();
00055         int GetZ();
00056 
00057         void Save();
00058         long GetNum();
00059 
00060 static  void RemoveObject(Area& ,int x,int y,int z);
00061 
00062         void AddPortal(int x,int y,Area& to_area,Chunk& to_chunk,int to_x,int to_y);
00063         void Show(InSocket *);
00064 
00065 private:
00066 static  db::Chunk *GetChunk(Database&,Area&,int x,int y,int z = 0);
00067 static  db::Chunk *GetChunk(Database&,Area&,long num);
00068         void GetInfo();
00069         Area& m_area;
00070         db::Chunk *m_chunk;
00071 static  chunks_t m_chunks;
00072 };
00073 
00074 
00075 
00076 
00077 #endif // _CHUNK_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