From 50621617767851fe86d57c67f179b963d92ce5fd Mon Sep 17 00:00:00 2001 From: Cody Brittain <1779662+Generalcamo@users.noreply.github.com> Date: Thu, 6 Mar 2025 01:47:44 -0500 Subject: [PATCH 1/2] Fix Nationalism and Fanaticism (Patriotism) bonuses being applied regardless of horde status. --- .../GameLogic/Object/Update/AIUpdate.cpp | 22 ++++++---- .../GameLogic/Object/Update/AIUpdate.cpp | 44 ++++++++++--------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index dcf4d6911e..b8c8651150 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -4466,20 +4466,24 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) //if ( draw && !us->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) // draw->setTerrainDecal(TERRAIN_DECAL_NONE); + // TheSuperHackers @bugfix @GeneralCamo 06/03/2025 Corrected nationalism being applied regardless of horde status - issue #173 // horde - if( horde ) - { + if ( horde ) { us->setWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); - } // end if - else + // nationalism + if (nationalism) { + us->setWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); + } + else { + us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); + } + } + else { us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); - - // nationalism - if( nationalism ) - us->setWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); - else us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); + } + // end @bugfix } // end if #ifdef ALLOW_DEMORALIZE diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index b1d318aa25..9f3c96a260 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -4735,27 +4735,31 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) //if ( draw && !us->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) // draw->setTerrainDecal(TERRAIN_DECAL_NONE); + // TheSuperHackers @bugfix @GeneralCamo 06/03/2025 Corrected nationalism being applied regardless of horde status - issue #173 // horde - if( horde ) - { - us->setWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); - - } // end if - else - us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); - - // nationalism - if( nationalism ) - { - us->setWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); - // fanaticism - if ( fanaticism ) - us->setWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM );// FOR THE NEW GC INFANTRY GENERAL - else - us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ); - } - else - us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); + if (horde) { + us->setWeaponBonusCondition(WEAPONBONUSCONDITION_HORDE); + + // nationalism + if (nationalism) { + us->setWeaponBonusCondition(WEAPONBONUSCONDITION_NATIONALISM); + } else { + us->clearWeaponBonusCondition(WEAPONBONUSCONDITION_NATIONALISM); + } + + // fanaticism + if (fanaticism) { + us->setWeaponBonusCondition(WEAPONBONUSCONDITION_FANATICISM);// FOR THE NEW GC INFANTRY GENERAL + } else { + us->clearWeaponBonusCondition(WEAPONBONUSCONDITION_FANATICISM); + } + + } else { + us->clearWeaponBonusCondition(WEAPONBONUSCONDITION_HORDE); + us->clearWeaponBonusCondition(WEAPONBONUSCONDITION_NATIONALISM); + us->clearWeaponBonusCondition(WEAPONBONUSCONDITION_FANATICISM); + } + // end @bugfix From 77f1f81e89d2e534dea9598c2842ae8049de2a06 Mon Sep 17 00:00:00 2001 From: Cody Brittain <1779662+Generalcamo@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:47:15 -0500 Subject: [PATCH 2/2] Apply suggestions from code review --- .../Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index b8c8651150..68b9773c44 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -4466,7 +4466,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) //if ( draw && !us->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) // draw->setTerrainDecal(TERRAIN_DECAL_NONE); - // TheSuperHackers @bugfix @GeneralCamo 06/03/2025 Corrected nationalism being applied regardless of horde status - issue #173 + // TheSuperHackers @bugfix GeneralCamo 06/03/2025 Corrected nationalism being applied regardless of horde status - issue #173 // horde if ( horde ) { us->setWeaponBonusCondition( WEAPONBONUSCONDITION_HORDE ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 9f3c96a260..e574a8d25f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -4735,7 +4735,7 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) //if ( draw && !us->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) // draw->setTerrainDecal(TERRAIN_DECAL_NONE); - // TheSuperHackers @bugfix @GeneralCamo 06/03/2025 Corrected nationalism being applied regardless of horde status - issue #173 + // TheSuperHackers @bugfix GeneralCamo 06/03/2025 Corrected nationalism being applied regardless of horde status - issue #173 // horde if (horde) { us->setWeaponBonusCondition(WEAPONBONUSCONDITION_HORDE);