diff --git a/src/game/worldbuilder.cpp b/src/game/worldbuilder.cpp index c86cbd2..fe68ed8 100644 --- a/src/game/worldbuilder.cpp +++ b/src/game/worldbuilder.cpp @@ -118,6 +118,10 @@ DinkyECS::Entity WorldBuilder::configure_entity_in_room(DinkyECS::World &world, Point pos_out; bool placed = $map.place_entity(in_room, pos_out); dbc::check(placed, "failed to randomly place item in room"); + + // don't place anything inside a door + if($map.$doors.contains(pos_out)) return DinkyECS::NONE; + auto entity = configure_entity_in_map(world, entity_data, pos_out); return entity; } @@ -208,6 +212,7 @@ void WorldBuilder::configure_starting_items(DinkyECS::World &world) { blanket.add(name); }; + // BUG: Starting items should be configured auto torch_id = System::spawn_item(world, "TORCH_BAD"); auto &inventory = world.get(player.entity); @@ -239,6 +244,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) { } else { auto player_data = config.enemies["PLAYER_TILE"]; auto player_ent = configure_entity_in_room(world, player_data, 0); + dbc::check(player_ent != DinkyECS::NONE, "placed the player in a door!"); player_pos = world.get(player_ent);