BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail.
This commit is contained in:
parent
96efc990c1
commit
9e91c71125
25 changed files with 128 additions and 526 deletions
|
@ -182,10 +182,10 @@ void WorldBuilder::generate_map() {
|
|||
}
|
||||
|
||||
|
||||
DinkyECS::Entity configure_entity_in_map(DinkyECS::World &world, Map &game_map, json &entity_data, int in_room) {
|
||||
DinkyECS::Entity WorldBuilder::configure_entity_in_map(DinkyECS::World &world, json &entity_data, int in_room) {
|
||||
auto item = world.entity();
|
||||
Point pos_out;
|
||||
bool placed = game_map.place_entity(in_room, pos_out);
|
||||
bool placed = $map.place_entity(in_room, pos_out);
|
||||
dbc::check(placed, "failed to randomly place item in room");
|
||||
world.set<Position>(item, {pos_out.x+1, pos_out.y+1});
|
||||
|
||||
|
@ -194,7 +194,7 @@ DinkyECS::Entity configure_entity_in_map(DinkyECS::World &world, Map &game_map,
|
|||
}
|
||||
|
||||
if(entity_data.contains("components")) {
|
||||
components::configure(world, item, entity_data);
|
||||
DinkyECS::configure($components, world, item, entity_data["components"]);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
@ -235,16 +235,16 @@ void WorldBuilder::randomize_entities(DinkyECS::World &world, GameConfig &config
|
|||
auto entity_data = entity_db[key];
|
||||
|
||||
// pass that to the config as it'll be a generic json
|
||||
auto entity = configure_entity_in_map(world, $map, entity_data, room_num);
|
||||
auto entity = configure_entity_in_map(world, entity_data, room_num);
|
||||
check_player(world, entity);
|
||||
}
|
||||
}
|
||||
|
||||
inline void place_stairs(DinkyECS::World& world, GameConfig& config, Map& map) {
|
||||
void WorldBuilder::place_stairs(DinkyECS::World& world, GameConfig& config) {
|
||||
auto& device_config = config.devices.json();
|
||||
auto entity_data = device_config["STAIRS_DOWN"];
|
||||
int last_room = map.room_count() - 1;
|
||||
auto entity = configure_entity_in_map(world, map, entity_data, last_room);
|
||||
int last_room = $map.room_count() - 1;
|
||||
auto entity = configure_entity_in_map(world, entity_data, last_room);
|
||||
check_player(world, entity);
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
|
|||
world.set<Position>(player.entity, {pos_out.x+1, pos_out.y+1});
|
||||
} else {
|
||||
auto player_data = config.enemies["PLAYER_TILE"];
|
||||
auto player_ent = configure_entity_in_map(world, $map, player_data, 0);
|
||||
auto player_ent = configure_entity_in_map(world, player_data, 0);
|
||||
// configure player in the world
|
||||
Player player{player_ent};
|
||||
world.set_the<Player>(player);
|
||||
|
@ -269,7 +269,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
|
|||
}
|
||||
|
||||
randomize_entities(world, config);
|
||||
place_stairs(world, config, $map);
|
||||
place_stairs(world, config);
|
||||
}
|
||||
|
||||
void WorldBuilder::generate(DinkyECS::World &world) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue