From 07700a8d7efccfc38f9caef034274780223361f1 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Sat, 6 Aug 2022 12:44:56 +0000 Subject: [PATCH] MakeSureMedKitIsInHand: - for AI, just swap objects as they don't care about pockets - only show "nowhere to place item" message for player mercs (prevents medic AI from spamming messages) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9394 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Assignments.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index a10635dc..0e6398d6 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -10508,8 +10508,14 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) fCharacterInfoPanelDirty = TRUE; //shadooow: rules for item swapping rewritten to honor pocket restrictions + // sevenfm: for AI, just swap objects + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC)) + { + SwapObjs(pSoldier, HANDPOS, bPocket, TRUE); + return(TRUE); + } //nothing in main hand - if (!pSoldier->inv[HANDPOS].exists()) + else if (!pSoldier->inv[HANDPOS].exists()) { SwapObjs(pSoldier, HANDPOS, bPocket, TRUE);//todo: this should probably be more robust and handle potentional custom medical kit that uses both hands return(TRUE); @@ -10557,7 +10563,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) } } //if we came here it means we don't have medical kit or we cannot place it into hand due to no suitable pockets for whatever merc carries in them - if(medkit_found) + if (medkit_found && (pSoldier->flags.uiStatusFlags & SOLDIER_PC)) ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[QUICK_ITEMS_NOWHERE_TO_PLACE]); if(!bAllow1stAidKit) return FALSE;