Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Types | Private Attributes | List of all members
cMapManager Class Reference

Manages the in-game maps of a single world - Thread safe. More...

#include <MapManager.h>

Collaboration diagram for cMapManager:
Collaboration graph
[legend]

Public Member Functions

 cMapManager (cWorld *a_World)
 
cMapCreateMap (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...
 
cMapGetMapData (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< cMapcMapList
 

Private Attributes

cCriticalSection m_CS
 
cMapList m_MapData
 
cWorldm_World
 

Detailed Description

Manages the in-game maps of a single world - Thread safe.

Definition at line 28 of file MapManager.h.

Member Typedef Documentation

◆ cMapList

typedef std::vector<cMap> cMapManager::cMapList
private

Definition at line 59 of file MapManager.h.

Constructor & Destructor Documentation

◆ cMapManager()

cMapManager::cMapManager ( cWorld a_World)

Definition at line 15 of file MapManager.cpp.

Member Function Documentation

◆ CreateMap()

cMap * cMapManager::CreateMap ( int  a_CenterX,
int  a_CenterY,
unsigned int  a_Scale = 3 
)

Creates a new map.

Returns nullptr on error

Definition at line 74 of file MapManager.cpp.

◆ DoWithMap()

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.

◆ GetMapData()

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.

◆ LoadMapData()

void cMapManager::LoadMapData ( void  )

Loads the map data from the disk.

Definition at line 95 of file MapManager.cpp.

◆ SaveMapData()

void cMapManager::SaveMapData ( void  )

Saves the map data to the disk.

Definition at line 129 of file MapManager.cpp.

◆ TickMaps()

void cMapManager::TickMaps ( void  )

Ticks each registered map.

Definition at line 45 of file MapManager.cpp.

Member Data Documentation

◆ m_CS

cCriticalSection cMapManager::m_CS
private

Definition at line 61 of file MapManager.h.

◆ m_MapData

cMapList cMapManager::m_MapData
private

Definition at line 63 of file MapManager.h.

◆ m_World

cWorld* cMapManager::m_World
private

Definition at line 65 of file MapManager.h.


The documentation for this class was generated from the following files: