Mostly pulled out all of the ftxui rendering into cleaner areas.

main
Zed A. Shaw 2 months ago
parent 710076edfb
commit 10e5f53292
  1. 7
      entity.hpp
  2. 7
      map.cpp
  3. 1
      map.hpp

@ -13,12 +13,15 @@ enum class EntityEvent {
class Entity : public DeadSimpleFSM<EntityState, EntityEvent> { class Entity : public DeadSimpleFSM<EntityState, EntityEvent> {
public: public:
Point location; Point location{0,0};
int hp = 20; int hp = 20;
int damage = 10; int damage = 10;
Entity() {
}
Entity(Point loc) : location(loc) { Entity(Point loc) : location(loc) {
}; }
// disable copy // disable copy
Entity(Entity &e) = delete; Entity(Entity &e) = delete;

@ -286,6 +286,13 @@ void Map::clear_target(Point &at) {
input_map_[at.y][at.x] = 1; 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() { void Map::generate() {
Room root{ Room root{
.x = 0, .x = 0,

@ -82,4 +82,5 @@ public:
bool walk(Point &src, Point &target); bool walk(Point &src, Point &target);
void set_door(Room &room, int value); void set_door(Room &room, int value);
void dump(); void dump();
Point place_entity(size_t room_index);
}; };

Loading…
Cancel
Save