Skip to content

Commit c8401bf

Browse files
helmutbuhlerCookieLandProjects
authored andcommitted
bugfix(pathfinder): Fix uninitialized variable in Pathfinder::classifyFence() and possible source of mismatches in Retail-compatible builds (TheSuperHackers#1748)
1 parent 31d633f commit c8401bf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4059,8 +4059,14 @@ void Pathfinder::classifyFence( Object *obj, Bool insert )
40594059
cellBounds.lo.x = REAL_TO_INT_FLOOR((pos->x + 0.5f)/PATHFIND_CELL_SIZE_F);
40604060
cellBounds.lo.y = REAL_TO_INT_FLOOR((pos->y + 0.5f)/PATHFIND_CELL_SIZE_F);
40614061
// TheSuperHackers @fix Mauller 16/06/2025 Fixes uninitialized variables.
4062-
// To keep retail compatibility they need to be uninitialized in VC6 builds.
4063-
#if !(defined(_MSC_VER) && _MSC_VER < 1300)
4062+
#if RETAIL_COMPATIBLE_CRC
4063+
//CRCDEBUG_LOG(("Pathfinder::classifyFence - (%d,%d)", cellBounds.hi.x, cellBounds.hi.y));
4064+
4065+
// In retail, the values in the stack often look like this. We set them
4066+
// to reduce the likelihood of mismatch.
4067+
cellBounds.hi.x = 253961804;
4068+
cellBounds.hi.y = 4202797;
4069+
#else
40644070
cellBounds.hi.x = REAL_TO_INT_CEIL((pos->x + 0.5f)/PATHFIND_CELL_SIZE_F);
40654071
cellBounds.hi.y = REAL_TO_INT_CEIL((pos->y + 0.5f)/PATHFIND_CELL_SIZE_F);
40664072
#endif

0 commit comments

Comments
 (0)