Tracked down the bug that was caused by picking up an item but not removing its Position in the world, so when you go to another level it gets brought back to life causing a dupe.
This commit is contained in:
parent
2c6565c40a
commit
e0588847fa
7 changed files with 62 additions and 5 deletions
|
@ -27,7 +27,16 @@ inline shared_ptr<DinkyECS::World> clone_load_world(shared_ptr<DinkyECS::World>
|
|||
auto world = make_shared<DinkyECS::World>();
|
||||
|
||||
if(prev_world != nullptr) {
|
||||
fmt::println("############### NEW WORLD #################");
|
||||
prev_world->clone_into(*world);
|
||||
|
||||
fmt::println("new world entity_count={}, prev={}", world->entity_count, prev_world->entity_count);
|
||||
|
||||
for(auto [ent, is_set] : prev_world->$constants) {
|
||||
if(world->has<components::Sprite>(ent)) {
|
||||
fmt::println("#### Sprite {} copied to new world.", ent);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
save::load_configs(*world);
|
||||
}
|
||||
|
@ -83,6 +92,7 @@ DinkyECS::Entity LevelManager::spawn_enemy(std::string named) {
|
|||
|
||||
size_t LevelManager::create_level(shared_ptr<DinkyECS::World> prev_world) {
|
||||
auto world = clone_load_world(prev_world);
|
||||
|
||||
auto scaling = scale_level();
|
||||
|
||||
auto map = make_shared<Map>(scaling.map_width, scaling.map_height);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue