Auto save: Externalized the auto save feature (see GameSettings.cpp). No more need to create a file named "AutoSave.pls" in your JA2 root directory. But there is one bug in the game: The game always crashes after loading a "normal" savegame after an auto savegame was loaded. The error occurs, because the game tries to remove a mouse region that does not exists. I could not fix the bug, so I did not make an entry for auto save in the ja2_options.ini. Auto save is always false in the game, until this bug is fixed.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@526 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2006-09-16 07:44:38 +00:00
parent da5f292243
commit 22d2797603
6 changed files with 27 additions and 15 deletions
+10 -3
View File
@@ -467,10 +467,17 @@ void LoadGameExternalOptions()
// WANNE: Drop Items // WANNE: Drop Items
gGameExternalOptions.ubEnemiesItemDrop = iniReader.ReadInteger("JA2 Gameplay Settings","ENEMIES_ITEM_DROP", 0); gGameExternalOptions.ubEnemiesItemDrop = iniReader.ReadInteger("JA2 Gameplay Settings","ENEMIES_ITEM_DROP", 0);
// WANNE: Auto save: I did not set USE_AUTO_SAVE in the ja2_options.ini, because
// the game always crashes after a "normal" savegame is loaded after loading an autosave
// So for now USE_AUTO_SAVE is always false.
// The game crashes when removing mouse region that are not set
// After we fix that bug, we can make the entry USE_AUTO_SAVE in the ja2_options.ini
gGameExternalOptions.gfUseAutoSave = iniReader.ReadBoolean("JA2 Gameplay Settings","USE_AUTO_SAVE",FALSE);
// Militia settings // Militia settings
gGameExternalOptions.gfAllowMilitiaGroups = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_MILITIA_MOBILE_GROUPS",0); gGameExternalOptions.gfAllowMilitiaGroups = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_MILITIA_MOBILE_GROUPS",FALSE);
gGameExternalOptions.gfAllowReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS",0); gGameExternalOptions.gfAllowReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS",FALSE);
gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",0); gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",FALSE);
gGameExternalOptions.guiBaseQueenPoolIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","QUEEN_POOL_INCREMENT_PER_DIFFICULTY_LEVEL",60); gGameExternalOptions.guiBaseQueenPoolIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","QUEEN_POOL_INCREMENT_PER_DIFFICULTY_LEVEL",60);
gGameExternalOptions.guiCreateEachNHours = iniReader.ReadInteger("JA2 Gameplay Settings","CREATE_EACH_N_HOURS",24); gGameExternalOptions.guiCreateEachNHours = iniReader.ReadInteger("JA2 Gameplay Settings","CREATE_EACH_N_HOURS",24);
+2
View File
@@ -309,6 +309,8 @@ typedef struct
// WANNE // WANNE
INT32 ubEnemiesItemDrop; INT32 ubEnemiesItemDrop;
BOOLEAN gfUseAutoSave;
//Merc Assignment settings //Merc Assignment settings
INT32 ubAssignmentUnitsPerDay; INT32 ubAssignmentUnitsPerDay;
INT32 ubMinutesForAssignmentToCount; INT32 ubMinutesForAssignmentToCount;
BIN
View File
Binary file not shown.
+3 -4
View File
@@ -714,7 +714,6 @@ void ExitSaveLoadScreen()
{ {
INT8 i; INT8 i;
gfLoadGameUponEntry = FALSE; gfLoadGameUponEntry = FALSE;
if( !gfSaveLoadScreenButtonsCreated ) if( !gfSaveLoadScreenButtonsCreated )
@@ -738,7 +737,7 @@ void ExitSaveLoadScreen()
for(i=0; i<NUM_SAVE_GAMES; i++) for(i=0; i<NUM_SAVE_GAMES; i++)
{ {
MSYS_RemoveRegion( &gSelectedSaveRegion[i]); MSYS_RemoveRegion( &gSelectedSaveRegion[i]);
} }
DeleteVideoObjectFromIndex( guiSlgBackGroundImage ); DeleteVideoObjectFromIndex( guiSlgBackGroundImage );
@@ -847,14 +846,14 @@ void GetSaveLoadScreenUserInput()
} }
if( gfKeyState[ ALT ] ) /*if( gfKeyState[ ALT ] )
{ {
DisplayOnScreenNumber( FALSE ); DisplayOnScreenNumber( FALSE );
} }
else else
{ {
DisplayOnScreenNumber( TRUE ); DisplayOnScreenNumber( TRUE );
} }*/
if( gfKeyState[ CTRL ] || fWasCtrlHeldDownLastFrame ) if( gfKeyState[ CTRL ] || fWasCtrlHeldDownLastFrame )
{ {
+5 -1
View File
@@ -1172,7 +1172,11 @@ UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent )
} }
else else
{ {
if( FileExists( "..\\AutoSave.pls" ) && CanGameBeSaved() ) // WANNE: Changed the auto save depending from AutoSave.pls
// to an option setting.
// So no more need to have a file AutoSave.pls in you ja2 root directory
//if( FileExists( "..\\AutoSave.pls" ) && CanGameBeSaved() )
if (gGameExternalOptions.gfUseAutoSave == TRUE && CanGameBeSaved() )
{ {
//Save the game //Save the game
guiPreviousOptionScreen = guiCurrentScreen; guiPreviousOptionScreen = guiCurrentScreen;
+7 -7
View File
@@ -573,8 +573,8 @@ void UnHideMessagesDuringNPCDialogue( void )
void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...) void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...)
{ {
__try //__try
{ //{
wchar_t DestString[512]; wchar_t DestString[512];
va_list argptr; va_list argptr;
@@ -648,11 +648,11 @@ void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...)
} }
return; return;
} //}
__except(filter(GetExceptionCode(), GetExceptionInformation())) //__except(filter(GetExceptionCode(), GetExceptionInformation()))
{ //{
return; // return;
} //}
} }
void ClearWrappedStrings( WRAPPED_STRING *pStringWrapperHead ) void ClearWrappedStrings( WRAPPED_STRING *pStringWrapperHead )