Cataclysm-dda: Taking off item spawning "none" item

Created on 23 Apr 2018  路  11Comments  路  Source: CleverRaven/Cataclysm-DDA

If you take off an item using the take off menu, and removing it would cause you to get over the volume limit, you will be presented with a prompt asking if you want to drop it. Selecting yes will pop an error and spawn a "none" item. If you select no, you simply keep wearing the item.

Expected behaviour

You drop the item.

Actual behaviour

You drop the item and spawn a "none" item.

Steps to reproduce the behavior

Take off an item using the take off menu, that will cause you to get over the volume limit.

Debug log

src/character.cpp:829 [item Character::i_rem(const item*)] did not found item none to remove it!

(S2 - Confirmed) <Bug> Items / Item Actions / Item Qualities

Most helpful comment

Fixed by #23663.

I tried to use the automagic close keyword in my PR but I couldn't figure out the formatting since there were two issues.

You can do something like this:

Fixes #23586. Fixes #23524.

All 11 comments

Possible duplicate of #23524.

Cannot reproduce in 7327. __Edit:__ Actually reproduced.
Reproduced in 7342.

I'm using 7334 if that helps as well.

I'm using 7334 if that helps as well.

Can you reproduce this bug there?

Sorry for the confusion. Can't reproduce in 7334. I encountered this when using 7339, which I reverted from back to 7334 because of #23573 Edit: Might have been in 7334 I first encountered this when I think about it, but I couldn't reproduce it again for some reason. Might not always trigger this bug.

Suspecting #23413.

After running Valgrind and digging through the code, I'm strongly suspecting #23242 to be the cause of both this and #23524.

It looks like the drop() function queues up an activity that also happens to take off the item. Previously, if the item was dropped due to lack of space, the code would bail immediately and let the drop function take care of it. The PR for 23242 changed that behavior so that it continues to the function and drops the item again.

Here is a bt just before the bug happens:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x00000001000c51de cataclysm-tiles`Character::i_rem(item const*)
    frame #1: 0x000000010002a049 cataclysm-tiles`obtain_activity_items(player_activity&, player&) + 282
    frame #2: 0x000000010002a407 cataclysm-tiles`activity_handlers::drop_do_turn(player_activity*, player*) + 95
    frame #3: 0x000000010002ef35 cataclysm-tiles`std::__1::function<VisitResponse (item const*, item const*)>::operator()(item const*, item const*) const + 39
    frame #4: 0x00000001006ed04e cataclysm-tiles`player_activity::do_turn(player&) + 114
    frame #5: 0x00000001001d27fe cataclysm-tiles`game::process_activity() + 122
    frame #6: 0x00000001001d18ce cataclysm-tiles`game::do_turn() + 502
    frame #7: 0x00000001003c5fa8 cataclysm-tiles`main + 2760
    frame #8: 0x00007fff6c5d1015 libdyld.dylib`start + 1
(lldb)

Can be closed after #23663?

This and #23524 should be closable. I just tried it out in the latest master and the bug seems to be fixed. (It's fairly easy to reproduce if someone else wants to confirm). I tried to use the automagic close keyword in my PR but I couldn't figure out the formatting since there were two issues.

Fixed by #23663.

I tried to use the automagic close keyword in my PR but I couldn't figure out the formatting since there were two issues.

You can do something like this:

Fixes #23586. Fixes #23524.

Was this page helpful?
0 / 5 - 0 ratings