bugfix(pathfinder): Improve initialization of uninitialized variable in Pathfinder::classifyFence#2460
Draft
Caball009 wants to merge 3 commits intoTheSuperHackers:mainfrom
Draft
Conversation
Mauller
reviewed
Mar 18, 2026
| @@ -4161,8 +4165,17 @@ void Pathfinder::classifyFence( Object *obj, Bool insert ) | |||
|
|
|||
| // In retail, the values in the stack often look like this. We set them | |||
There was a problem hiding this comment.
These comments are no longer valid with your new code, they were associated with the prior removed initialised values
Author
There was a problem hiding this comment.
Which part of the comment would you say has become invalid with the new code?
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.
( the link is broken on purpose so it doesn't link, because I may close this draft PR if it doesn't work out )
This PR makes a small change to the initialization of the previously uninitialized variable in
Pathfinder::classifyFence. I saw 4 places where the game eventually callsPathfinder::classifyFencefor maps with fences:GameLogic::startNewGameGameLogic::processDestroyListToppleUpdate::applyTopplingForceGameLogic::processDestroyListI noticed there's an initialization pattern that the game appears to follow for the most part. The uninitialized values tend to be either very large (> 100'000) or 0.
GameLogic::processDestroyListruns directly afterPartitionManager::updatewhich zero initializes > 20K of memory on the stack, which sets the uninitialized variables that are used inPathfinder::classifyFenceto 0, and they usually stay 0.I also noticed that the destruction of an object drawable can modify the values as well, which is why the zero initialization is disabled after the first destroyed object. Naturally, there's no way to come up with a complete fix due to the nature of the issue, but the new initialization does the fix the mismatches in these two replays:
fixed_replays.zip
I have four replays in total that mismatched because of the uninitialized variable; two are fixed with this change, and two continue to mismatch:
mm_replays.zip
TODO: