summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2020-04-05 19:30:22 +0100
committerPatric Stout <github@truebrain.nl>2021-01-08 16:43:51 +0100
commitb9f3e45af7bef330acdd87cfc9c8086433d6c439 (patch)
treee48b6e3719cda19449b681a20536340cad44b3e5
parentaf22a4f2cda86a7667578281a51ea1ec08a49af6 (diff)
downloadopenttd-b9f3e45af7bef330acdd87cfc9c8086433d6c439.tar.xz
Cleanup: Remove unused (and mostly duplicated) function
-rw-r--r--src/road.cpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/road.cpp b/src/road.cpp
index 486dc0044..788c61165 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -295,39 +295,3 @@ RoadTypes ExistingRoadTypes(CompanyID c)
return known_roadtypes;
}
-
-/**
- * Check whether we can build infrastructure for the given RoadType. This to disable building stations etc. when
- * you are not allowed/able to have the RoadType yet.
- * @param roadtype the roadtype to check this for
- * @param company the company id to check this for
- * @param any_date to check only existing vehicles or if it is possible to build them in the future
- * @return true if there is any reason why you may build the infrastructure for the given roadtype
- */
-bool CanBuildRoadTypeInfrastructure(RoadType roadtype, CompanyID company)
-{
- if (_game_mode != GM_EDITOR && !Company::IsValidID(company)) return false;
- if (!_settings_client.gui.disable_unsuitable_building) return true;
- if (!HasAnyRoadTypesAvail(company, GetRoadTramType(roadtype))) return false;
-
- RoadTypes roadtypes = ExistingRoadTypes(company);
-
- /* Check if the filtered roadtypes does have the roadtype we are checking for
- * and if we can build new ones */
- if (_settings_game.vehicle.max_roadveh > 0 && HasBit(roadtypes, roadtype)) {
- /* Can we actually build the vehicle type? */
- for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
- if (!HasBit(e->company_avail, company)) continue;
- if (HasPowerOnRoad(e->u.road.roadtype, roadtype) || HasPowerOnRoad(roadtype, e->u.road.roadtype)) return true;
- }
- return false;
- }
-
- /* We should be able to build infrastructure when we have the actual vehicle type */
- for (const Vehicle *v : Vehicle::Iterate()) {
- if (v->type == VEH_ROAD && (company == OWNER_DEITY || v->owner == company) &&
- HasBit(roadtypes, RoadVehicle::From(v)->roadtype) && HasPowerOnRoad(RoadVehicle::From(v)->roadtype, roadtype)) return true;
- }
-
- return false;
-}