Driveable vehicle update (by anv)

- Vehicles can now exit sector in tactical screen.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7216 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-05-19 18:49:20 +00:00
parent 0fd5f010b8
commit 6f253e7e49
3 changed files with 40 additions and 7 deletions
+9 -3
View File
@@ -4557,9 +4557,15 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL
SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier )
{
INT32 cnt, cnt2;
// anv: soldier's "assignment" can be a vehicle, not a proper squad, causing out-of-range in second loop
INT8 bMaxSquad = pSoldier->bAssignment;
if( bMaxSquad >= NUMBER_OF_SQUADS )
{
bMaxSquad = NUMBER_OF_SQUADS - 1;
}
for( cnt = pSoldier->bAssignment + 1 ; cnt < NUMBER_OF_SQUADS; cnt++ )
for( cnt = bMaxSquad + 1 ; cnt < NUMBER_OF_SQUADS; cnt++ )
{
for( cnt2 =0; cnt2 < NUMBER_OF_SOLDIERS_PER_SQUAD; cnt2++ )
{
@@ -4572,7 +4578,7 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier )
// none found,
// Now loop back
for( cnt = 0; cnt <= pSoldier->bAssignment; cnt++ )
for( cnt = 0; cnt <= bMaxSquad; cnt++ )
{
for( cnt2 =0; cnt2 < NUMBER_OF_SOLDIERS_PER_SQUAD; cnt2++ )
{