Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): let the ai target what it sees only in part

Olcay Seyganc32855f1073b
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h
index 573e6cda1..54dc50d43 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h
@@ -1017,7 +1017,7 @@ protected:
//=====================================
/**
- * Accept if they are clear, not fogged or shrouded
+ * Accept if they are at least partly clear, not wholly fogged or shrouded
*/
class PartitionFilterFreeOfFog : public PartitionFilter
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
index b5d6ffee9..6543605a2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
@@ -5346,9 +5346,13 @@ Bool PartitionFilterRejectBuildings::allow( Object *other )
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+/** Partly in sight counts. Since hills and buildings block sight, a building hides its own back
+ cells from anyone lower than its roof and is never wholly clear, so taking only CLEAR here left
+ every unit the AI controls standing in front of an enemy base without firing a shot. */
Bool PartitionFilterFreeOfFog::allow( Object *other )
{
- return other->getShroudedStatus(m_comparisonIndex) == OBJECTSHROUD_CLEAR;
+ const ObjectShroudStatus status = other->getShroudedStatus(m_comparisonIndex);
+ return status == OBJECTSHROUD_CLEAR || status == OBJECTSHROUD_PARTIAL_CLEAR;
}
//-----------------------------------------------------------------------------