blob: 0fc05faec57147aa5fbbc5cb834827745284b1d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// MapManager.h
#pragma once
#include "FunctionRef.h"
#include "Map.h"
using cMapCallback = cFunctionRef<bool(cMap &)>;
// tolua_begin
/** Manages the in-game maps of a single world - Thread safe. */
class cMapManager
{
public:
// tolua_end
cMapManager(cWorld * a_World);
/** Returns the map with the specified ID, nullptr if out of range.
WARNING: The returned map object is not thread safe. */
cMap * GetMapData(unsigned int a_ID);
/** Creates a new map. Returns nullptr on error */
cMap * CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale = 3);
/** 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. */
bool DoWithMap(UInt32 a_ID, cMapCallback a_Callback); // Exported in ManualBindings.cpp
/** Ticks each registered map */
void TickMaps(void);
/** Loads the map data from the disk */
void LoadMapData(void);
/** Saves the map data to the disk */
void SaveMapData(void);
private:
typedef std::vector<cMap> cMapList;
cCriticalSection m_CS;
cMapList m_MapData;
cWorld * m_World;
/** How long till the map data will be saved
Default save interval is #defined in MAP_DATA_SAVE_INTERVAL */
unsigned int m_TicksUntilNextSave;
}; // tolua_export
|