- Fix: VS2010 debug build issue with reading in StructureConstruct.xml

- replaced a few hardcoded values with enums
- use TANK(...) macro instead of checking for bodytype by hand

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7959 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-08-05 19:01:11 +00:00
parent 90486b015b
commit 7dbff83e24
17 changed files with 163 additions and 162 deletions
+2 -2
View File
@@ -1423,7 +1423,7 @@ BOOLEAN AllMercsLookForDoor( INT32 sGridNo, BOOLEAN fUpdateValue )
}
// Now try other adjacent gridnos...
for ( cnt2 = 0; cnt2 < 8; cnt2++ )
for ( cnt2 = 0; cnt2 < NUM_WORLD_DIRECTIONS; ++cnt2 )
{
usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) );
// and we can trace a line of sight to his x,y coordinates?
@@ -1482,7 +1482,7 @@ BOOLEAN MercLooksForDoors( SOLDIERTYPE *pSoldier, BOOLEAN fUpdateValue )
}
// Now try other adjacent gridnos...
for ( cnt2 = 0; cnt2 < 8; cnt2++ )
for ( cnt2 = 0; cnt2 < NUM_WORLD_DIRECTIONS; ++cnt2 )
{
usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) );
// and we can trace a line of sight to his x,y coordinates?
+1 -2
View File
@@ -2638,8 +2638,7 @@ INT16 MinPtsToMove(SOLDIERTYPE *pSoldier)
}
// WANNE - BMP: FIX: Valid directions are only from 0-7!!
//for (cnt=0; cnt <= 8; cnt++)
for (cnt=0; cnt < 8; ++cnt)
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt )
{
sGridNo = NewGridNo(pSoldier->sGridNo,DirectionInc(cnt));
if (sGridNo != pSoldier->sGridNo)
+1 -1
View File
@@ -1759,7 +1759,7 @@ INT32 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8
}
else
{
for( cnt3 = 0; cnt3 < 8; cnt3++ )
for ( cnt3 = 0; cnt3 < NUM_WORLD_DIRECTIONS; ++cnt3 )
{
if ( OkayToAddStructureToWorld( sGridNo, pDef->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), INVALID_STRUCTURE_ID ) )
{
+22 -23
View File
@@ -379,7 +379,7 @@ INT32 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAni
}
// Check each struct in each direction
for( cnt3 = 0; cnt3 < 8; cnt3++ )
for ( cnt3 = 0; cnt3 < NUM_WORLD_DIRECTIONS; ++cnt3 )
{
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
{
@@ -501,7 +501,7 @@ INT32 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYPE
{
leftmost = ( ( sSweetGridNo + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS;
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
for( cnt2 = sLeft; cnt2 <= sRight; ++cnt2 )
{
sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2;
if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS )
@@ -545,34 +545,34 @@ INT32 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYPE
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ bGivenDirection ]]), usOKToAddStructID ) )
{
fDirectionFound = TRUE;
cnt3 = bGivenDirection;
cnt3 = bGivenDirection;
}
else
{
// Check each struct in each direction
for( cnt3 = 0; cnt3 < 8; cnt3++ )
else
{
if ( cnt3 != bGivenDirection )
{
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
{
fDirectionFound = TRUE;
break;
}
}
// Check each struct in each direction
for( cnt3 = 0; cnt3 <NUM_WORLD_DIRECTIONS; ++cnt3 )
{
if ( cnt3 != bGivenDirection )
{
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
{
fDirectionFound = TRUE;
break;
}
}
}
}
}
if ( fDirectionFound )
{
if ( fClosestToMerc )
{
uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 );
uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 );
if (uiRange == 0 )
{
uiRange = 999;
}
if (uiRange == 0 )
{
uiRange = 999;
}
}
else
{
@@ -702,14 +702,13 @@ INT32 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, U
pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, usAnimState );
// Check each struct in each direction
for( cnt3 = 0; cnt3 < 8; cnt3++ )
for ( cnt3 = 0; cnt3 < NUM_WORLD_DIRECTIONS; ++cnt3 )
{
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
{
fDirectionFound = TRUE;
break;
}
}
}
else
+13 -14
View File
@@ -5119,7 +5119,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight )
return(TANK_SHOOT);
}
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
if ( TANK(pSoldier) )
{
return(TANK_BURST);
}
@@ -5471,7 +5471,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL
return(INVALID_ANIMATION);
}
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
if ( TANK(pSoldier) )
{
return(INVALID_ANIMATION);
}
@@ -8023,8 +8023,7 @@ void SOLDIERTYPE::TurnSoldier( void )
if ( ((gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) &&
this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_OFF) ||
this->ubBodyType == ROBOTNOWEAPON ||
this->ubBodyType == TANK_NW ||
this->ubBodyType == TANK_NE )
TANK(this) )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "TurnSoldier: EVENT_InitNewSoldierAnim" ) );
this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, gAnimControl[this->usAnimState].ubEndHeight ), 0, FALSE );
@@ -8104,7 +8103,7 @@ void SOLDIERTYPE::TurnSoldier( void )
// Don't do anything if we are at dest direction!
if ( this->ubDirection == this->pathing.bDesiredDirection )
{
if ( this->ubBodyType == TANK_NW || this->ubBodyType == TANK_NE )
if ( TANK(this) )
{
if ( this->iTuringSoundID != NO_SAMPLE )
{
@@ -8241,7 +8240,7 @@ void SOLDIERTYPE::TurnSoldier( void )
this->ubHiResDirection = (UINT8)sDirection;
// Are we at a multiple of a 'cardnal' direction?
for ( cnt = 0; cnt < 8; cnt++ )
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt )
{
if ( sDirection == ubExtDirection[cnt] )
{
@@ -8253,7 +8252,7 @@ void SOLDIERTYPE::TurnSoldier( void )
}
}
if ( this->ubBodyType == TANK_NW || this->ubBodyType == TANK_NE )
if ( TANK(this) )
{
if ( this->iTuringSoundID == NO_SAMPLE )
{
@@ -9816,19 +9815,19 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr
{
//sLifeDeduct = (sLifeDeduct * 2) / 3;
}
else
{
if ( ubReason == TAKE_DAMAGE_GUNFIRE )
else
{
if ( ubReason == TAKE_DAMAGE_GUNFIRE )
{
sLifeDeduct /= 3;
}
else if ( ubReason == TAKE_DAMAGE_EXPLOSION && sLifeDeduct > 50 )
{
// boom!
sLifeDeduct *= 2;
// boom!
sLifeDeduct *= 2;
}
}
}
VehicleTakeDamage( this->bVehicleID, ubReason, sLifeDeduct, this->sGridNo, ubAttacker );
HandleTakeDamageDeath( this, bOldLife, ubReason );
return(0);
+5
View File
@@ -117,6 +117,11 @@ structureconstructEndElementHandle(void *userData, const XML_Char *name)
staticsouthtilevector.clear();
staticeasttilevector.clear();
staticwesttilevector.clear();
staticnorthtilevector.resize(1);
staticsouthtilevector.resize(1);
staticeasttilevector.resize(1);
staticwesttilevector.resize(1);
}
++structureconstructcnt;