summaryrefslogtreecommitdiffstats
path: root/src/model/Map.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-26 01:42:49 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-26 01:42:49 +0200
commitd9f829f10a8310f53d945cd96ecce28193b792d8 (patch)
treeb7b925e644c460632f1262df84cc84d36c096c9c /src/model/Map.hpp
parent3177ba222467e74d761d6a545ef05e8f1a0993c0 (diff)
downloadrpgedit-d9f829f10a8310f53d945cd96ecce28193b792d8.tar
rpgedit-d9f829f10a8310f53d945cd96ecce28193b792d8.zip
Add support for interactions with entities
Diffstat (limited to 'src/model/Map.hpp')
-rw-r--r--src/model/Map.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/model/Map.hpp b/src/model/Map.hpp
index 0343709..acf93b1 100644
--- a/src/model/Map.hpp
+++ b/src/model/Map.hpp
@@ -223,6 +223,18 @@ public:
return tiles[layer][p.y*width + p.x];
}
+ Entity * getEntityAt(const Position<int> &p) {
+ auto it = positions.find(p);
+ if (it == positions.end())
+ return nullptr;
+
+ return *it->second.begin();
+ }
+
+ Position<int> getEntityPosition(const Entity *entity) const {
+ return entityStates.at(entity).position;
+ }
+
Position<float> getEntityPosition(const Entity *entity, uint64_t time) const;
bool moveEntity(Entity *entity, Direction dir, uint64_t start, uint64_t end);
void moveEntityTo(Entity *entity, Position<int> pos);