Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #6898: Replace atoi() with strtoul()
Normalize type and parsing of generation_seed across all files Add assert_compile() to ensure correct type
- Loading branch information
1 parent
fbfa4eb
commit e00908f
Showing
3 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -385,7 +385,7 @@ void OpenBrowser(const char *url) | |||||
/** Callback structure of statements to be executed after the NewGRF scan. */ | ||||||
struct AfterNewGRFScan : NewGRFScanCallback { | ||||||
Year startyear; ///< The start year. | ||||||
uint generation_seed; ///< Seed for the new game. | ||||||
uint32 generation_seed; ///< Seed for the new game. | ||||||
char *dedicated_host; ///< Hostname for the dedicated server. | ||||||
uint16 dedicated_port; ///< Port for the dedicated server. | ||||||
char *network_conn; ///< Information about the server to connect to, or NULL. | ||||||
|
@@ -394,6 +394,8 @@ 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)); | ||||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
LordAro
Member
|
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) | |
#define assert_compile(expr) static_assert(expr, #expr ) |
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
nielsmh
Oct 26, 2018
Contributor
3>..\src\openttd.cpp(397): error C2327: 'AfterNewGRFScan::generation_seed': is not a type name, static, or enumerator
3>..\src\openttd.cpp(397): error C2065: 'generation_seed': undeclared identifier
3>..\src\openttd.cpp(397): error C2338: sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed)
This line fails to compile on Visual C++ 2015 Update 3.
AfterNewGRFScan::generation_seed
is considered undeclared at this point (for some reason), but placing the static assert inside a function body makes it valid.