Skip to content

Commit 1c8e473

Browse files
committed
add extra ifs
1 parent d689e9e commit 1c8e473

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,11 @@ void AIGroup::computeIndividualDestination( Coord3D *dest, const Coord3D *groupD
543543
dest->y = groupDest->y + v.y;
544544
dest->z = TheTerrainLogic->getLayerHeight( dest->x, dest->y, layer );
545545

546-
// Put waypoints on water surface instead of ground
547-
if (Real waterZ = 0; TheTerrainLogic->isUnderwater(dest->x, dest->y, &waterZ)) {
548-
if (waterZ > dest->z) dest->z = waterZ;
546+
if (TheGlobalData->m_heightAboveTerrainIncludesWater) {
547+
// Put waypoints on water surface instead of ground
548+
if (Real waterZ = 0; TheTerrainLogic->isUnderwater(dest->x, dest->y, &waterZ)) {
549+
if (waterZ > dest->z) dest->z = waterZ;
550+
}
549551
}
550552

551553
AIUpdateInterface *ai = obj->getAIUpdateInterface();

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8895,9 +8895,11 @@ void Pathfinder::adjustCoordToCell(Int cellX, Int cellY, Bool centerInCell, Coor
88958895
}
88968896
pos.z = TheTerrainLogic->getLayerHeight( pos.x, pos.y, layer );
88978897

8898-
//Adjust to water surface
8899-
if (Real waterZ = 0; TheTerrainLogic->isUnderwater(pos.x, pos.y, &waterZ)) {
8900-
if (waterZ > pos.z) pos.z = waterZ;
8898+
if (TheGlobalData->m_heightAboveTerrainIncludesWater) {
8899+
//Adjust to water surface
8900+
if (Real waterZ = 0; TheTerrainLogic->isUnderwater(pos.x, pos.y, &waterZ)) {
8901+
if (waterZ > pos.z) pos.z = waterZ;
8902+
}
89018903
}
89028904
}
89038905

0 commit comments

Comments
 (0)