00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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