summaryrefslogtreecommitdiffstats
path: root/src/control/MapContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/MapContext.cpp')
-rw-r--r--src/control/MapContext.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/control/MapContext.cpp b/src/control/MapContext.cpp
index acad969..8900298 100644
--- a/src/control/MapContext.cpp
+++ b/src/control/MapContext.cpp
@@ -35,9 +35,7 @@ MapContext::MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const s
: eventBus(eventBus0), inputHandler(inputHandler0), map(map0) {
view = std::unique_ptr<View::MapView>(new View::MapView(window, map.getTileset()));
- map.getEntities().emplace_back("square");
- playerEntity = &map.getEntities().back();
- playerEntity->moveTo(&map, Model::Position{8, 8});
+ playerEntity = map.addEntity("square", Model::Position{8, 8});
view->updateEntities(map.getEntities());
@@ -50,12 +48,12 @@ MapContext::MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const s
}
void MapContext::movePlayer(Model::Direction dir, uint64_t time) {
- if (!playerEntity->move(&map, dir, time, time+250))
+ if (!map.moveEntity(playerEntity, dir, time, time+250))
return;
eventBus->enqueue(
[=] {
- playerEntity->finishTransition(&map);
+ map.finishEntityTransition(playerEntity);
movePlayerContinue(time+250);
},
time+250