Skip to content

Commit 73f3efd

Browse files
committed
Added specialized initialization classifyFence.
1 parent b18feac commit 73f3efd

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,11 @@ class Pathfinder : PathfindServicesInterface, public Snapshot
896896
Int m_queuePRHead;
897897
Int m_queuePRTail;
898898
Int m_cumulativeCellsAllocated;
899+
900+
#if RETAIL_COMPATIBLE_CRC
901+
public:
902+
Bool m_classifyFenceZeroInit;
903+
#endif
899904
};
900905

901906

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3972,6 +3972,10 @@ void Pathfinder::reset()
39723972
s_useFixedPathfinding = false;
39733973
s_forceCleanCells = false;
39743974
#endif
3975+
3976+
#if RETAIL_COMPATIBLE_CRC
3977+
m_classifyFenceZeroInit = false;
3978+
#endif
39753979
}
39763980

39773981
/**
@@ -4113,8 +4117,17 @@ void Pathfinder::classifyFence( Object *obj, Bool insert )
41134117

41144118
// In retail, the values in the stack often look like this. We set them
41154119
// to reduce the likelihood of mismatch.
4116-
cellBounds.hi.x = 253961804;
4117-
cellBounds.hi.y = 4202797;
4120+
if (m_classifyFenceZeroInit)
4121+
{
4122+
cellBounds.hi.x = 0;
4123+
cellBounds.hi.y = 0;
4124+
}
4125+
else
4126+
{
4127+
// the value just needs to be larger than the width and height of m_map
4128+
cellBounds.hi.x = 1000000;
4129+
cellBounds.hi.y = 1000000;
4130+
}
41184131
#else
41194132
cellBounds.hi.x = REAL_TO_INT_CEIL((pos->x + 0.5f)/PATHFIND_CELL_SIZE_F);
41204133
cellBounds.hi.y = REAL_TO_INT_CEIL((pos->y + 0.5f)/PATHFIND_CELL_SIZE_F);

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,10 @@ void GameLogic::processDestroyList()
24892489
{
24902490
//USE_PERF_TIMER(processDestroyList)
24912491

2492+
#if RETAIL_COMPATIBLE_CRC
2493+
TheAI->pathfinder()->m_classifyFenceZeroInit = !m_objectsToDestroy.empty();
2494+
#endif
2495+
24922496
for( ObjectPointerListIterator iterator = m_objectsToDestroy.begin(); iterator != m_objectsToDestroy.end(); iterator++ )
24932497
{
24942498
Object* currentObject = (*iterator);
@@ -2547,6 +2551,10 @@ void GameLogic::processDestroyList()
25472551
removeObjectFromLookupTable( currentObject );
25482552

25492553
Object::friend_deleteInstance(currentObject);//actual delete
2554+
2555+
#if RETAIL_COMPATIBLE_CRC
2556+
TheAI->pathfinder()->m_classifyFenceZeroInit = false;
2557+
#endif
25502558
}
25512559

25522560
m_objectsToDestroy.clear();//list full of bad pointers now, clear it. If anyone's deletion resulted

0 commit comments

Comments
 (0)