mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #4571: Only start autosave timer after update or game command
This commit is contained in:
parent
f25a0b383c
commit
8e449b9648
|
@ -423,6 +423,10 @@ void game_logic_update()
|
|||
|
||||
window_error_open(title_text, body_text);
|
||||
}
|
||||
|
||||
// start autosave timer after update
|
||||
if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE)
|
||||
gLastAutoSaveUpdate = SDL_GetTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -578,6 +582,10 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
|
|||
network_add_player_money_spent(network_get_current_player_id(), cost);
|
||||
}
|
||||
|
||||
// start autosave timer after game command
|
||||
if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE)
|
||||
gLastAutoSaveUpdate = SDL_GetTicks();
|
||||
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ extern "C"
|
|||
|
||||
// #2407: Resetting screen time to not open a save prompt shortly after loading a park.
|
||||
gScreenAge = 0;
|
||||
gLastAutoSaveTick = SDL_GetTicks();
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ extern "C"
|
|||
delete s6Importer;
|
||||
|
||||
gScreenAge = 0;
|
||||
gLastAutoSaveTick = SDL_GetTicks();
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ extern "C"
|
|||
delete s6Importer;
|
||||
|
||||
gScreenAge = 0;
|
||||
gLastAutoSaveTick = SDL_GetTicks();
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ extern "C"
|
|||
delete s6Importer;
|
||||
|
||||
gScreenAge = 0;
|
||||
gLastAutoSaveTick = SDL_GetTicks();
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -568,7 +568,7 @@ extern "C"
|
|||
gCheatsDisablePlantAging = SDL_ReadU8(rw) != 0;
|
||||
gCheatsAllowArbitraryRideTypeChanges = SDL_ReadU8(rw) != 0;
|
||||
|
||||
gLastAutoSaveTick = SDL_GetTicks();
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ char gScenarioSavePath[MAX_PATH];
|
|||
char gScenarioExpansionPacks[3256];
|
||||
int gFirstTimeSave = 1;
|
||||
uint16 gSavedAge;
|
||||
uint32 gLastAutoSaveTick = 0;
|
||||
uint32 gLastAutoSaveUpdate = 0;
|
||||
|
||||
#if defined(NO_RCT2)
|
||||
uint32 gScenarioTicks;
|
||||
|
@ -396,8 +396,10 @@ static void scenario_entrance_fee_too_high_check()
|
|||
|
||||
void scenario_autosave_check()
|
||||
{
|
||||
if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE) return;
|
||||
|
||||
// Milliseconds since last save
|
||||
uint32 timeSinceSave = SDL_GetTicks() - gLastAutoSaveTick;
|
||||
uint32 timeSinceSave = SDL_GetTicks() - gLastAutoSaveUpdate;
|
||||
|
||||
bool shouldSave = false;
|
||||
switch (gConfigGeneral.autosave_frequency) {
|
||||
|
@ -419,7 +421,7 @@ void scenario_autosave_check()
|
|||
}
|
||||
|
||||
if (shouldSave) {
|
||||
gLastAutoSaveTick = SDL_GetTicks();
|
||||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
game_autosave();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -377,6 +377,8 @@ enum {
|
|||
OBJECTIVE_MONTHLY_FOOD_INCOME
|
||||
};
|
||||
|
||||
#define AUTOSAVE_PAUSE 0
|
||||
|
||||
extern const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT];
|
||||
|
||||
#if defined(NO_RCT2)
|
||||
|
@ -404,7 +406,7 @@ extern char gScenarioSavePath[MAX_PATH];
|
|||
extern char gScenarioExpansionPacks[3256];
|
||||
extern int gFirstTimeSave;
|
||||
extern uint16 gSavedAge;
|
||||
extern uint32 gLastAutoSaveTick;
|
||||
extern uint32 gLastAutoSaveUpdate;
|
||||
|
||||
extern const char *_scenarioFileName;
|
||||
|
||||
|
|
Loading…
Reference in New Issue