diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-03-05 16:07:07 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-03-05 16:07:07 -0500 |
| commit | 13f946689e28e99ac71172925f63f4320798a0ee (patch) | |
| tree | ba30132da24aa70b0d2daffc96ac3b3f63d57df6 /tools/mapedit/src/object.cpp | |
| parent | dbc486d5cc0fa6b7cdb690fb4591f292d33e9ecc (diff) | |
| download | therapy-13f946689e28e99ac71172925f63f4320798a0ee.tar.gz therapy-13f946689e28e99ac71172925f63f4320798a0ee.tar.bz2 therapy-13f946689e28e99ac71172925f63f4320798a0ee.zip | |
Added entity indexing
Changed the world format so that map objects are indexed (per map). The next available map object index is cached for each map.
Diffstat (limited to 'tools/mapedit/src/object.cpp')
| -rw-r--r-- | tools/mapedit/src/object.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
| diff --git a/tools/mapedit/src/object.cpp b/tools/mapedit/src/object.cpp index 8ed29af..aeb8fc1 100644 --- a/tools/mapedit/src/object.cpp +++ b/tools/mapedit/src/object.cpp | |||
| @@ -184,9 +184,15 @@ bool MapObject::operator!=(const MapObject& other) const | |||
| 184 | return id != other.id; | 184 | return id != other.id; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | MapObjectEntry::MapObjectEntry(const MapObject& object, int posx, int posy) : object(object) | 187 | MapObjectEntry::MapObjectEntry( |
| 188 | const MapObject& object, | ||
| 189 | int posx, | ||
| 190 | int posy, | ||
| 191 | size_t index) : | ||
| 192 | object(object), | ||
| 193 | position(std::make_pair(posx, posy)), | ||
| 194 | index(index) | ||
| 188 | { | 195 | { |
| 189 | position = std::make_pair(posx, posy); | ||
| 190 | } | 196 | } |
| 191 | 197 | ||
| 192 | const MapObject& MapObjectEntry::getObject() const | 198 | const MapObject& MapObjectEntry::getObject() const |
| @@ -209,6 +215,11 @@ const std::map<std::string, MapObjectEntry::Item>& MapObjectEntry::getItems() co | |||
| 209 | return items; | 215 | return items; |
| 210 | } | 216 | } |
| 211 | 217 | ||
| 218 | size_t MapObjectEntry::getIndex() const | ||
| 219 | { | ||
| 220 | return index; | ||
| 221 | } | ||
| 222 | |||
| 212 | void MapObjectEntry::addItem(std::string id, Item& item) | 223 | void MapObjectEntry::addItem(std::string id, Item& item) |
| 213 | { | 224 | { |
| 214 | items[id] = item; | 225 | items[id] = item; |
