summary refs log tree commit diff stats
path: root/src/map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp index 2be5071..5119d85 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -17,6 +17,8 @@ Map::Map()
17 17
18Map::Map(const std::string name) 18Map::Map(const std::string name)
19{ 19{
20 this->name = name;
21
20 xmlDocPtr doc = xmlParseFile(("../maps/" + name + ".xml").c_str()); 22 xmlDocPtr doc = xmlParseFile(("../maps/" + name + ".xml").c_str());
21 if (doc == nullptr) 23 if (doc == nullptr)
22 { 24 {
@@ -108,6 +110,8 @@ Map::Map(const Map& map)
108 rightMap = map.rightMap; 110 rightMap = map.rightMap;
109 111
110 entities = map.entities; 112 entities = map.entities;
113
114 name = map.name;
111} 115}
112 116
113Map::Map(Map&& map) : Map() 117Map::Map(Map&& map) : Map()
@@ -135,6 +139,7 @@ void swap(Map& first, Map& second)
135 std::swap(first.leftMap, second.leftMap); 139 std::swap(first.leftMap, second.leftMap);
136 std::swap(first.rightMap, second.rightMap); 140 std::swap(first.rightMap, second.rightMap);
137 std::swap(first.entities, second.entities); 141 std::swap(first.entities, second.entities);
142 std::swap(first.name, second.name);
138} 143}
139 144
140const int* Map::getMapdata() const 145const int* Map::getMapdata() const
@@ -178,6 +183,16 @@ void Map::createEntities(std::list<std::shared_ptr<Entity>>& entities) const
178 } 183 }
179} 184}
180 185
186bool Map::operator==(const Map& other) const
187{
188 return name == other.name;
189}
190
191bool Map::operator!=(const Map& other) const
192{
193 return name != other.name;
194}
195
181Map& Map::getNamedMap(const std::string name) 196Map& Map::getNamedMap(const std::string name)
182{ 197{
183 if (maps.count(name) == 0) 198 if (maps.count(name) == 0)