Unloading adjacent ammo belts throws error, leaves empty belt behind #35368
Labels
<Bug>
This needs to be fixed
Items: Magazines
Ammo holding items and objects.
(S2 - Confirmed)
Bug that's been confirmed to exist
Projects
Milestone
Describe the bug
src/visitable.cpp:506 [item visitable<T>::remove_item(item&) [with T = Character]] Tried removing item from object which did not contain it
If you unload an ammo belt from an adjacent tile, the above error appears and the belt is not removed from the game, leaving behind an ammo belt with 0 ammunition which shouldn't be a thing since you've deconstructed the ammo links it consists of.
Steps To Reproduce
Expected behavior
The ammo belt should disappear once empty, and the game attempts to do just that. I believe this bug is an oversight from when the ability to interact with adjacent objects without picking them up was implemented, the code seems to assume that the ammo belt is being moved to the player's inventory to unload it.
Versions and configuration
This has happened under 3 different versions/configurations already, but here's my current one anyway:
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Aftershock [aftershock],
More Survival Tools [More_Survival_Tools],
Modular Turrets [modular_turrets],
Salvaged Robots [Salvaged_Robots],
Vehicle Additions Pack [blazemod],
Tanks and Other Vehicles [Tanks],
Disable Religious Texts [no_religious_Texts],
No Acid Zombies [No_Acid_Zombies],
No Ants [No_Anthills],
No Big Zombies [No_Big_Zombies],
No Explosive Zombies [No_Explosive_Zombies],
No Fungal Monsters [No_Fungi],
Safe Autodoc [safeautodoc],
Prevent Zombie Revivication [no_reviving_zombies],
Stats Through Skills [StatsThroughSkills],
Alternative Map Key [alt_map_key],
Fuji's Military Profession Pack [fuji_mpp]
]
Additional context
It's pretty clear the code used to unload ammo belts expects them to be in the player's inventory. It just needs to be changed so that it'll remove the belt no matter where it is.
The text was updated successfully, but these errors were encountered: