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

Dupe item fix when standing on terrain that won't hold items #45290

Merged
merged 1 commit into from
Nov 8, 2020

Conversation

RoyBerube
Copy link
Contributor

@RoyBerube RoyBerube commented Nov 7, 2020

Summary

SUMMARY: Bugfixes "Dupe item fix when standing on terrain that won't hold items"

Purpose of change

Fixes #45242

Problem was caused when trying to wear an item from an adjacent space, with a full inventory and while standing on terrain that cannot contain any items. An open window frame is this type of location.

Describe the solution

The sequence of events had a few conditions that led to the dupe bug. An attempt to wear an item would first put it in inventory. If inventory was full, it would query the player to wield it or handle it. Escaping out of this menu would wear the item anyway, and the item on the ground could not be deleted because the game assumed it would be at the player's feet, which would be impossible in this circumstance.

This fix addresses the issue by changing the player::wear() method to require an item_location instead of an item. The item_location can now be deleted reliably. Also, the item is not initially placed into the player's inventory before attempting to wear it. This avoids the query menu popup to wield or handle the item while having a full inventory.

Also using an autodoc to install a splint has been simplified and changed to just wear the item directly. Attempting to wear using an item_location led to an error message while having a full inventory. Since the method call had to be changed anyway due to the change in signature, I figure this is closely related to this issue and can be included in this PR.

Describe alternatives you've considered

Testing

Ran full test: no problems found.

With full inventory and also with plenty of inventory space, using steps outlined in issue above (window not available for autodoc):

  • Backpack: worn with no duplicate, error message, or popup.

  • Assorted clothing items: worn with no duplicate, popup, or error message

  • Autodoc install of splint: splint is worn with no duplicate, error message, or popup.

  • Install splint manually: splint is worn with no duplicate, error message, or popup.

Additional context

I had to change the parameter item_location to pass by value instead of by reference due to clang complaining about rvalue. Another option would have been to make it a const reference but that would have made deleting the item_location impossible.

@RoyBerube RoyBerube marked this pull request as draft November 7, 2020 21:22
@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) <Exploit> Unintended interactions or behavior, usually breaking how the game is balanced Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones labels Nov 8, 2020
@RoyBerube RoyBerube marked this pull request as ready for review November 8, 2020 05:47
@ZhilkinSerg ZhilkinSerg merged commit f7ba8e8 into CleverRaven:master Nov 8, 2020
@RoyBerube RoyBerube deleted the dupe_bug branch November 8, 2020 23:11
@utechenko-v
Copy link

I have similar bug #45315 with item duplication, but I'm not sure is it separate bug or a variation of this one.
That bug is reproducible when standing on regular tile (pavement) and don't need pressing Esc key.

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) <Exploit> Unintended interactions or behavior, usually breaking how the game is balanced Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Item duplication by standing in a window
4 participants