summaryrefslogtreecommitdiff
path: root/openttd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-12-04 08:30:04 +0000
committerpeter1138 <peter1138@openttd.org>2006-12-04 08:30:04 +0000
commitbd66cc57569a034b02674fa8aaa5dbe521e73a36 (patch)
treefb2a8cf881b385cb52b110880f86128061ea020c /openttd.c
parentdc8992a677b8b7b56b8ad55d7da690b77105bb83 (diff)
downloadopenttd-bd66cc57569a034b02674fa8aaa5dbe521e73a36.tar.xz
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
Diffstat (limited to 'openttd.c')
-rw-r--r--openttd.c10
1 files changed, 10 insertions, 0 deletions
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 <stdarg.h>
@@ -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();