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

NPCs: uncache weapon value on weapon removal #34188

Merged
merged 1 commit into from
Sep 22, 2019

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented Sep 22, 2019

Summary

SUMMARY: Bugfixes "NPCs: uncache weapon value on weapon removal"

Purpose of change

Fixes #32613

The trade interface allowed you to remove an NPC's weapon without removing the cached value of the weapon. NPCs would refuse to wield other weapons until the cache was refreshed by some other event.

Describe the solution

Invalided the weapon value cache entry when a weapon is removed.

Describe alternatives you've considered

weapon should really be a class in it's own right with a private item and public setters, but that's way more work than I'm going to put into a quick bugfix. It definitely needs to be done when wielding multiple weapons is implemented.

Additional context

Tested by removing a weapon from a friendly NPC in an unpatched game and trying to make them use it, only to get rebuffed because their current weapon was better. Then I applied the patch, recompiled, and tried again, and the NPC took the weapon happily.

Fixes CleverRaven#32613

The trade interface allowed you to remove an NPC's weapon without
removing the cached value of the weapon.

Invalided the weapon value cache entry when a weapon is removed.
@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones NPC / Factions NPCs, AI, Speech, Factions, Ownership labels Sep 22, 2019
@ZhilkinSerg ZhilkinSerg merged commit 371146b into CleverRaven:master Sep 22, 2019
@mlangsdorf mlangsdorf deleted the npc_wield_fix branch September 22, 2019 22:09
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) [C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Friendly NPC won't wield another weapon after the current one was "traded" away from it
2 participants