From f3d35c94016f767688b5672298ff3d3afff86cb9 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Wed, 17 Feb 2021 20:31:44 +0000 Subject: [PATCH] Strip clothes: drop item to soldier's level if no place in inventory. HandleTalkInit: - use SoldierToSoldierLineOfSightTest to check sight to person - increased talking range for militia to TACTICAL_RANGE When checking if radio set equipped for using with militia command feature, don't check for AP_RADIO as the game will deduct AP_TALK when giving order. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8942 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle UI.cpp | 10 +++------- Tactical/Militia Control.cpp | 9 ++------- Tactical/Soldier Control.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index ac546887..80552a52 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -6506,7 +6506,8 @@ BOOLEAN HandleTalkInit( ) if ( !(( pTSoldier->bTeam == MILITIA_TEAM ) && ( CheckIfRadioIsEquipped() )) ) //lal { // Check LOS! - if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, pTSoldier->sGridNo, pTSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + //if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, pTSoldier->sGridNo, pTSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if (!SoldierToSoldierLineOfSightTest(pSoldier, pTSoldier, TRUE, CALC_FROM_ALL_DIRS)) { if ( pTSoldier->ubProfile != NO_PROFILE ) { @@ -6620,14 +6621,9 @@ BOOLEAN HandleTalkInit( ) //lal if ( pTSoldier->bTeam == MILITIA_TEAM ) - { - commandRange = NPC_TALK_RADIUS*3; - } + commandRange = TACTICAL_RANGE; else - { commandRange = NPC_TALK_RADIUS; - } - if ( ( uiRange > commandRange ) && ( !CheckIfRadioIsEquipped() ) ) //lal { diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index cacb2ae6..b2ecd788 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -1110,21 +1110,16 @@ BOOLEAN CheckIfRadioIsEquipped( void ) SOLDIERTYPE *pSoldier = NULL; INT8 bSlot = NO_SLOT; - // do we have a radio ? - //pSoldier = GetSelectedAssignSoldier( FALSE ); //do not use - if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // Flugente: active radio sets also count as radio - if ( pSoldier->CanUseRadio() ) + if ( pSoldier->CanUseRadio(FALSE) ) return TRUE; - //bSlot = FindObj( pSoldier, EXTENDEDEAR ); bSlot = FindHearingAid(pSoldier); - //ScreenMsg( FONT_WHITE, MSG_INTERFACE, L"Position: %d", bSlot ); } - if (( bSlot == HEAD1POS ) || ( bSlot == HEAD2POS)) + if (bSlot == HEAD1POS || bSlot == HEAD2POS) { return TRUE; } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 726540c7..16425001 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -16570,7 +16570,7 @@ void SOLDIERTYPE::Strip() { CreateItem( vestitem, 100, &gTempObject ); if ( !AutoPlaceObject( this, &gTempObject, FALSE ) ) - AddItemToPool( this->sGridNo, &gTempObject, 1, 0, 0, -1 ); + AddItemToPool( this->sGridNo, &gTempObject, 1, this->pathing.bLevel, 0, -1 ); } else ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_NO_CLOTHES_ITEM] ); @@ -16583,7 +16583,7 @@ void SOLDIERTYPE::Strip() { CreateItem( pantsitem, 100, &gTempObject ); if ( !AutoPlaceObject( this, &gTempObject, FALSE ) ) - AddItemToPool( this->sGridNo, &gTempObject, 1, 0, 0, -1 ); + AddItemToPool(this->sGridNo, &gTempObject, 1, this->pathing.bLevel, 0, -1); } else ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_NO_CLOTHES_ITEM] ); @@ -18509,7 +18509,7 @@ BOOLEAN SOLDIERTYPE::CanUseRadio( BOOLEAN fCheckForAP ) if ( !NUM_SKILL_TRAITS( this, RADIO_OPERATOR_NT ) ) return FALSE; - // if we check wether we have enough AP, exit if we don't + // if we check whether we have enough AP, exit if we don't if ( fCheckForAP && !EnoughPoints( this, APBPConstants[AP_RADIO], 0, FALSE ) ) return FALSE; @@ -22706,7 +22706,7 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti } else { - // no gasmask is worn, and both faceslots are occupied - remove the item in slot 2 and put the gasmask there + // no gasmask is worn, and both face slots are occupied - remove the item in slot 2 and put the gasmask there AddItemToPool( pSoldier->sGridNo, &(pSoldier->inv[HEAD2POS]), 1, pSoldier->pathing.bLevel, 0, -1 ); success = PlaceObject( pSoldier, HEAD2POS, pObj );