bugfix(saveload): Transfer the weapon set pitch limit flag - #3145
Draft
bobtista wants to merge 2 commits into
Draft
bugfix(saveload): Transfer the weapon set pitch limit flag#3145bobtista wants to merge 2 commits into
bobtista wants to merge 2 commits into
Conversation
bobtista
force-pushed
the
bobtista/bugfix/weaponset-pitch-limit-xfer
branch
3 times, most recently
from
August 14, 2026 18:52
5b32662 to
d86a7c4
Compare
bobtista
force-pushed
the
bobtista/bugfix/weaponset-pitch-limit-xfer
branch
from
August 14, 2026 18:52
d86a7c4 to
551a841
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WeaponSet::xferwrites two bools and passes the same member to both:m_hasPitchLimitis declared immediately beforem_hasDamageWeaponand belongs in the first slot. The record is the right size, so nothing fails loudly; the flag is simply never written and never read.Nothing restores it afterwards.
updateWeaponSetrecomputes the flag behindset != m_curWeaponTemplateSet, and the load has already restoredm_curWeaponTemplateSetto the saved set, so the body is skipped and the flag keeps the value derived from the weapon set the object was constructed with.isAnyWithinTargetPitchreturns true from its first line when the flag is false, so a unit accepts a target outside its firing pitch and then cannot connect.Now the first slot carries
m_hasPitchLimitfrom version 3 and keeps the repeatedm_hasDamageWeaponbelow it, so older saves load exactly as they did before and the record size is unchanged.Measured by forcing a value at save time that the default weapon set cannot produce, then reading both flags back on load, with
m_hasDamageWeaponas a control:The control round trips in every case, so the record is written and read; the middle row is byte for byte the old behaviour, which is what keeps retail saves readable.
The flag is engine derived rather than authored, so how often the fault is reachable depends on whether a template set adds a pitch limit that the object's default set lacks. That data lives in the shipped archives, so this measures the transfer rather than a specific unit.
Todo: