Pol  Revision:3cfda13
mapserver.h
Go to the documentation of this file.
1 
7 #ifndef PLIB_MAPSERVER_H
8 #define PLIB_MAPSERVER_H
9 
10 #include <vector>
11 
12 #include "mapsolid.h"
13 #include "realmdescriptor.h"
14 
15 namespace Pol
16 {
17 namespace Plib
18 {
19 class MapShapeList;
20 struct MAPCELL;
21 
22 class MapServer
23 {
24 public:
25  static MapServer* Create( const RealmDescriptor& descriptor );
26 
27  virtual ~MapServer();
28 
29  virtual MAPCELL GetMapCell( unsigned short x, unsigned short y ) const = 0;
30  void GetMapShapes( MapShapeList& list, unsigned short x, unsigned short y,
31  unsigned int anyflags ) const;
32  virtual size_t sizeEstimate() const;
33 
34 protected:
35  explicit MapServer( const RealmDescriptor& descriptor );
36 
38 
39 private:
40  // the indexes and shape data are always loaded into memory.
41  std::vector<SOLIDX2_ELEM*> _index1; // points into _index2
42  std::vector<SOLIDX2_ELEM> _index2;
43  std::vector<SOLIDS_ELEM> _shapedata;
44 
45  void LoadSolids();
46  void LoadSecondLevelIndex();
47  void LoadFirstLevelIndex();
48 
49  // not implemented:
50  MapServer& operator=( const MapServer& );
51  MapServer( const MapServer& );
52 };
53 }
54 }
55 #endif
MapServer(const RealmDescriptor &descriptor)
Definition: mapserver.cpp:26
virtual ~MapServer()
Definition: mapserver.cpp:36
void LoadSecondLevelIndex()
Definition: mapserver.cpp:46
void GetMapShapes(MapShapeList &list, unsigned short x, unsigned short y, unsigned int anyflags) const
Definition: mapserver.cpp:107
static MapServer * Create(const RealmDescriptor &descriptor)
Definition: mapserver.cpp:151
virtual size_t sizeEstimate() const
Definition: mapserver.cpp:167
std::vector< SOLIDS_ELEM > _shapedata
Definition: mapserver.h:43
MapServer & operator=(const MapServer &)
std::vector< SOLIDX2_ELEM > _index2
Definition: mapserver.h:42
virtual MAPCELL GetMapCell(unsigned short x, unsigned short y) const =0
const RealmDescriptor _descriptor
Definition: mapserver.h:37
std::vector< SOLIDX2_ELEM * > _index1
Definition: mapserver.h:41
void LoadFirstLevelIndex()
Definition: mapserver.cpp:81
Definition: berror.cpp:12