diff options
author | rubidium <rubidium@openttd.org> | 2008-05-29 15:13:28 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-05-29 15:13:28 +0000 |
commit | e7a501100a242640d25c21627ec67e75f9645043 (patch) | |
tree | 59059f0a1aba0794fa770e8c9a19312e4ce300af /src/town_cmd.cpp | |
parent | 48e20d801221888a1b8b6a4ab8288becad4b954b (diff) | |
download | openttd-e7a501100a242640d25c21627ec67e75f9645043.tar.xz |
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r-- | src/town_cmd.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 98891028c..a8b6d9135 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -320,7 +320,7 @@ void UpdateTownVirtCoord(Town *t) SetDParam(0, t->index); SetDParam(1, t->population); UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24, - _settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL); + _settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL); MarkTownSignDirty(t); } @@ -592,7 +592,7 @@ static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac) if (callback != CALLBACK_FAILED) { if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4); if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4); - if (_settings.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) { + if (_settings_game.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) { /* The 'S' bit indicates food instead of goods */ ac[CT_FOOD] = GB(callback, 8, 4); } else { @@ -1251,7 +1251,7 @@ static bool GrowTown(Town *t) /* Let the town be a ghost town * The player wanted it in such a way. Thus there he has it. ;) * Never reached in editor mode. */ - if (_settings.economy.town_layout == TL_NO_ROADS && _generating_world) { + if (_settings_game.economy.town_layout == TL_NO_ROADS && _generating_world) { return false; } @@ -1363,9 +1363,9 @@ static bool CreateTownName(uint32 *townnameparts) * the other towns may take considerable amount of time (10000 is * too much). */ int tries = 1000; - bool grf = (_settings.game_creation.town_name >= _nb_orig_names); - uint32 grfid = grf ? GetGRFTownNameId(_settings.game_creation.town_name - _nb_orig_names) : 0; - uint16 townnametype = grf ? GetGRFTownNameType(_settings.game_creation.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _settings.game_creation.town_name; + bool grf = (_settings_game.game_creation.town_name >= _nb_orig_names); + uint32 grfid = grf ? GetGRFTownNameId(_settings_game.game_creation.town_name - _nb_orig_names) : 0; + uint16 townnametype = grf ? GetGRFTownNameType(_settings_game.game_creation.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name; assert(townnameparts != NULL); @@ -1449,14 +1449,14 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize t->exclusive_counter = 0; t->statues = 0; - if (_settings.game_creation.town_name < _nb_orig_names) { + if (_settings_game.game_creation.town_name < _nb_orig_names) { /* Original town name */ t->townnamegrfid = 0; - t->townnametype = SPECSTR_TOWNNAME_START + _settings.game_creation.town_name; + t->townnametype = SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name; } else { /* Newgrf town name */ - t->townnamegrfid = GetGRFTownNameId(_settings.game_creation.town_name - _nb_orig_names); - t->townnametype = GetGRFTownNameType(_settings.game_creation.town_name - _nb_orig_names); + t->townnamegrfid = GetGRFTownNameId(_settings_game.game_creation.town_name - _nb_orig_names); + t->townnametype = GetGRFTownNameType(_settings_game.game_creation.town_name - _nb_orig_names); } t->townnameparts = townnameparts; @@ -1481,7 +1481,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize break; case TSM_CITY: - x *= _settings.economy.initial_city_size; + x *= _settings_game.economy.initial_city_size; t->larger_town = true; break; } @@ -1581,8 +1581,8 @@ static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, no bool GenerateTowns() { uint num = 0; - uint n = ScaleByMapSize(_num_initial_towns[_settings.difficulty.number_towns] + (Random() & 7)); - uint num_cities = _settings.economy.larger_towns == 0 ? 0 : n / _settings.economy.larger_towns; + uint n = ScaleByMapSize(_num_initial_towns[_settings_game.difficulty.number_towns] + (Random() & 7)); + uint num_cities = _settings_game.economy.larger_towns == 0 ? 0 : n / _settings_game.economy.larger_towns; SetGeneratingWorldProgress(GWP_TOWN, n); @@ -1590,7 +1590,7 @@ bool GenerateTowns() IncreaseGeneratingWorldProgress(GWP_TOWN); /* try 20 times to create a random-sized town for the first loop. */ TownSizeMode mode = num_cities > 0 ? TSM_CITY : TSM_RANDOM; - if (CreateRandomTown(20, mode, _settings.economy.initial_city_size) != NULL) num++; + if (CreateRandomTown(20, mode, _settings_game.economy.initial_city_size) != NULL) num++; if (num_cities > 0) num_cities--; } while (--n); @@ -1875,8 +1875,8 @@ static bool BuildTownHouse(Town *t, TileIndex tile) HouseZonesBits rad = GetTownRadiusGroup(t, tile); /* Above snow? */ - int land = _settings.game_creation.landscape; - if (land == LT_ARCTIC && z >= _settings.game_creation.snow_line) land = -1; + int land = _settings_game.game_creation.landscape; + if (land == LT_ARCTIC && z >= _settings_game.game_creation.snow_line) land = -1; uint bitmask = (1 << rad) + (1 << (land + 12)); @@ -2215,7 +2215,7 @@ static void TownActionFundBuildings(Town *t) static void TownActionBuyRights(Town *t) { /* Check if it's allowed to by the rights */ - if (!_settings.economy.exclusive_rights) return; + if (!_settings_game.economy.exclusive_rights) return; t->exclusive_counter = 12; t->exclusivity = _current_player; @@ -2329,7 +2329,7 @@ static void UpdateTownGrowRate(Town *t) } ClrBit(t->flags12, TOWN_IS_FUNDED); - if (_settings.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return; + if (_settings_game.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return; /** Towns are processed every TOWN_GROWTH_FREQUENCY ticks, and this is the * number of times towns are processed before a new building is built. */ @@ -2348,17 +2348,17 @@ static void UpdateTownGrowRate(Town *t) if (n == 0 && !Chance16(1, 12)) return; } - if (_settings.game_creation.landscape == LT_ARCTIC) { + if (_settings_game.game_creation.landscape == LT_ARCTIC) { if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90) return; - } else if (_settings.game_creation.landscape == LT_TROPIC) { + } else if (_settings_game.game_creation.landscape == LT_TROPIC) { if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60) return; } /* Use the normal growth rate values if new buildings have been funded in * this town and the growth rate is set to none. */ - uint growth_multiplier = _settings.economy.town_growth_rate != 0 ? _settings.economy.town_growth_rate - 1 : 1; + uint growth_multiplier = _settings_game.economy.town_growth_rate != 0 ? _settings_game.economy.town_growth_rate - 1 : 1; m >>= growth_multiplier; if (t->larger_town) m /= 2; @@ -2401,7 +2401,7 @@ bool CheckIfAuthorityAllows(TileIndex tile) { if (!IsValidPlayer(_current_player)) return true; - Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority); + Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority); if (t == NULL) return true; if (t->ratings[_current_player] > RATING_VERYPOOR) return true; @@ -2520,7 +2520,7 @@ bool CheckforTownRating(uint32 flags, Town *t, byte type) * owned by a town no removal if rating is lower than ... depends now on * difficulty setting. Minimum town rating selected by difficulty level */ - int modemod = _default_rating_settings[_settings.difficulty.town_council_tolerance][type]; + int modemod = _default_rating_settings[_settings_game.difficulty.town_council_tolerance][type]; if (GetRating(t) < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) { SetDParam(0, t->index); |