From bd66cc57569a034b02674fa8aaa5dbe521e73a36 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 4 Dec 2006 08:30:04 +0000 Subject: (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames... --- openttd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'openttd.c') diff --git a/openttd.c b/openttd.c index 7d30e3ac3..01e0fd8c6 100644 --- a/openttd.c +++ b/openttd.c @@ -53,6 +53,7 @@ #include "date.h" #include "clear_map.h" #include "fontcache.h" +#include "newgrf_config.h" #include @@ -281,6 +282,7 @@ static void LoadIntroGame(void) _game_mode = GM_MENU; CLRBITS(_display_opt, DO_TRANS_BUILDINGS); // don't make buildings transparent in intro _opt_ptr = &_opt_newgame; + ResetGRFConfig(false); // Setup main window ResetWindowSystem(); @@ -451,7 +453,10 @@ int ttd_main(int argc, char *argv[]) NetworkStartUp(); // initialize network-core + ScanNewGRFFiles(); + _opt_ptr = &_opt_newgame; + ResetGRFConfig(false); /* XXX - ugly hack, if diff_level is 9, it means we got no setting from the config file */ if (_opt_newgame.diff_level == 9) SetDifficultyLevel(0, &_opt_newgame); @@ -754,6 +759,7 @@ void SwitchMode(int new_mode) case SM_LOAD: { /* Load game, Play Scenario */ _opt_ptr = &_opt; + ResetGRFConfig(true); if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL)) { LoadIntroGame(); @@ -793,6 +799,7 @@ void SwitchMode(int new_mode) Player *p; _opt_ptr = &_opt; + ResetGRFConfig(true); _local_player = OWNER_NONE; _generating_world = true; @@ -1149,6 +1156,9 @@ bool AfterLoadGame(void) // convert road side to my format. if (_opt.road_side) _opt.road_side = 1; + /* Check all NewGRFs are present */ + if (!IsGoodGRFConfigList()) return false; + // Load the sprites GfxLoadSprites(); LoadStringWidthTable(); -- cgit v1.2.3-70-g09d2