summaryrefslogtreecommitdiffstats
path: root/src/view/MapView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/MapView.cpp')
-rw-r--r--src/view/MapView.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/view/MapView.cpp b/src/view/MapView.cpp
index dbce5e4..4a6e552 100644
--- a/src/view/MapView.cpp
+++ b/src/view/MapView.cpp
@@ -76,11 +76,11 @@ MapView::~MapView() {
clearEntities();
}
-void MapView::updateEntities(const std::deque<Model::Entity> &entities) {
+void MapView::updateEntities(const std::vector<std::unique_ptr<Model::Entity>> &entities) {
SpriteCache *spriteCache = window->getSpriteCache();
for (auto &entity : entities) {
- const std::string &name = entity.getName();
+ const std::string &name = entity->getName();
if (!entitySprites[name])
entitySprites[name] = SDL_CreateTextureFromSurface(window->getRenderer(), spriteCache->get("entity", name));
@@ -137,8 +137,8 @@ void MapView::render(const Model::Map *map, Model::Position center, uint64_t tim
}
for (auto &entity : map->getEntities()) {
- Model::Position pos = entity.getPosition(time);
- Model::Direction dir = entity.getDirection();
+ Model::Position pos = map->getEntityPosition(entity.get(), time);
+ Model::Direction dir = entity->getDirection();
SDL_Rect src = {
.x = getTileSize()*dir,
@@ -154,7 +154,7 @@ void MapView::render(const Model::Map *map, Model::Position center, uint64_t tim
.h = tilePixels,
};
- SDL_RenderCopy(window->getRenderer(), entitySprites[entity.getName()], &src, &dst);
+ SDL_RenderCopy(window->getRenderer(), entitySprites[entity->getName()], &src, &dst);
}
}