From 54d202fc79446dbed68c406d97bff673ee210b75 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 5 Jul 2015 10:37:27 +0000 Subject: [PATCH] - Fix: mercs can consume items that shouldnt' be consumed git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7900 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Hourly Update.cpp | 3 ++- Tactical/Soldier Control.cpp | 40 +++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 3fc72554..64bf4635 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -21,6 +21,7 @@ #include "Tactical Save.h" // added by Flugente #include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions() #include "Drugs And Alcohol.h" // added by Flugente for HourlyDrugUpdate() + #include "Interface.h" // added by Flugente #endif #include "Luaglobal.h" @@ -514,7 +515,7 @@ void HourlyLarryUpdate() } } } -#include "Interface.h" + // Flugente: mercs that are smokers occasionally consume smokes if they have some in their inventory void HourlySmokerUpdate( ) { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 65fd7f34..38c2d2ec 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -22902,6 +22902,7 @@ BOOLEAN ApplyConsumable( SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce if ( !(Item[pObj->usItem].usItemClass & (IC_KIT | IC_MISC)) ) return FALSE; + BOOLEAN fSuccess = FALSE; BOOLEAN fDoSound = FALSE; // use portionsize, if none was entered, use full item @@ -22993,6 +22994,7 @@ BOOLEAN ApplyConsumable( SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce // this returns true if camo can be applied, but APs were only used, and the action happened, if *pfGoodAPs is TRUE if ( ApplyCamo( pSoldier, pObj->usItem, statusused ) ) { + fSuccess = TRUE; fDoSound = TRUE; // WANNE: We should only delete the face, if there was a camo we applied. @@ -23008,47 +23010,57 @@ BOOLEAN ApplyConsumable( SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce if ( ApplyCanteen( pSoldier, pObj->usItem, statusused ) ) { + fSuccess = TRUE; fDoSound = FALSE; } if ( ApplyElixir( pSoldier, pObj->usItem, statusused ) ) { + fSuccess = TRUE; fDoSound = TRUE; } if ( ApplyClothes( pSoldier, pObj->usItem, statusused ) ) { - + fSuccess = TRUE; } if ( ApplyFood( pSoldier, pObj, statusused ) ) { + fSuccess = TRUE; fDoSound = FALSE; } if ( ApplyDrugs_New( pSoldier, pObj->usItem, statusused ) ) { + fSuccess = TRUE; + // no sound on consuming cigarettes, as that is very annoying if ( !Item[pObj->usItem].cigarette ) { fDoSound = TRUE; } } - - // use up object - UseKitPoints( pObj, statusused, pSoldier ); - if ( fUseAPs ) + if ( fSuccess ) { - // Dirty - fInterfacePanelDirty = DIRTYLEVEL2; + // use up object + UseKitPoints( pObj, statusused, pSoldier ); + + if ( fUseAPs ) + { + // Dirty + fInterfacePanelDirty = DIRTYLEVEL2; + } + + if ( fDoSound ) + { + // Say OK acknowledge.... + pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); + } + + return TRUE; } - if ( fDoSound ) - { - // Say OK acknowledge.... - pSoldier->DoMercBattleSound( BATTLE_SOUND_COOL1 ); - } - - return TRUE; + return FALSE; }