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.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/control/MapContext.cpp b/src/control/MapContext.cpp
index 4d3a4d7..5fda337 100644
--- a/src/control/MapContext.cpp
+++ b/src/control/MapContext.cpp
@@ -31,14 +31,18 @@ namespace RPGEdit {
namespace Control {
-MapContext::MapContext(TileLoader *tileLoader0, const std::shared_ptr<const Model::Map> &map0)
- : tileLoader(tileLoader0), map(map0) {
+MapContext::MapContext(ImageLoader *imageLoader0, const std::shared_ptr<const Model::Map> &map0)
+ : imageLoader(imageLoader0), map(map0) {
const std::vector<std::string> &tileset = map->getTileset();
tiles.resize(tileset.size());
-
for (size_t i = 0; i < tileset.size(); i++)
- tiles[i] = tileLoader->get(tileset[i]);
+ tiles[i] = imageLoader->get("tile/" + tileset[i]);
+
+ std::deque<std::shared_ptr<Model::Entity>> &mapEntities = map->getEntities();
+
+ for (const std::shared_ptr<Model::Entity> &entity : mapEntities)
+ entities[entity->getName()] = imageLoader->get("entity/" + entity->getName());
}
}