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/widget.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/widget.cpp')
-rw-r--r-- | tools/mapedit/src/widget.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/mapedit/src/widget.cpp b/tools/mapedit/src/widget.cpp index 8d74b39..85838e6 100644 --- a/tools/mapedit/src/widget.cpp +++ b/tools/mapedit/src/widget.cpp | |||
@@ -256,7 +256,12 @@ void MapeditWidget::OnClick(wxMouseEvent& event) | |||
256 | int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (addingEntity->getWidth() / 2); | 256 | int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (addingEntity->getWidth() / 2); |
257 | int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (addingEntity->getHeight() / 2); | 257 | int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (addingEntity->getHeight() / 2); |
258 | 258 | ||
259 | auto data = std::make_shared<MapObjectEntry>(*addingEntity, x, y); | 259 | auto data = std::make_shared<MapObjectEntry>( |
260 | *addingEntity, | ||
261 | x, | ||
262 | y, | ||
263 | map->getAndIncrementNextObjectIndex()); | ||
264 | |||
260 | frame->commitAction(std::make_shared<Undoable>("Add " + addingEntity->getName(), [=] () { | 265 | frame->commitAction(std::make_shared<Undoable>("Add " + addingEntity->getName(), [=] () { |
261 | map->addObject(data); | 266 | map->addObject(data); |
262 | 267 | ||