Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Manages the in-game maps of a single world - Thread safe. More...
#include <MapManager.h>
Public Member Functions | |
cMapManager (cWorld *a_World) | |
cMap * | CreateMap (int a_CenterX, int a_CenterY, unsigned int a_Scale=3) |
Creates a new map. More... | |
bool | DoWithMap (UInt32 a_ID, cMapCallback a_Callback) |
Calls the callback for the map with the specified ID. More... | |
cMap * | GetMapData (unsigned int a_ID) |
Returns the map with the specified ID, nullptr if out of range. More... | |
void | LoadMapData (void) |
Loads the map data from the disk. More... | |
void | SaveMapData (void) |
Saves the map data to the disk. More... | |
void | TickMaps (void) |
Ticks each registered map. More... | |
Private Types | |
typedef std::vector< cMap > | cMapList |
Private Attributes | |
cCriticalSection | m_CS |
cMapList | m_MapData |
cWorld * | m_World |
Manages the in-game maps of a single world - Thread safe.
Definition at line 28 of file MapManager.h.
|
private |
Definition at line 59 of file MapManager.h.
cMapManager::cMapManager | ( | cWorld * | a_World | ) |
Definition at line 15 of file MapManager.cpp.
cMap * cMapManager::CreateMap | ( | int | a_CenterX, |
int | a_CenterY, | ||
unsigned int | a_Scale = 3 |
||
) |
bool cMapManager::DoWithMap | ( | UInt32 | a_ID, |
cMapCallback | a_Callback | ||
) |
Calls the callback for the map with the specified ID.
Returns true if the map was found and the callback called, false if map not found. Callback return value is ignored.
Definition at line 25 of file MapManager.cpp.
cMap * cMapManager::GetMapData | ( | unsigned int | a_ID | ) |
Returns the map with the specified ID, nullptr if out of range.
WARNING: The returned map object is not thread safe.
Definition at line 58 of file MapManager.cpp.
void cMapManager::LoadMapData | ( | void | ) |
Loads the map data from the disk.
Definition at line 95 of file MapManager.cpp.
void cMapManager::SaveMapData | ( | void | ) |
Saves the map data to the disk.
Definition at line 129 of file MapManager.cpp.
void cMapManager::TickMaps | ( | void | ) |
Ticks each registered map.
Definition at line 45 of file MapManager.cpp.
|
private |
Definition at line 61 of file MapManager.h.
|
private |
Definition at line 63 of file MapManager.h.
|
private |
Definition at line 65 of file MapManager.h.