From 5dbcf2a1e87cd65c36c9163796978068d043474b Mon Sep 17 00:00:00 2001 From: silversurfer Date: Sun, 19 Oct 2014 17:57:18 +0000 Subject: [PATCH] Fix: Militia tank fix could lead to graphical glitch with following crash. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7597 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Init List.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 9f9ae4ba..a38913b4 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -1501,8 +1501,18 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl curr->pBasicPlacement->bOrders = STATIONARY; curr->pBasicPlacement->bAttitude = (INT8) Random( MAXATTITUDES ); // silversurfer: Replace body type. Militia tanks are not allowed. - if( curr->pDetailedPlacement->bBodyType == TANK_NE || curr->pDetailedPlacement->bBodyType == TANK_NW - || curr->pBasicPlacement->bBodyType == TANK_NE || curr->pBasicPlacement->bBodyType == TANK_NW ) + if( curr->pBasicPlacement->fDetailedPlacement ) + { + if( curr->pDetailedPlacement->bBodyType == TANK_NE || curr->pDetailedPlacement->bBodyType == TANK_NW ) + { + curr->pBasicPlacement->bBodyType = PreRandom( REGFEMALE + 1 ); + // check for better spot next to the tank so the militia doesn't get stuck in the tank + INT32 iNewSpot = FindNearestPassableSpot( curr->pBasicPlacement->usStartingGridNo ); + if( iNewSpot != NOWHERE) + curr->pBasicPlacement->usStartingGridNo = iNewSpot; + } + } + else if( curr->pBasicPlacement->bBodyType == TANK_NE || curr->pBasicPlacement->bBodyType == TANK_NW ) { curr->pBasicPlacement->bBodyType = PreRandom( REGFEMALE + 1 ); // check for better spot next to the tank so the militia doesn't get stuck in the tank