From 5385ae129544b802cafd2c33d1757a9a2836b99d Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 17 Aug 2015 20:00:19 +0000 Subject: [PATCH] - Fix: cleaning weapons prompt read parameters wrong - when a merc regains HP via surgery, display the gain - if an EPC leaves the team, add them to the list of departed characters git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7977 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/personnel.cpp | 25 +++++-------------------- Tactical/Handle Items.cpp | 6 +++--- Tactical/Soldier Control.cpp | 17 +++++++++++++++++ Tactical/Soldier Profile.cpp | 5 ++++- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 3d130a07e..db1866df6 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -5437,14 +5437,11 @@ BOOLEAN DisplayHighLightBox( void ) // add to dead list void AddCharacterToDeadList( SOLDIERTYPE *pSoldier ) { - INT32 iCounter = 0; - - - for( iCounter = 0; iCounter < 256; iCounter++ ) + for ( INT32 iCounter = 0; iCounter < 256; ++iCounter ) { if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == -1 ) { - // valid slot, merc not found yet, inset here + // valid slot, merc not found yet, insert here LaptopSaveInfo.ubDeadCharactersList[ iCounter ] = pSoldier->ubProfile; // leave @@ -5454,7 +5451,6 @@ void AddCharacterToDeadList( SOLDIERTYPE *pSoldier ) // are they already in the list? if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == pSoldier->ubProfile ) { - return; } } @@ -5463,10 +5459,7 @@ void AddCharacterToDeadList( SOLDIERTYPE *pSoldier ) void AddCharacterToFiredList( SOLDIERTYPE *pSoldier ) { - INT32 iCounter = 0; - - - for( iCounter = 0; iCounter < 256; iCounter++ ) + for ( INT32 iCounter = 0; iCounter < 256; ++iCounter ) { if( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] == -1 ) { @@ -5480,19 +5473,14 @@ void AddCharacterToFiredList( SOLDIERTYPE *pSoldier ) // are they already in the list? if( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] == pSoldier->ubProfile ) { - return; } } } - void AddCharacterToOtherList( SOLDIERTYPE *pSoldier ) { - INT32 iCounter = 0; - - - for( iCounter = 0; iCounter < 256; iCounter++ ) + for ( INT32 iCounter = 0; iCounter < 256; ++iCounter ) { if( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] == -1 ) { @@ -5506,7 +5494,6 @@ void AddCharacterToOtherList( SOLDIERTYPE *pSoldier ) // are they already in the list? if( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] == pSoldier->ubProfile ) { - return; } } @@ -5518,9 +5505,7 @@ void AddCharacterToOtherList( SOLDIERTYPE *pSoldier ) //to be on your team list, and departed list ) BOOLEAN RemoveNewlyHiredMercFromPersonnelDepartedList( UINT8 ubProfile ) { - INT32 iCounter = 0; - - for( iCounter = 0; iCounter < 256; iCounter++ ) + for ( INT32 iCounter = 0; iCounter < 256; ++iCounter ) { // are they already in the Dead list? if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == ubProfile ) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 4a5b1514e..36d44e500 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4975,7 +4975,7 @@ void CleanWeapons( BOOLEAN fEntireTeam ) return; // if in combat, always only for selected merc - if ( !fEntireTeam || (gTacticalStatus.uiFlags & INCOMBAT) ) + if ( !fEntireTeam ) { if ( gusSelectedSoldier == NOBODY ) return; @@ -4987,7 +4987,7 @@ void CleanWeapons( BOOLEAN fEntireTeam ) } else // perform action for every merc in this sector { - UINT8 bMercID, bLastTeamID; + UINT16 bMercID, bLastTeamID; SOLDIERTYPE* pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -5326,7 +5326,7 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue ) break; case 3: // clean weapons - in realtime of the entire team, in turnbased only for the selected merc - CleanWeapons( gTacticalStatus.uiFlags & INCOMBAT ); + CleanWeapons( !(gTacticalStatus.uiFlags & INCOMBAT) ); break; case 4: UpdateGear(); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 1c6e7acaf..72a52c7d8 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -13031,13 +13031,22 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 pVictim->bBleeding = 0; uiMedcost += max( 0, (((usLifeReturned / 100) - pVictim->bBleeding) / 2) ); // add medkit points cost for unbandaged part } + + // display healing done + pVictim->flags.fDisplayDamage = TRUE; + pVictim->sDamage -= (usLifeReturned / 100); } else // this shouldn't even happen, but we still want to have it here for sure { + // display healing done + pVictim->flags.fDisplayDamage = TRUE; + pVictim->sDamage -= (pVictim->stats.bLifeMax - pVictim->stats.bLife); + pVictim->stats.bLife = pVictim->stats.bLifeMax; pVictim->iHealableInjury = 0; pVictim->bBleeding = 0; } + // Reduce max breath based on life returned if ( (pVictim->bBreathMax - (((usLifeReturned / 100) * gSkillTraitValues.usDOSurgeryMaxBreathLoss) / 100)) <= BREATHMAX_ABSOLUTE_MINIMUM ) { @@ -22540,9 +22549,17 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB pVictim->bBleeding = 0; uiMedcost += max( 0, (((iLifeReturned / 100) - pVictim->bBleeding) / 2) ); // add medkit points cost for unbandaged part } + + // display healing done + pVictim->flags.fDisplayDamage = TRUE; + pVictim->sDamage -= (iLifeReturned / 100); } else // this shouldn't even happen, but we still want to have it here for sure { + // display healing done + pVictim->flags.fDisplayDamage = TRUE; + pVictim->sDamage -= (pVictim->stats.bLifeMax - pVictim->stats.bLife); + pVictim->stats.bLife = pVictim->stats.bLifeMax; pVictim->iHealableInjury = 0; pVictim->bBleeding = 0; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 7fa9462d7..79e9196a2 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -2067,12 +2067,15 @@ BOOLEAN UnRecruitEPC( UINT8 ubCharNum ) if ( pSoldier->bAssignment < ON_DUTY ) { - ResetDeadSquadMemberList( pSoldier->bAssignment ); + ResetDeadSquadMemberList( pSoldier->bAssignment ); } // Rmeove from squad.... RemoveCharacterFromSquads( pSoldier ); + // Add to our 'departed' list + AddCharacterToOtherList( pSoldier ); + // O< check if this is the only guy in the sector.... if ( gusSelectedSoldier == pSoldier->ubID ) {