forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapbuffer.h
51 lines (41 loc) · 949 Bytes
/
mapbuffer.h
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
#include "map.h"
#include "line.h"
#include <map>
#include <list>
class game;
struct pointcomp
{
bool operator() (const tripoint &lhs, const tripoint &rhs) const
{
if (lhs.x < rhs.x) return true;
if (lhs.x > rhs.x) return false;
if (lhs.y < rhs.y) return true;
if (lhs.y > rhs.y) return false;
if (lhs.z < rhs.z) return true;
if (lhs.z > rhs.z) return false;
return false;
};
};
class mapbuffer
{
public:
mapbuffer();
~mapbuffer();
void set_game(game *g);
//help save_if_dirty() know to save as many times as it's supposed to.
void set_dirty();
void make_volatile();
void load();
void save();
void save_if_dirty();
void reset();
bool add_submap(int x, int y, int z, submap *sm);
submap* lookup_submap(int x, int y, int z);
int size();
private:
std::map<tripoint, submap*, pointcomp> submaps;
std::list<submap*> submap_list;
game *master_game;
bool dirty;
};
extern mapbuffer MAPBUFFER;