summaryrefslogtreecommitdiff
path: root/src/settings_type.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-01-02 00:34:21 +0000
committeryexo <yexo@openttd.org>2011-01-02 00:34:21 +0000
commit3ca65ab7b3ee218fc1bfbeb72df16b3a42fe0287 (patch)
treee043e2f982f67c147ca551134c9857d576672075 /src/settings_type.h
parenta25d6c64dde115f6ee5c0cec54750257cc932388 (diff)
downloadopenttd-3ca65ab7b3ee218fc1bfbeb72df16b3a42fe0287.tar.xz
(svn r21695) -Codechange: add helper function to get the currently applicable GameSettings object
Diffstat (limited to 'src/settings_type.h')
-rw-r--r--src/settings_type.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/settings_type.h b/src/settings_type.h
index 2521caa8d..39a4e1a0f 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -17,6 +17,7 @@
#include "transport_type.h"
#include "network/core/config.h"
#include "company_type.h"
+#include "openttd.h"
/** Settings related to the difficulty of the game */
struct DifficultySettings {
@@ -438,4 +439,13 @@ extern GameSettings _settings_game;
/** The settings values that are used for new games and/or modified in config file. */
extern GameSettings _settings_newgame;
+/**
+ * Get the settings-object applicable for the current situation: the newgame settings
+ * when we're in the main menu and otherwise the settings of the current game.
+ */
+static inline GameSettings &GetGameSettings()
+{
+ return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
+}
+
#endif /* SETTINGS_TYPE_H */