- Fix: external iInitialMercArrivalLocation was overwritten by value from savegame

- Fix: gridno outside of map is used as valid map gridno

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8104 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-03-12 00:23:09 +00:00
parent 80bfe613e8
commit 73462c3610
6 changed files with 93 additions and 91 deletions
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8103 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8103 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8103 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8103 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8103 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8103 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8103 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.8094 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.8103 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 16.03.05" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 16.03.12" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+66 -68
View File
@@ -9017,13 +9017,11 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile )
// HEADROCK HAM 4: Load Manual Mobile Militia Restrictions
memcpy(gubManualRestrictMilitia, sGeneralInfo.ubManualRestrictMilitia, sizeof(UINT8) * 256);
for (int i=0;i<500;i++)
for (int i=0;i<500;++i)
{
zHiddenNames[i].Hidden = !sGeneralInfo.HiddenNames[i];
}
gGameExternalOptions.iInitialMercArrivalLocation = sGeneralInfo.sMercArrivalGridNo;
#ifdef JA2UB
gGameUBOptions.InitialHeliGridNo[ 0 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 0 ];//14947;
gGameUBOptions.InitialHeliGridNo[ 1 ] = sGeneralInfo.sINITIALHELIGRIDNO[ 1 ];//15584;//16067;
@@ -9055,9 +9053,8 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile )
gGameUBOptions.LaptopLinkBobby = sGeneralInfo.sLaptopLinkBobby;
#endif
if ( gGameExternalOptions.fShowCamouflageFaces == TRUE )
if ( gGameExternalOptions.fShowCamouflageFaces )
{
//Camo Face by Jazz
for (int i=0;i<NUM_PROFILES;++i)
{
@@ -9068,72 +9065,73 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile )
}
SOLDIERTYPE * pSoldier;
INT8 bMercID, bLastTeamID;
bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID;
UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID;
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
{
if ( pSoldier->bCamo > 0 )
{
if ( pSoldier->bCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->urbanCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->desertCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gDesertCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gDesertCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->snowCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gSnowCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gSnowCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
gCamoFace[pSoldier->ubProfile].gCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->snowCamo == 0 && pSoldier->bCamo == 0 && pSoldier->urbanCamo == 0 && pSoldier->desertCamo == 0)
{
gCamoFace[pSoldier->ubProfile].gCamoface = FALSE;
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = FALSE;
gCamoFace[pSoldier->ubProfile].gDesertCamoface = FALSE;
gCamoFace[pSoldier->ubProfile].gSnowCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->urbanCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->desertCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gDesertCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gDesertCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->snowCamo > 0 )
{
gCamoFace[pSoldier->ubProfile].gSnowCamoface = TRUE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
else
{
gCamoFace[pSoldier->ubProfile].gSnowCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
if ( pSoldier->snowCamo == 0 && pSoldier->bCamo == 0 && pSoldier->urbanCamo == 0 && pSoldier->desertCamo == 0)
{
gCamoFace[pSoldier->ubProfile].gCamoface = FALSE;
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = FALSE;
gCamoFace[pSoldier->ubProfile].gDesertCamoface = FALSE;
gCamoFace[pSoldier->ubProfile].gSnowCamoface = FALSE;
DeleteSoldierFace( pSoldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
}
}
}
return( TRUE );
}
+10 -7
View File
@@ -4820,7 +4820,7 @@ CHAR8 *GetSceneFilename( )
extern BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, INT16 sSoldierID );
// NB if making changes don't forget to update NewOKDestinationAndDirection
INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel )
BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel )
{
UINT8 bPerson;
STRUCTURE * pStructure;
@@ -4829,7 +4829,7 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeop
if ( !GridNoOnVisibleWorldTile( sGridNo ) )
{
return( TRUE );
return( FALSE );
}
if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY )
@@ -4870,7 +4870,7 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeop
if ( pStructureFileRef )
{
// if ANY direction is valid, consider moving here valid
for (bLoop = 0; bLoop < NUM_WORLD_DIRECTIONS; bLoop++)
for (bLoop = 0; bLoop < NUM_WORLD_DIRECTIONS; ++bLoop)
{
// ATE: Only if we have a levelnode...
if ( pCurrSoldier->pLevelNode != NULL && pCurrSoldier->pLevelNode->pStructureData != NULL )
@@ -4891,12 +4891,14 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeop
{
fOk = InternalOkayToAddStructureToWorld( sGridNo, bLevel, &(pStructureFileRef->pDBStructureRef[bLoop]), usStructureID, FALSE, pCurrSoldier->ubID );
}
if (fOk)
{
return( TRUE );
}
}
}
return( FALSE );
}
else
@@ -4953,6 +4955,7 @@ INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeop
}
}
}
return( TRUE );
}
@@ -5192,7 +5195,7 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect
static const UINT8 sDirs[4] = { NORTH, EAST, SOUTH, WEST };
//INT32 cnt;
//INT32 sClosest=NOWHERE, sSpot, sOkTest;
INT32 sClosest = MAX_MAP_POS, sSpot, sOkTest; //Lalien: changed to ensure compability with new definition of NOWHERE
INT32 sClosest = MAX_MAP_POS, sSpot; //Lalien: changed to ensure compability with new definition of NOWHERE
//INT32 sCloseGridNo=NOWHERE;
INT32 sCloseGridNo = MAX_MAP_POS; //Lalien: changed to ensure compability with new definition of NOWHERE
UINT32 uiMercFlags;
@@ -5286,7 +5289,7 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect
}
}
if ( ( sOkTest = NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) > 0) // no problem going there! nobody on it!
if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) // no problem going there! nobody on it!
{
// OK, if we are looking to goto a switch, ignore this....
if ( pDoor )
@@ -5468,7 +5471,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub
INT32 sFourGrids[4], sDistance=0;
static const UINT8 sDirs[4] = { NORTH, EAST, SOUTH, WEST };
//INT32 cnt;
INT32 sClosest=WORLD_MAX, sSpot, sSpot2, sOkTest;
INT32 sClosest=WORLD_MAX, sSpot, sSpot2;
INT32 sCloseGridNo=NOWHERE;
UINT32 uiMercFlags;
UINT16 usSoldierIndex;
@@ -5514,7 +5517,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub
}
}
if ( ( sOkTest = NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) > 0) // no problem going there! nobody on it!
if ( NewOKDestination( pSoldier, sGridNo, TRUE, pSoldier->pathing.bLevel ) ) // no problem going there! nobody on it!
{
// OK, if we are looking to goto a switch, ignore this....
if ( pDoor )
+1 -1
View File
@@ -209,7 +209,7 @@ BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex );
UINT32 CountNonVehiclesOnPlayerTeam( );
INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel );
BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel );
//Simple check to see if a (one-tiled) soldier can occupy a given location on the ground or roof.
extern BOOLEAN IsLocationSittable( INT32 iMapIndex, BOOLEAN fOnRoof );
+4 -3
View File
@@ -202,7 +202,8 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
// using only ints for maximum execution speed here
// CJC: Well, so much for THAT idea!
INT32 sCentralGridNo, sAdjSpot, sNorthGridNo, sSouthGridNo, sCheckSpot, sOKTest;
INT32 sCentralGridNo, sAdjSpot, sNorthGridNo, sSouthGridNo, sCheckSpot;
BOOLEAN sOKTest;
INT8 bThisCTGT, bBestCTGT = 0;
@@ -218,7 +219,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
// look into all 8 adjacent tiles & determine where the cover is the worst
// Lalien: shouldn't this start at 0 than?
for (UINT8 sDir = 0; sDir < NUM_WORLD_DIRECTIONS; sDir++)
for (UINT8 sDir = 0; sDir < NUM_WORLD_DIRECTIONS; ++sDir)
{
// get the gridno of the adjacent spot lying in that direction
sAdjSpot = NewGridNo( sCentralGridNo, DirectionInc( sDir ) );
@@ -227,7 +228,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
if (sAdjSpot != sCentralGridNo)
{
// if the adjacent spot can we walked on and isn't in water or gas
if ((NewOKDestination( pSoldier, sAdjSpot, IGNOREPEOPLE, bLevel ) > 0) && !InWaterOrGas( pSoldier, sAdjSpot ))
if ( NewOKDestination( pSoldier, sAdjSpot, IGNOREPEOPLE, bLevel ) && !InWaterOrGas( pSoldier, sAdjSpot ))
{
switch (sDir)
{
+3 -3
View File
@@ -289,7 +289,7 @@ INT8 PointPatrolAI(SOLDIERTYPE *pSoldier)
{
sPatrolPoint = NextPatrolPoint(pSoldier);
}
while (( !TileIsOutOfBounds(sPatrolPoint)) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) < 1));
while (( !TileIsOutOfBounds(sPatrolPoint)) && !NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) );
// if we're back where we started, then ALL other patrol points are junk!
if (pSoldier->sGridNo == sPatrolPoint)
@@ -373,7 +373,7 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier)
sPatrolPoint = pSoldier->aiData.sPatrolGrid[ bPatrolIndex];
bCnt++;
}
while ( (sPatrolPoint == pSoldier->sGridNo) || ( (!TileIsOutOfBounds(sPatrolPoint)) && (bCnt < pSoldier->aiData.bPatrolCnt) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel ) < 1)) );
while ( (sPatrolPoint == pSoldier->sGridNo) || ( (!TileIsOutOfBounds(sPatrolPoint)) && (bCnt < pSoldier->aiData.bPatrolCnt) && !NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel )) );
if (bCnt == pSoldier->aiData.bPatrolCnt)
{
@@ -383,7 +383,7 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier)
{
sPatrolPoint = NextPatrolPoint(pSoldier);
}
while ((!TileIsOutOfBounds(sPatrolPoint)) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) < 1));
while ((!TileIsOutOfBounds(sPatrolPoint)) && !NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) );
}
// do nothing this time around