Changing MAX_NUMBER_PLAYER_MERCS midgame no longer renders savegames unloadable, as the teamsize is stored in the savegame anyway

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6294 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-08-19 23:27:50 +00:00
parent 4b0094902a
commit 74f52b3982
11 changed files with 29 additions and 17 deletions
+1 -1
View File
@@ -2457,7 +2457,7 @@ void BtnAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason)
// WDS DEBUG
if (LaptopSaveInfo.iCurrentBalance == 4500001) {
unsigned hired = 0;
while (hired < gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs) {
while (hired < OUR_TEAM_SIZE_NO_VEHICLE) {
if (AimMemberHireMerc()) {
// giIdOfLastHiredMerc = AimMercArray[gbCurrentIndex];
giIdOfLastHiredMerc = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
+2 -1
View File
@@ -26,6 +26,7 @@
#include "Game Clock.h"
// WDS - make number of mercenaries, etc. be configurable
#include "Squads.h"
#include "Overhead.h" // added by Flugente for OUR_TEAM_SIZE_NO_VEHICLE
#endif
#ifdef JA2UB
@@ -383,7 +384,7 @@ void ProcessPlayerInputActivationString( void )
BOOLEAN freeMercSlot = TRUE;
// WANNE: Check total number of hired mercs
if( NumberOfMercsOnPlayerTeam() >= gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs )
if( NumberOfMercsOnPlayerTeam() >= OUR_TEAM_SIZE_NO_VEHICLE )
{
freeMercSlot = FALSE;
}
+2 -1
View File
@@ -22,6 +22,7 @@
#include "GameSettings.h"
#include "Soldier Profile.h"
#include "Squads.h"
#include "Overhead.h" // added by Flugente for OUR_TEAM_SIZE_NO_VEHICLE
#endif
#include "IMP Confirm.h"
@@ -603,7 +604,7 @@ void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason)
DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack);
}
else if( NumberOfMercsOnPlayerTeam() >= gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs )
else if( NumberOfMercsOnPlayerTeam() >= OUR_TEAM_SIZE_NO_VEHICLE )
{
DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 5 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack);
}
+16 -7
View File
@@ -6988,16 +6988,25 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile )
errMsgTxt[4] = Additional113Text[6];
bool needToRejigger = false;
for (int idx = OUR_TEAM; idx <= CIV_TEAM; ++idx) {
if ((cntFromFile[ idx ] > cntFromIni[ idx ]) || ((cntFromFile[ idx ] < cntFromIni[ idx ]) && (idx == OUR_TEAM))) {
CHAR16 errorMessage[512];
for (int idx = OUR_TEAM; idx <= CIV_TEAM; ++idx)
{
// Flugente: for OUR_TEAM, from no on we use (gTacticalStatus.Team[ OUR_TEAM ].bLastID - gTacticalStatus.Team[ OUR_TEAM ].bFirstID + 1) instead of
// gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs + gGameExternalOptions.ubGameMaximumNumberOfPlayerVehicles (defined in OUR_TEAM_SIZE_NO_VEHICLE).
// As a result, this check isn't needed anymore, as the number stays fixed (it always stayed fixed, as one couldn't continue the game if one altered it,
// which raises the question of why we even checked that...)
/*if ((cntFromFile[ idx ] > cntFromIni[ idx ]) || ((cntFromFile[ idx ] < cntFromIni[ idx ]) && (idx == OUR_TEAM)))
{
CHAR16 errorMessage[512];
swprintf(errorMessage, Additional113Text[1], errMsgTxt [ idx ], cntFromFile[ idx ], cntFromIni[ idx ]);
DoScreenIndependantMessageBox(errorMessage, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack );
return FALSE;
} else if (cntFromFile[ idx ] < cntFromIni[ idx ]) {
DoScreenIndependantMessageBox(errorMessage, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack );
return FALSE;
}
else*/ if (idx != OUR_TEAM && cntFromFile[ idx ] < cntFromIni[ idx ])
{
needToRejigger = true;
}
}
}
if (needToRejigger) {
// The .ini file asked for more slots than were in the save file, so expand the slots
for (int teamIdx = OUR_TEAM; teamIdx <= CIV_TEAM; ++teamIdx) {
+1 -1
View File
@@ -3653,7 +3653,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
case '?':
if( CHEATER_CHEAT_LEVEL() )
{
gpAR->ubMercs = gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs;
gpAR->ubMercs = OUR_TEAM_SIZE_NO_VEHICLE;
gpAR->ubCivs = MAX_AR_TEAM_SIZE;
gpAR->ubEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
fResetAutoResolve = TRUE;
+2 -2
View File
@@ -97,7 +97,7 @@ enum //GraphicIDs for the panel
//The start of the black space
#define TOP_Y 113
//The end of the black space
#define BOTTOM_Y (349+(gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs-18)*ROW_HEIGHT)
#define BOTTOM_Y (349+(OUR_TEAM_SIZE_NO_VEHICLE-18)*ROW_HEIGHT)
//#define BOTTOM_Y 349
//The internal height of the uninvolved panel
#define INTERNAL_HEIGHT 27
@@ -1235,7 +1235,7 @@ void RenderPreBattleInterface()
}
// WDS - make number of mercenaries, etc. be configurable
for( i = 0; i < (INT32)(/*21*/3+gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs - max( guiNumUninvolved, 1 )); i++ )
for( i = 0; i < (INT32)(/*21*/3+ OUR_TEAM_SIZE_NO_VEHICLE - max( guiNumUninvolved, 1 )); i++ )
{
y = TOP_Y + ROW_HEIGHT * i;
BltVideoObject( guiSAVEBUFFER, hVObject, TOP_COLUMN, 186 + xResOffset, y, VO_BLT_SRCTRANSPARENCY, NULL );
+1 -1
View File
@@ -4580,7 +4580,7 @@ UINT32 CalcMedicalCost( UINT8 ubId )
BOOLEAN PlayerTeamHasTwoSpotsLeft( )
{
return ( CountNonVehiclesOnPlayerTeam() <= gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs - 2 );
return ( CountNonVehiclesOnPlayerTeam() <= OUR_TEAM_SIZE_NO_VEHICLE - 2 );
}
+1 -1
View File
@@ -146,7 +146,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
//hayden, 7 member team limit setable in ini
if( NumberOfMercsOnPlayerTeam() >= gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs || (is_client && NumberOfMercsOnPlayerTeam() >= cMaxMercs) )
if( NumberOfMercsOnPlayerTeam() >= OUR_TEAM_SIZE_NO_VEHICLE || (is_client && NumberOfMercsOnPlayerTeam() >= cMaxMercs) )
return( MERC_HIRE_OVER_PLAYER_LIMIT );
// ATE: if we are to use landing zone, update to latest value
+1 -1
View File
@@ -7361,7 +7361,7 @@ UINT32 CountNonVehiclesOnPlayerTeam( )
BOOLEAN PlayerTeamFull( )
{
// last ID for the player team is 19, so long as we have at most 17 non-vehicles...
if ( CountNonVehiclesOnPlayerTeam() < gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs /*gTacticalStatus.Team[ gbPlayerNum ].bLastID - 2*/ )
if ( CountNonVehiclesOnPlayerTeam() < OUR_TEAM_SIZE_NO_VEHICLE /*gTacticalStatus.Team[ gbPlayerNum ].bLastID - 2*/ )
{
return( FALSE );
}
+1
View File
@@ -195,6 +195,7 @@ extern BOOLEAN gfMovingAnimation;
extern TacticalStatusType gTacticalStatus;
#define OUR_TEAM_SIZE_NO_VEHICLE (gTacticalStatus.Team[ OUR_TEAM ].bLastID - gTacticalStatus.Team[ OUR_TEAM ].bFirstID + 1 - gGameExternalOptions.ubGameMaximumNumberOfPlayerVehicles)
BOOLEAN InitTacticalEngine( );
+1 -1
View File
@@ -2765,7 +2765,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
//no crates in sector inventory. search merc inventories
if(!mergeSuccessful)
{
for(int loop=0; loop<(int)gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs; loop++)
for(int loop=0; loop<(int)OUR_TEAM_SIZE_NO_VEHICLE; ++loop)
{
if(MercPtrs[loop]->bActive && MercPtrs[loop]->bInSector)
{