SpatialMap now uses unordered_multimap to allow for multiple items in a square, but they're also tagged to mark some with collision.

This commit is contained in:
Zed A. Shaw 2025-07-31 13:00:39 -04:00
parent b193bab148
commit f26189c696
6 changed files with 60 additions and 51 deletions

View file

@ -214,7 +214,7 @@ void System::death(GameLevel &level) {
auto pos = world.get<Position>(ent);
// need to remove _after_ getting the position
level.collision->remove(pos.location);
level.collision->remove(pos.location, ent);
// distribute_loot is then responsible for putting something there
System::distribute_loot(level, pos);
@ -327,7 +327,7 @@ void System::collision(GameLevel &level) {
*/
void System::remove_from_world(GameLevel &level, Entity entity) {
auto& item_pos = level.world->get<Position>(entity);
level.collision->remove(item_pos.location);
level.collision->remove(item_pos.location, entity);
level.world->remove<Tile>(entity);
// if you don't do this you get the bug that you can pickup
// an item and it'll also be in your inventory