-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.cpp
More file actions
88 lines (71 loc) · 1.32 KB
/
Map.cpp
File metadata and controls
88 lines (71 loc) · 1.32 KB
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
71
72
73
74
75
76
77
78
/** @file Map.cpp */
#include "Map.h"
#include "MapLoader.h"
#include "Game.h"
#include "Savegame.h"
#include "DialogBox.h"
#include "Sprite.h"
#include "Camera.h"
#include "LuaContext.h"
#include "FileTools.h"
#include "Surface.h"
#include "VideoManager.h"
#include "Music.h"
MapLoader Map::map_loader;
/**
* \brief Creates a map.
* \param id id of the map, used to determine the description file
* and the script file of the map
*/
Map::Map(const std::string& id):
game(NULL),
id(id),
tileset(NULL),
floor(NO_FLOOR),
loaded(false),
started(false),
destination_name(""),
entities(NULL),
suspended(false),
light(1)
{
}
/**
* \brief Destructor.
*/
Map::~Map()
{
if(is_started())
{
std::cerr << "Deleting a map that is still running. Call Map::leave() before.\n";
}
if (is_loaded())
{
unload();
}
}
/**
* \brief Returns the id of the map.
* \return the map id
*/
const std::string& Map::get_id()
{
return id;
}
/**
* \brief Returns the tileset associated to this map.
* \return the tileset
*/
Tileset& Map::get_tileset()
{
return *tileset;
}
/**
* \brief Returns the id of the tileset associated to this map.
* \return the id of the tileset
*/
const std::string& Map::get_tileset_id()
{
// note that if set_tileset() has been called, tileset_id != tileset->get_id()
return tileset_id;
}