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 item_contents save/load #41006

Merged

Conversation

KorGgenT
Copy link
Member

@KorGgenT KorGgenT commented Jun 1, 2020

Summary

SUMMARY: Bugfixes "fix item_contents save/load"

Purpose of change

related #40127 - possibly fixes it but i haven't checked random item spawns as this doesn't effect them at all

Fixes #40876

Describe the solution

the load function for item_contents incorrectly assumes that the insert_item function will insert the item into the same pocket that the item was saved in - but this is definitely not the case as items are dynamically assigned and possibly specifically assigned by the player. additionall, the MIGRATION item pocket was never utilized such that items won't disappear on save/load.

a weakness of this implementation is the following example: an item has multiple pockets, and someone changes the json to rearrange the pockets, or add a MAGAZINE pocket to the front. in this case, most of the items will be moved to the MIGRATION pocket, necessitating the player to pick up the items after they fall to the ground after moving once.

Testing

several save/load cycles, with 2 army jackets and jeans and assorted sundry of items. also spawned in canned sardines to make sure they stay sealed across the save/load cycle.

Additional context

this might be one of the main things that are causing cans to appear to spawn open, maybe people are saving and loading near enough to houses to have the items spawned and go through the save/load cycle. it's worth reassessing the related bug report after this bugfix.

@KorGgenT KorGgenT added <Bugfix> This is a fix for a bug (or closes open issue) Items: Containers Things that hold other things labels Jun 1, 2020
src/item_contents.cpp Outdated Show resolved Hide resolved
Co-authored-by: Kevin Granade <[email protected]>
@kevingranade kevingranade merged commit 028dddb into CleverRaven:master Jun 2, 2020
@KorGgenT KorGgenT deleted the fix-item_contents-save/load branch June 2, 2020 08:07
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: Containers Things that hold other things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sealed items open across save
2 participants