diff --git a/GameVersion.cpp b/GameVersion.cpp index 1ee00afb..d1439389 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -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 diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index a122d73f..7c9da07d 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -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;ibCamo > 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 ); } diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 6a55cbc3..0a9a8490 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -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 ) diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 28ee58b5..c68c8d4e 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -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 ); diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index f508312a..73c5f9fc 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -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) { diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index c451bfc6..ae94d5bc 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -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