Cuberite
A lightweight, fast and extensible game server for Minecraft
MapManager.h
Go to the documentation of this file.
1 
2 // MapManager.h
3 
4 
5 
6 
7 
8 #pragma once
9 
10 
11 
12 
13 
14 #include "FunctionRef.h"
15 #include "Map.h"
16 
17 
18 
19 
21 
22 
23 
24 
25 // tolua_begin
26 
29 {
30 public:
31  // tolua_end
32 
33  cMapManager(cWorld * a_World);
34 
37  cMap * GetMapData(unsigned int a_ID);
38 
40  cMap * CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale = 3);
41 
45  bool DoWithMap(UInt32 a_ID, cMapCallback a_Callback); // Exported in ManualBindings.cpp
46 
48  void TickMaps(void);
49 
51  void LoadMapData(void);
52 
54  void SaveMapData(void);
55 
56 
57 private:
58 
59  typedef std::vector<cMap> cMapList;
60 
62 
63  cMapList m_MapData;
64 
66 
67 }; // tolua_export
68 
69 
70 
cMap * CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale=3)
Creates a new map.
Definition: MapManager.cpp:74
std::vector< cMap > cMapList
Definition: MapManager.h:59
cMapManager(cWorld *a_World)
Definition: MapManager.cpp:15
cWorld * m_World
Definition: MapManager.h:65
Encapsulates an in-game world map.
Definition: Map.h:80
void TickMaps(void)
Ticks each registered map.
Definition: MapManager.cpp:45
void SaveMapData(void)
Saves the map data to the disk.
Definition: MapManager.cpp:129
Manages the in-game maps of a single world - Thread safe.
Definition: MapManager.h:28
Definition: World.h:65
cCriticalSection m_CS
Definition: MapManager.h:61
void LoadMapData(void)
Loads the map data from the disk.
Definition: MapManager.cpp:95
unsigned int UInt32
Definition: Globals.h:113
cMapList m_MapData
Definition: MapManager.h:63
bool DoWithMap(UInt32 a_ID, cMapCallback a_Callback)
Calls the callback for the map with the specified ID.
Definition: MapManager.cpp:25
cMap * GetMapData(unsigned int a_ID)
Returns the map with the specified ID, nullptr if out of range.
Definition: MapManager.cpp:58