diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index bce858a39..623d5e30e 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6765,10 +6765,11 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // Kill those not already dead.,... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == ENEMY_TEAM ) { - // For sure for flag thet they are dead is not set + // Only pows that are not dead yet if ( ( pTeamSoldier->bSoldierFlagMask & SOLDIER_POW ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { - if ( pTeamSoldier->stats.bLife > OKLIFE && pTeamSoldier->stats.bLife != 0 ) + // if we arrive here and the guy has lifepoints < OKLIFE, something is very odd... better take him prisoner and remove him anyway + //if ( pTeamSoldier->stats.bLife > OKLIFE && pTeamSoldier->stats.bLife != 0 ) { switch ( pTeamSoldier->ubSoldierClass ) { @@ -10109,6 +10110,9 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) if( pSoldier->stats.bLife >= OKLIFE ) { pSoldier->bSoldierFlagMask |= SOLDIER_POW; + + // Remove as target + RemoveManAsTarget( pSoldier ); } } } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index fbd3d1358..aab29bdd4 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -16326,6 +16326,9 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection // arrest this guy pSoldier->bSoldierFlagMask |= SOLDIER_POW; + // Remove as target + RemoveManAsTarget( pSoldier ); + // move the items in his hands to the floor and move our handcuff into his hands if ( pSoldier->inv[ HANDPOS ].exists() == true && !( pSoldier->inv[ HANDPOS ].fFlags & OBJECT_UNDROPPABLE )) { @@ -16381,6 +16384,9 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection StatChange( this, EXPERAMT, 2, TRUE ); DeductPoints( this, GetAPsToHandcuff( this, sGridNo ), 0, AFTERACTION_INTERRUPT ); + + // this might have been the last guy... + CheckForEndOfBattle( FALSE ); } else { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 633c8409f..0a9b39d0b 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -414,9 +414,6 @@ extern CLOTHES_STRUCT Clothes[CLOTHES_MAX]; // but they can't attack empty vehicles!! #define CONSIDERED_NEUTRAL( me, them ) ( (them->aiData.bNeutral || them->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER|SOLDIER_POW)) && ( me->bTeam != CREATURE_TEAM || (them->flags.uiStatusFlags & SOLDIER_VEHICLE) ) ) -// Flugente: this version still counts POWs as enemies. This allows correct refreshing of the enemy count whn taking prisoners and then moving away -#define CONSIDERED_NEUTRAL_NOT_POW( me, them ) ( (them->aiData.bNeutral || them->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER)) && ( me->bTeam != CREATURE_TEAM || (them->flags.uiStatusFlags & SOLDIER_VEHICLE) ) ) - typedef struct { UINT8 ubKeyID; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index cf18d42ca..21d753e7c 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1773,7 +1773,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT { // if neither side is neutral AND // if this soldier is an opponent (fights for different side) - if (pSoldier->bActive && pOpponent->bActive && !CONSIDERED_NEUTRAL_NOT_POW( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL_NOT_POW( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) && pSoldier->RecognizeAsCombatant(pOpponent->ubID) ) + if (pSoldier->bActive && pOpponent->bActive && !CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) && pSoldier->RecognizeAsCombatant(pOpponent->ubID) ) { RemoveOneOpponent(pSoldier); } diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index b55d0a669..289f7e195 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -5351,15 +5351,15 @@ INT16 ubMinAPCost; // if yes, and we are facing it, jump // if no, go on, nothing to see here // determine direction of our target - INT8 targetdirection = GetDirectionToGridNoFromGridNo(pSoldier->sGridNo, sClosestOpponent); + UINT8 targetdirection = GetDirectionToGridNoFromGridNo(pSoldier->sGridNo, sClosestOpponent); // determine if there is a jumpable window here, in the direction of our target // store old direction for this check - INT tmpdirection = pSoldier->ubDirection; + UINT8 tmpdirection = pSoldier->ubDirection; pSoldier->ubDirection = targetdirection; INT8 windowdirection = DIRECTION_IRRELEVANT; - if ( FindWindowJumpDirection(pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &windowdirection) && targetdirection == windowdirection ) + if ( FindWindowJumpDirection(pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &windowdirection) && targetdirection == (UINT8)windowdirection ) { pSoldier->ubDirection = tmpdirection; @@ -5389,31 +5389,28 @@ INT16 ubMinAPCost; // The situation mentioned above happens... else if ( (targetbLevel != pSoldier->pathing.bLevel) && SameBuilding( pSoldier->sGridNo, targetGridNo ) ) { - if ( 1 )//gGameExternalOptions.fZombieCanClimb ) + if (!TileIsOutOfBounds(targetGridNo) ) { - if (!TileIsOutOfBounds(targetGridNo) ) + // need to climb AND have enough APs to get there this turn + BOOLEAN fUp = TRUE; + if (pSoldier->pathing.bLevel > 0 ) + fUp = FALSE; + + if ( pSoldier->bActionPoints > GetAPsToClimbRoof ( pSoldier, fUp ) ) { - // need to climb AND have enough APs to get there this turn - BOOLEAN fUp = TRUE; - if (pSoldier->pathing.bLevel > 0 ) - fUp = FALSE; + pSoldier->aiData.usActionData = targetGridNo;//FindClosestClimbPoint(pSoldier, fUp ); - if ( pSoldier->bActionPoints > GetAPsToClimbRoof ( pSoldier, fUp ) ) - { - pSoldier->aiData.usActionData = targetGridNo;//FindClosestClimbPoint(pSoldier, fUp ); - - // Necessary test: can we climb up at this position? It might happen that our target is directly above us, then we'll have to move - INT8 newdirection; - if ( ( fUp && FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &newdirection ) ) || ( !fUp && FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &newdirection ) ) ) - { - return( AI_ACTION_CLIMB_ROOF ); - } - else - { - return(AI_ACTION_SEEK_OPPONENT); - } + // Necessary test: can we climb up at this position? It might happen that our target is directly above us, then we'll have to move + INT8 newdirection; + if ( ( fUp && FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &newdirection ) ) || ( !fUp && FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &newdirection ) ) ) + { + return( AI_ACTION_CLIMB_ROOF ); } - } + else + { + return(AI_ACTION_SEEK_OPPONENT); + } + } } }