diff options
author | rubidium <rubidium@openttd.org> | 2011-11-03 22:49:03 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-03 22:49:03 +0000 |
commit | 47c5d30b5d967cf5c48f3de1c7ca1ee492f60002 (patch) | |
tree | b733935884805a61a58a0e2f55c57dc08e9499ca | |
parent | e98be8ed244e3d61ae0ae5c28bff8098bc2ff79f (diff) | |
download | openttd-47c5d30b5d967cf5c48f3de1c7ca1ee492f60002.tar.xz |
(svn r23084) -Codechange: get rid of a redundant variable
-rw-r--r-- | src/clear_cmd.cpp | 5 | ||||
-rw-r--r-- | src/landscape.cpp | 8 | ||||
-rw-r--r-- | src/misc.cpp | 2 | ||||
-rw-r--r-- | src/saveload/afterload.cpp | 5 | ||||
-rw-r--r-- | src/saveload/oldloader_sl.cpp | 2 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/table/gameopt_settings.ini | 2 | ||||
-rw-r--r-- | src/table/settings.ini | 12 |
8 files changed, 15 insertions, 22 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 5106113d3..65c50771b 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -361,11 +361,6 @@ static void ChangeTileOwner_Clear(TileIndex tile, Owner old_owner, Owner new_own return; } -void InitializeClearLand() -{ - _settings_game.game_creation.snow_line = _settings_game.game_creation.snow_line_height * TILE_HEIGHT; -} - static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) { return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); diff --git a/src/landscape.cpp b/src/landscape.cpp index 18ae31207..a4573a133 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -79,7 +79,7 @@ extern const byte _slope_to_sprite_offset[32] = { /** * Description of the snow line throughout the year. * - * If it is \c NULL, a static snowline height is used, as set by \c _settings_game.game_creation.snow_line. + * If it is \c NULL, a static snowline height is used, as set by \c _settings_game.game_creation.snow_line_height. * Otherwise it points to a table loaded from a newGRF file that describes the variable snowline. * @ingroup SnowLineGroup * @see GetSnowLine() GameCreationSettings @@ -561,7 +561,7 @@ void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]) */ byte GetSnowLine() { - if (_snow_line == NULL) return _settings_game.game_creation.snow_line; + if (_snow_line == NULL) return _settings_game.game_creation.snow_line_height * TILE_HEIGHT; YearMonthDay ymd; ConvertDateToYMD(_date, &ymd); @@ -575,7 +575,7 @@ byte GetSnowLine() */ byte HighestSnowLine() { - return _snow_line == NULL ? _settings_game.game_creation.snow_line : _snow_line->highest_value; + return _snow_line == NULL ? _settings_game.game_creation.snow_line_height * TILE_HEIGHT : _snow_line->highest_value; } /** @@ -585,7 +585,7 @@ byte HighestSnowLine() */ byte LowestSnowLine() { - return _snow_line == NULL ? _settings_game.game_creation.snow_line : _snow_line->lowest_value; + return _snow_line == NULL ? _settings_game.game_creation.snow_line_height * TILE_HEIGHT : _snow_line->lowest_value; } /** diff --git a/src/misc.cpp b/src/misc.cpp index 93908cffc..614ca4013 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -35,7 +35,6 @@ extern void MakeNewgameSettingsLive(); void InitializeSound(); void InitializeMusic(); void InitializeVehicles(); -void InitializeClearLand(); void InitializeRailGui(); void InitializeRoadGui(); void InitializeAirportGui(); @@ -80,7 +79,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin InitNewsItemStructs(); InitializeLandscape(); - InitializeClearLand(); InitializeRailGui(); InitializeRoadGui(); InitializeAirportGui(); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index af6028d1c..d3fce84d0 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2648,6 +2648,11 @@ bool AfterLoadGame() } } + /* This triggers only when old snow_lines were copied into the snow_line_height. */ + if (IsSavegameVersionBefore(164) && _settings_game.game_creation.snow_line_height >= MIN_SNOWLINE_HEIGHT * TILE_HEIGHT) { + _settings_game.game_creation.snow_line_height /= TILE_HEIGHT; + } + /* When any NewGRF has been changed the availability of some vehicles might * have been changed too. e->company_avail must be set to 0 in that case * which is done by StartupEngines(). */ diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index d8a54b6e8..c38e0d78d 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -1724,7 +1724,7 @@ static const OldChunks main_chunk[] = { OCL_VAR ( OC_TTD | OC_UINT8, 1, &_trees_tick_ctr ), OCL_CNULL( OC_TTD, 1 ), ///< Custom vehicle types yes/no, no longer used - OCL_VAR ( OC_TTD | OC_UINT8, 1, &_settings_game.game_creation.snow_line ), + OCL_VAR ( OC_TTD | OC_UINT8, 1, &_settings_game.game_creation.snow_line_height ), OCL_CNULL( OC_TTD, 32 ), ///< new_industry_randtable, no longer used (because of new design) OCL_CNULL( OC_TTD, 36 ), ///< cargo-stuff diff --git a/src/settings_type.h b/src/settings_type.h index 8e7d196e3..12063f10c 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -216,7 +216,6 @@ struct GameCreationSettings { byte se_flat_world_height; ///< land height a flat world gets in SE byte town_name; ///< the town name generator used for town names byte landscape; ///< the landscape we're currently in - byte snow_line; ///< the snowline level in this game byte water_borders; ///< bitset of the borders that are water uint16 custom_town_number; ///< manually entered number of towns byte variety; ///< variety level applied to TGP diff --git a/src/table/gameopt_settings.ini b/src/table/gameopt_settings.ini index 662b2a9da..9d493ad3b 100644 --- a/src/table/gameopt_settings.ini +++ b/src/table/gameopt_settings.ini @@ -132,7 +132,7 @@ load = ConvertLandscape [SDT_VAR] base = GameSettings -var = game_creation.snow_line +var = game_creation.snow_line_height type = SLE_UINT8 def = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT min = MIN_SNOWLINE_HEIGHT * TILE_HEIGHT diff --git a/src/table/settings.ini b/src/table/settings.ini index 72ce27276..96cfe9dd6 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -330,15 +330,11 @@ max = 3 full = _climates load = ConvertLandscape -[SDT_VAR] -base = GameSettings -var = game_creation.snow_line -type = SLE_UINT8 +; Snow line (or snow_line_height * TILE_HEIGHT) +[SDT_NULL] +length = SLE_UINT8 from = 97 -guiflags = SGF_NO_NETWORK -def = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT -min = MIN_SNOWLINE_HEIGHT * TILE_HEIGHT -max = MAX_SNOWLINE_HEIGHT * TILE_HEIGHT +to = 163 [SDT_OMANY] base = GameSettings |