@ -7,6 +7,13 @@
using namespace fmt ;
using namespace fmt ;
using namespace components ;
using namespace components ;
inline void check_player ( DinkyECS : : World & world ) {
auto player = world . get_the < Player > ( ) ;
fmt : : println ( " PLAYER ENTITY: {} " , player . entity ) ;
auto tile = world . get < Tile > ( player . entity ) ;
dbc : : check ( tile . chr = = " \ua66b " , format ( " PLAYER TILE CHANGED {} != {} " , tile . chr , " \ua66b " ) ) ;
}
inline int make_split ( Room & cur , bool horiz ) {
inline int make_split ( Room & cur , bool horiz ) {
size_t dimension = horiz ? cur . height : cur . width ;
size_t dimension = horiz ? cur . height : cur . width ;
int min = dimension / WORLDBUILD_DIVISION ;
int min = dimension / WORLDBUILD_DIVISION ;
@ -215,10 +222,11 @@ void WorldBuilder::randomize_entities(DinkyECS::World &world, GameConfig &config
int rand_entity = Random : : uniform < int > ( 0 , keys . size ( ) - 1 ) ;
int rand_entity = Random : : uniform < int > ( 0 , keys . size ( ) - 1 ) ;
std : : string key = keys [ rand_entity ] ;
std : : string key = keys [ rand_entity ] ;
auto entity_data = entity_db [ key ] ;
auto entity_data = entity_db [ key ] ;
check_player ( world ) ;
// pass that to the config as it'll be a generic json
// 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 , $ map , entity_data , room_num ) ;
( void ) entity ;
fmt : : println ( " ENTITY: {} " , entity ) ;
}
}
}
}
@ -228,6 +236,11 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
if ( world . has_the < Player > ( ) ) {
if ( world . has_the < Player > ( ) ) {
fmt : : println ( " PLAYER ALREADY EXISTS LEAVING ALONE " ) ;
fmt : : println ( " PLAYER ALREADY EXISTS LEAVING ALONE " ) ;
auto & player = world . get_the < Player > ( ) ;
Point pos_out ;
bool placed = $ map . place_entity ( 0 , pos_out ) ;
dbc : : check ( placed , " failed to randomly place item in room " ) ;
world . set < Position > ( player . entity , { pos_out . x + 1 , pos_out . y + 1 } ) ;
} else {
} else {
auto player_data = config . enemies [ " PLAYER_TILE " ] ;
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 , $ map , player_data , 0 ) ;