From a6a2307c5660ab84c2b9a1296c5b87e7a271d905 Mon Sep 17 00:00:00 2001 From: Lesh Date: Wed, 17 Jan 2007 15:26:01 +0000 Subject: [PATCH] - fix: militia, came as reinforcements, tend to stop at a halfway, if main battle is at the opposite side of map, they are coming from. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@662 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Init List.cpp | 57 +++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index b5e4eb69..52855e06 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -2377,12 +2377,22 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu if ( !pSoldier ) return; - pSoldier->bOrders = ONGUARD; pSoldier->ubInsertionDirection = bDesiredDirection; - pSoldier->bAlertStatus = STATUS_YELLOW; - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + // Lesh: militia came from another sector can't reach opposite side of map in case of battle there + // they are often stop at a half way. trying to fix this + if ( gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) + { + pSoldier->bOrders = SEEKENEMY; + pSoldier->bAlertStatus = STATUS_RED; + } + else + { + pSoldier->bOrders = ONGUARD; + pSoldier->bAlertStatus = STATUS_YELLOW; + pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + } //Setup the position if( ubCurrSlot < MapEdgepointInfo.ubNumPoints ) @@ -2407,13 +2417,23 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu if ( !pSoldier ) return; - pSoldier->bOrders = ONGUARD; pSoldier->ubInsertionDirection = bDesiredDirection; - pSoldier->bAlertStatus = STATUS_YELLOW; - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; - + // Lesh: militia came from another sector can't reach opposite side of map in case of battle there + // they are often stop at a half way. trying to fix this + if ( gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) + { + pSoldier->bOrders = SEEKENEMY; + pSoldier->bAlertStatus = STATUS_RED; + } + else + { + pSoldier->bOrders = ONGUARD; + pSoldier->bAlertStatus = STATUS_YELLOW; + pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + } + //Setup the position if( ubCurrSlot < MapEdgepointInfo.ubNumPoints ) { //using an edgepoint @@ -2437,13 +2457,22 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu if ( !pSoldier ) return; - pSoldier->bOrders = ONGUARD; pSoldier->ubInsertionDirection = bDesiredDirection; - pSoldier->bAlertStatus = STATUS_YELLOW; - pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); - pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; - + // Lesh: militia came from another sector can't reach opposite side of map in case of battle there + // they are often stop at a half way. trying to fix this + if ( gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) + { + pSoldier->bOrders = SEEKENEMY; + pSoldier->bAlertStatus = STATUS_RED; + } + else + { + pSoldier->bOrders = ONGUARD; + pSoldier->bAlertStatus = STATUS_YELLOW; + pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS); + pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION; + } // if ( GetTimeOfDayAmbientLightLevel() < NORMAL_LIGHTLEVEL_DAY + 2 ) // gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition = TRUE;