|
@@ -1012,49 +1012,49 @@ void StateGameLoop(void)
|
|
|
AnimateAnimatedTiles();
|
|
|
IncreaseDate();
|
|
|
RunTileLoop();
|
|
|
CallVehicleTicks();
|
|
|
CallLandscapeTick();
|
|
|
|
|
|
// To bad the AI does not work in multiplayer, because states are not saved
|
|
|
// perfectly
|
|
|
if (!disable_computer && !_networking)
|
|
|
RunOtherPlayersLoop();
|
|
|
|
|
|
CallWindowTickEvent();
|
|
|
NewsLoop();
|
|
|
_current_player = p;
|
|
|
}
|
|
|
|
|
|
_in_state_game_loop = false;
|
|
|
}
|
|
|
|
|
|
static void DoAutosave(void)
|
|
|
{
|
|
|
char buf[200];
|
|
|
|
|
|
if (_patches.keep_all_autosave && _local_player != OWNER_SPECTATOR) {
|
|
|
const Player *p = DEREF_PLAYER(_local_player);
|
|
|
const Player *p = GetPlayer(_local_player);
|
|
|
char *s;
|
|
|
sprintf(buf, "%s%s", _path.autosave_dir, PATHSEP);
|
|
|
|
|
|
SetDParam(0, p->name_1);
|
|
|
SetDParam(1, p->name_2);
|
|
|
SetDParam(2, _date);
|
|
|
s = (char*)GetString(buf + strlen(_path.autosave_dir) + strlen(PATHSEP), STR_4004);
|
|
|
strcpy(s, ".sav");
|
|
|
} else { /* Save a maximum of 15 autosaves */
|
|
|
int n = _autosave_ctr;
|
|
|
_autosave_ctr = (_autosave_ctr + 1) & 15;
|
|
|
sprintf(buf, "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, n);
|
|
|
}
|
|
|
|
|
|
DEBUG(misc, 2) ("Autosaving to %s", buf);
|
|
|
if (SaveOrLoad(buf, SL_SAVE) != SL_OK)
|
|
|
ShowErrorMessage(INVALID_STRING_ID, STR_AUTOSAVE_FAILED, 0, 0);
|
|
|
}
|
|
|
|
|
|
static void ScrollMainViewport(int x, int y)
|
|
|
{
|
|
|
if (_game_mode != GM_MENU) {
|
|
|
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
|
|
assert(w);
|