Mostly pulled out all of the ftxui rendering into cleaner areas.
This commit is contained in:
parent
710076edfb
commit
10e5f53292
3 changed files with 13 additions and 2 deletions
|
@ -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;
|
||||||
|
|
7
map.cpp
7
map.cpp
|
@ -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,
|
||||||
|
|
1
map.hpp
1
map.hpp
|
@ -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…
Add table
Add a link
Reference in a new issue