diff --git a/entity.hpp b/entity.hpp index 1c9eeeb..92cee27 100644 --- a/entity.hpp +++ b/entity.hpp @@ -13,12 +13,15 @@ enum class EntityEvent { class Entity : public DeadSimpleFSM { public: - Point location; + Point location{0,0}; int hp = 20; int damage = 10; + Entity() { + } + Entity(Point loc) : location(loc) { - }; + } // disable copy Entity(Entity &e) = delete; diff --git a/map.cpp b/map.cpp index 2abea56..a2d178a 100644 --- a/map.cpp +++ b/map.cpp @@ -286,6 +286,13 @@ void Map::clear_target(Point &at) { input_map_[at.y][at.x] = 1; } +Point Map::place_entity(size_t room_index) { + dbc::check(room_index < rooms_.size(), "room_index is out of bounds, not enough rooms"); + + Room &start = rooms_[room_index]; + return {start.x+1, start.y+1}; +} + void Map::generate() { Room root{ .x = 0, diff --git a/map.hpp b/map.hpp index cb3c30d..817678f 100644 --- a/map.hpp +++ b/map.hpp @@ -82,4 +82,5 @@ public: bool walk(Point &src, Point &target); void set_door(Room &room, int value); void dump(); + Point place_entity(size_t room_index); };