From 8ff9125b3724f71d11ff5f3ec91bd59c2413bc82 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Mon, 2 Sep 2013 15:33:55 +0000 Subject: [PATCH] Bugfix: soldiers killed on roof edges should now properly fall down and not be stuck in dying state anymore Enhancement: enemy troops should no longer attack empty player vehicles git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6346 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Control.cpp | 6 +++++- TacticalAI/Attacks.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 337ebbbd..5017ae37 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -18466,7 +18466,11 @@ void HandleSystemNewAISituation( SOLDIERTYPE *pSoldier, BOOLEAN fResetABC ) if ( pSoldier->aiData.bNewSituation == IS_NEW_SITUATION ) { // Cancel what they were doing.... - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + // silversurfer: bugfix for endless dying mercs on roof edges + // if we delete their pending animation here they will just turn into the proper direction for the fall (in TurnSoldier( void ) ) + // and stand there forever afterwards in "dying" state, so let this guy fall off the roof first! + if ( !pSoldier->usPendingAnimation == FALLOFF && !pSoldier->usPendingAnimation == FALLFORWARD_ROOF ) + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; pSoldier->flags.bTurningFromPronePosition = FALSE; pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index f9d9c93c..c6aa16d8 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -22,6 +22,7 @@ #include "lighting.h" #include "Sound Control.h" #include "message.h" +#include "Vehicles.h" #endif extern INT16 DirIncrementer[8]; @@ -206,6 +207,9 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns continue; // next opponent } + // silversurfer: ignore empty vehicles + if ( pOpponent->ubWhatKindOfMercAmI == MERC_TYPE__VEHICLE && GetNumberInVehicle( pOpponent->bVehicleID ) == 0 ) + continue; // Special stuff for Carmen the bounty hunter if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != SLAY) @@ -791,6 +795,10 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) continue; // next soldier } + // silversurfer: ignore empty vehicles + if ( pOpponent->ubWhatKindOfMercAmI == MERC_TYPE__VEHICLE && GetNumberInVehicle( pOpponent->bVehicleID ) == 0 ) + continue; + // Special stuff for Carmen the bounty hunter if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != SLAY) { @@ -1364,6 +1372,10 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt if (pSoldier->pathing.bLevel != pOpponent->pathing.bLevel) continue; // next merc + // silversurfer: ignore empty vehicles + if ( pOpponent->ubWhatKindOfMercAmI == MERC_TYPE__VEHICLE && GetNumberInVehicle( pOpponent->bVehicleID ) == 0 ) + continue; + // Special stuff for Carmen the bounty hunter if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != SLAY) continue; // next opponent