Fixed up the map generator so that it's placing entities in non-overlapping tiles and adapting the style for the size. It can also deal with maps that have no rooms better and places the stairs better.

This commit is contained in:
Zed A. Shaw 2025-05-22 12:24:59 -04:00
parent 5f1a453fb4
commit 4eaf3c35d6
11 changed files with 55 additions and 45 deletions

View file

@ -3,11 +3,13 @@
#include "map.hpp"
#include "dinkyecs.hpp"
#include "components.hpp"
#include "spatialmap.hpp"
class WorldBuilder {
public:
Map& $map;
components::ComponentMap& $components;
SpatialMap $collision;
WorldBuilder(Map &map, components::ComponentMap& components) :
$map(map),
@ -20,6 +22,7 @@ class WorldBuilder {
DinkyECS::Entity configure_entity_in_room(DinkyECS::World &world, nlohmann::json &entity_data, int in_room);
bool find_open_spot(Point& pos_out);
void place_entities(DinkyECS::World &world);
void generate(DinkyECS::World &world);
void randomize_entities(DinkyECS::World &world, components::GameConfig &config);