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): an ai sharing all income leaves its allies' piles alone

Olcay Seyganb732a1d3b5d3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75d06768c..4f3d06054 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -81,6 +81,7 @@ found and fixed — EA's own, not port damage.**
- It now goes and takes the money that is lying around, out of spare cash so the army never pays for it.
- On Hard the expansion comes with a defence structure facing the enemy, placed in the same job. An undefended expansion is a gift.
- Measured: a third more army in the field and a quarter more money spent over the match.
+- With Share Income set to All Income it leaves its allies' piles alone. Every payment is already split across the team, so a computer that put a supply centre beside its ally's pile added nothing and emptied that pile twice as fast. It now expands only to piles nobody on its side is working. Over eight 2v2 matches on Twilight Flame, loads taken from an ally's pile went from 396 to 54 and the team's income stayed where it was. Replays recorded before this change play out differently.
## The computer spends its money
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
index f7bbb835d..d7aa09c53 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
@@ -3282,7 +3282,7 @@ Object *AIPlayer::findSupplyCenter(Int minimumCash)
PartitionFilter *mine[] = { &f1, &f2, &filterMapStatus, 0 };
PartitionFilter *ours[] = { &f1, &f2Ally, &filterMapStatus, 0 };
- PartitionFilter **filters = (m_role == AIROLE_SUPPORTIVE) ? ours : mine;
+ PartitionFilter **filters = (m_role == AIROLE_SUPPORTIVE || TheGameLogic->getIncomeSharing() == INCOME_SHARING_ALL) ? ours : mine;
Object *supplyCenter = ThePartitionManager->getClosestObject(&center, radius, FROM_BOUNDINGSPHERE_2D, filters);
if (supplyCenter) {