Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some item deletion bugs #42077

Merged
merged 2 commits into from
Jul 14, 2020
Merged

Conversation

Trioct
Copy link
Contributor

@Trioct Trioct commented Jul 13, 2020

Summary

SUMMARY: Bugfixes "Fix some item deletion bugs"

Purpose of change

Fixes #40393 where tying an animal would delete whatever contained the rope you used
Related to #42059 (not enough info to know if it fixes it)
Fixes another bug where trying to unwield a container could ask to try to put the container in itself, deleting it

Describe the solution

Using i_rem( item* ) instead of i_rem( int ) (which I honestly think should be removed, not sure if that's possible)
Simple checks to stop a container from considering putting itself in itself

Describe alternatives you've considered

Seeing if switching all Character::i_rem( int ) uses to Character::i_rem( item* ) was possible, but I just want to get these bugs fixed

Testing

Bug 1:
Reproduce the steps in #40393 with their save file

Bug 2:
Strip naked
Wield a backpack
Unwield the backpack
Can no longer choose to put the backpack in itself

Additional context

i_rem( int ) + get_item_position is a dangerous combo, you can easily delete entire containers instead of what's in the container

@KorGgenT
Copy link
Member

KorGgenT commented Jul 13, 2020

I agree that Character::i_rem( int ) needs to be removed if at all possible (out of scope to do all of them in this PR but just letting you know)

@Hulkninja
Copy link

This may very well be the issue that caused a lot of my gear to disappear. I did adopt a Border Collie, which I've tied down at several points...

@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) Items / Item Actions / Item Qualities Items and how they work and interact Monsters Monsters both friendly and unfriendly. labels Jul 14, 2020
@kevingranade kevingranade merged commit 6486441 into CleverRaven:master Jul 14, 2020
@Trioct Trioct deleted the fix-item-deletion branch July 14, 2020 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Items / Item Actions / Item Qualities Items and how they work and interact Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animal tying kills backpack
5 participants