@ -7,9 +7,10 @@
using namespace fmt ;
using namespace fmt ;
using namespace components ;
using namespace components ;
inline void check_player ( DinkyECS : : World & world ) {
inline void check_player ( DinkyECS : : World & world , DinkyECS : : Entity entity ) {
auto player = world . get_the < Player > ( ) ;
auto player = world . get_the < Player > ( ) ;
fmt : : println ( " PLAYER ENTITY: {} " , player . entity ) ;
dbc : : check ( player . entity ! = entity , " player shouldn't be added to world " ) ;
auto tile = world . get < Tile > ( player . entity ) ;
auto tile = world . get < Tile > ( player . entity ) ;
dbc : : check ( tile . chr = = " \ua66b " , format ( " PLAYER TILE CHANGED {} != {} " , tile . chr , " \ua66b " ) ) ;
dbc : : check ( tile . chr = = " \ua66b " , format ( " PLAYER TILE CHANGED {} != {} " , tile . chr , " \ua66b " ) ) ;
}
}
@ -222,11 +223,10 @@ 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 ) ;
fmt : : println ( " ENTITY: {} " , entity ) ;
check_player ( world , entity ) ;
}
}
}
}
@ -235,7 +235,6 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
// configure a player as a fact of the world
// configure a player as a fact of the world
if ( world . has_the < Player > ( ) ) {
if ( world . has_the < Player > ( ) ) {
fmt : : println ( " PLAYER ALREADY EXISTS LEAVING ALONE " ) ;
auto & player = world . get_the < Player > ( ) ;
auto & player = world . get_the < Player > ( ) ;
Point pos_out ;
Point pos_out ;
bool placed = $ map . place_entity ( 0 , pos_out ) ;
bool placed = $ map . place_entity ( 0 , pos_out ) ;