From a82572d0f5a55a33df4163b429f891ea76ed92a7 Mon Sep 17 00:00:00 2001 From: Yexo Date: Fri, 29 May 2020 22:31:14 +0200 Subject: Codechange: remove has_newhouses global --- src/newgrf.cpp | 3 --- src/newgrf.h | 1 - src/newgrf_house.cpp | 4 ---- src/town_cmd.cpp | 6 ++---- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 6f12fbbf9..4429771e5 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2384,8 +2384,6 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt if (!CargoSpec::Get(housespec->accepts_cargo[2])->IsValid()) { housespec->cargo_acceptance[2] = 0; } - - _loaded_newgrf_features.has_newhouses = true; break; } @@ -8633,7 +8631,6 @@ void ResetNewGRFData() _loaded_newgrf_features.has_2CC = false; _loaded_newgrf_features.used_liveries = 1 << LS_DEFAULT; - _loaded_newgrf_features.has_newhouses = false; _loaded_newgrf_features.has_newindustries = false; _loaded_newgrf_features.shore = SHORE_REPLACE_NONE; _loaded_newgrf_features.tram = TRAMWAY_REPLACE_DEPOT_NONE; diff --git a/src/newgrf.h b/src/newgrf.h index 65df3698e..20a178e1f 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -174,7 +174,6 @@ enum TramReplacement { struct GRFLoadedFeatures { bool has_2CC; ///< Set if any vehicle is loaded which uses 2cc (two company colours). uint64 used_liveries; ///< Bitmask of #LiveryScheme used by the defined engines. - bool has_newhouses; ///< Set if there are any newhouses loaded. bool has_newindustries; ///< Set if there are any newindustries loaded. ShoreReplacement shore; ///< In which way shore sprites were replaced. TramReplacement tram; ///< In which way tram depots were replaced. diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index b585a682d..544f346e0 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -108,8 +108,6 @@ void IncreaseBuildingCount(Town *t, HouseID house_id) { HouseClassID class_id = HouseSpec::Get(house_id)->class_id; - if (!_loaded_newgrf_features.has_newhouses) return; - t->cache.building_counts.id_count[house_id]++; _building_counts.id_count[house_id]++; @@ -129,8 +127,6 @@ void DecreaseBuildingCount(Town *t, HouseID house_id) { HouseClassID class_id = HouseSpec::Get(house_id)->class_id; - if (!_loaded_newgrf_features.has_newhouses) return; - if (t->cache.building_counts.id_count[house_id] > 0) t->cache.building_counts.id_count[house_id]--; if (_building_counts.id_count[house_id] > 0) _building_counts.id_count[house_id]--; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 9372d3711..39dfa7db1 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2492,8 +2492,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile) if (t->cache.building_counts.id_count[i] == UINT16_MAX) continue; } - /* Without NewHouses, all houses have probability '1' */ - uint cur_prob = (_loaded_newgrf_features.has_newhouses ? hs->probability : 1); + uint cur_prob = hs->probability; probability_max += cur_prob; probs[num] = cur_prob; houses[num++] = (HouseID)i; @@ -2526,8 +2525,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile) const HouseSpec *hs = HouseSpec::Get(house); - if (_loaded_newgrf_features.has_newhouses && !_generating_world && - _game_mode != GM_EDITOR && (hs->extra_flags & BUILDING_IS_HISTORICAL) != 0) { + if (!_generating_world && _game_mode != GM_EDITOR && (hs->extra_flags & BUILDING_IS_HISTORICAL) != 0) { continue; } -- cgit v1.2.3-70-g09d2