Skip to content

Commit e280662

Browse files
committed
bugfix(module): Fix missing horde condition of Nationalism and Fanaticism weapon bonuses (#1582)
This fix is opt-in by setting Action=HORDE_FIXED in HordeUpdate behavior modules
1 parent 7af3a82 commit e280662

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
565565
Bool hasFanaticism() const;
566566
void evaluateMoraleBonus( Bool inHorde, Bool allowNationalism, HordeActionType type );
567567
void evaluateNationalismBonusClassic( Bool inHorde, Bool allowNationalism );
568+
void evaluateNationalismBonus( Bool inHorde, Bool allowNationalism );
568569

569570
#ifdef ALLOW_DEMORALIZE
570571
// demoralization ... what a nifty word to write.

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,38 @@ class UpgradeTemplate;
4141
//-------------------------------------------------------------------------------------------------
4242
//-------------------------------------------------------------------------------------------------
4343

44+
// TheSuperHackers @bugfix xezon 15/09/2025 Adds a new horde action to select a fixed implementation.
45+
//
46+
// TheSuperHackers @todo If we want more control over the horde setup, then we need to implement
47+
// filters for separate weapon bonuses and required upgrades. But adding more behavior modules will
48+
// be a performance concern. Example INI setup:
49+
//
50+
// Behavior = HordeUpdate ModuleTag
51+
// Action = NATIONALISM
52+
// ;ApplyWeaponBonus = NATIONALISM
53+
// UpgradeRequired = Upgrade_Nationalism
54+
// End
55+
//
4456
enum HordeActionType CPP_11(: Int)
4557
{
46-
HORDEACTION_HORDE = 0,
58+
HORDEACTION_HORDE, ///< Classic action, applies the Horde bonus correctly, but Nationalism and Fanaticism bonuses are not removed after leaving horde.
59+
HORDEACTION_HORDE_FIXED, ///< Applies the Horde, Nationalism and Fanaticism bonuses correctly.
4760

48-
HORDEACTION_COUNT
61+
HORDEACTION_COUNT,
62+
63+
#if RETAIL_COMPATIBLE_CRC
64+
HORDEACTION_DEFAULT = HORDEACTION_HORDE,
65+
#else
66+
HORDEACTION_DEFAULT = HORDEACTION_HORDE_FIXED, ///< Does not change unmodified retail game behavior, because all its horde update modules explicitly set Action = HORDE.
67+
#endif
4968
};
5069

5170
#ifdef DEFINE_HORDEACTION_NAMES
5271
static const char *const TheHordeActionTypeNames[] =
5372
{
5473
"HORDE",
74+
"HORDE_FIXED",
75+
5576
NULL
5677
};
5778
static_assert(ARRAY_SIZE(TheHordeActionTypeNames) == HORDEACTION_COUNT + 1, "Incorrect array size");

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4749,6 +4749,12 @@ void AIUpdateInterface::evaluateMoraleBonus( Bool inHorde, Bool allowNationalism
47494749
case HORDEACTION_HORDE:
47504750
evaluateNationalismBonusClassic(inHorde, allowNationalism);
47514751
break;
4752+
4753+
#if !RETAIL_COMPATIBLE_CRC
4754+
case HORDEACTION_HORDE_FIXED:
4755+
evaluateNationalismBonus(inHorde, allowNationalism);
4756+
break;
4757+
#endif
47524758
}
47534759
}
47544760

@@ -4788,6 +4794,37 @@ void AIUpdateInterface::evaluateNationalismBonusClassic( Bool inHorde, Bool allo
47884794
}
47894795
}
47904796

4797+
// ------------------------------------------------------------------------------------------------
4798+
// TheSuperHackers @bugfix The fixed Nationalism Bonus implementation.
4799+
// Nationalism and Fanaticism are now tied to the horde status.
4800+
// And Fanaticism is no longer dependent on Nationalism.
4801+
// ------------------------------------------------------------------------------------------------
4802+
void AIUpdateInterface::evaluateNationalismBonus( Bool inHorde, Bool allowNationalism )
4803+
{
4804+
Object *us = getObject();
4805+
4806+
if( inHorde )
4807+
{
4808+
us->setWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE );
4809+
4810+
if( allowNationalism && hasNationalism() )
4811+
{
4812+
us->setWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM );
4813+
}
4814+
4815+
if( allowNationalism && hasFanaticism() )
4816+
{
4817+
us->setWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM );
4818+
}
4819+
}
4820+
else
4821+
{
4822+
us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE );
4823+
us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM );
4824+
us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM );
4825+
}
4826+
}
4827+
47914828
#ifdef ALLOW_DEMORALIZE
47924829
// ------------------------------------------------------------------------------------------------
47934830
// ------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ HordeUpdateModuleData::HordeUpdateModuleData()
121121
, m_alliesOnly(true)
122122
, m_exactMatch(false)
123123
, m_allowedNationalism(TRUE)
124-
, m_action(HORDEACTION_HORDE)
124+
, m_action(HORDEACTION_DEFAULT)
125125
{
126126
}
127127

0 commit comments

Comments
 (0)