Cataclysm-BN icon indicating copy to clipboard operation
Cataclysm-BN copied to clipboard

Item locations invalidated when dropping cash cards right after making deposit (also there is undefined behaviour somewhere)

Open AngelicosPhosphoros opened this issue 2 years ago • 1 comments

Describe the bug

I have a save with a character with 18 cash cards and two-way radio.

So if I deposit all money at ATM then drop all cash cards, somehow 2 cash cards remain in inventory but radios battery gets dropped into ground.

If I turn on debug mode, game just crashes after dropping few of cards.

Steps To Reproduce

Drop invalid items:

  1. Load provided save.
  2. Deposit all money using ATM.
  3. Drop your cash cards.
  4. Check inventory and see 2 cash cards remain.
  5. Check floor and see battery or other not-selected item dropped.

Get crash.

  1. Load provided save.
  2. Enable debug mode.
  3. Deposit all money using ATM.
  4. Drop your cash cards.
  5. Game crashes.

Expected behavior

Drop only requested items and don't crash if debug mode enabled.

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0 2009
  • Game Version: 81039bcb1e [64-bit]
  • Graphics Version: Tiles
  • Game Language: []
  • Mods loaded: [ Bright Nights [dda], Elevated bridges [elevated_bridges], No Fungal Monsters [No_Fungi], Bionic Slots [cbm_slots] ]

Additional context

Sorry for such huge save but I failed to make smaller reproduction case. Kongiganak.zip

Crash is caused by calling item::display_name on nullptr at debug_drop_list.

And item_locaton gets lost at somepoint between drop_activity_actor::do_turn calls.

I suppose, those missing items substituted by other items in player inventory.

AngelicosPhosphoros avatar Jun 25 '22 09:06 AngelicosPhosphoros

Probably related to #1140.

olanti-p avatar Jun 25 '22 10:06 olanti-p