summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-10-27 08:17:40 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2018-10-27 10:30:24 +0200
commit50efaa2372cafe430f79ecc3361cb2450715417c (patch)
tree93a30de9a6889b54492d1a9ca2109e9c56c97728
parent25ab9c1997f770f4a8a66bb3ad4b82ba87e3a977 (diff)
downloadopenttd-50efaa2372cafe430f79ecc3361cb2450715417c.tar.xz
Fix e00908f: Visual C++ 2015 compile error
Microsoft Visual C++ 2015 Update 3 (and possibly other versions) consider a struct member undefined in a static_assert in the struct body. Moving the static_assert to a member function solves the issue.
-rw-r--r--src/openttd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index a849a2ebd..3e11cf038 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -394,8 +394,6 @@ struct AfterNewGRFScan : NewGRFScanCallback {
bool *save_config_ptr; ///< The pointer to the save config setting.
bool save_config; ///< The save config setting.
- assert_compile(sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed));
-
/**
* Create a new callback.
* @param save_config_ptr Pointer to the save_config local variable which
@@ -407,6 +405,9 @@ struct AfterNewGRFScan : NewGRFScanCallback {
join_server_password(NULL), join_company_password(NULL),
save_config_ptr(save_config_ptr), save_config(true)
{
+ /* Visual C++ 2015 fails compiling this line (AfterNewGRFScan::generation_seed undefined symbol)
+ * if it's placed outside a member function, directly in the struct body. */
+ assert_compile(sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed));
}
virtual void OnNewGRFsScanned()