Update to 1.10.0-beta2
This commit is contained in:
17
src/road.cpp
17
src/road.cpp
@@ -1,5 +1,3 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
@@ -191,8 +189,7 @@ RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
|
||||
{
|
||||
RoadTypes rts = ROADTYPES_NONE;
|
||||
|
||||
const Engine *e;
|
||||
FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
|
||||
for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
|
||||
const EngineInfo *ei = &e->info;
|
||||
|
||||
if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
|
||||
@@ -220,8 +217,7 @@ RoadTypes GetRoadTypes(bool introduces)
|
||||
{
|
||||
RoadTypes rts = ROADTYPES_NONE;
|
||||
|
||||
const Engine *e;
|
||||
FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
|
||||
for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
|
||||
const EngineInfo *ei = &e->info;
|
||||
if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) continue;
|
||||
|
||||
@@ -284,8 +280,7 @@ RoadTypes ExistingRoadTypes(CompanyID c)
|
||||
RoadTypes known_roadtypes = ROADTYPES_NONE;
|
||||
|
||||
/* Find used roadtypes */
|
||||
Engine *e;
|
||||
FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
|
||||
for (Engine *e : Engine::IterateType(VEH_ROAD)) {
|
||||
/* Check if the roadtype can be used in the current climate */
|
||||
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
|
||||
|
||||
@@ -321,8 +316,7 @@ bool CanBuildRoadTypeInfrastructure(RoadType roadtype, CompanyID company)
|
||||
* and if we can build new ones */
|
||||
if (_settings_game.vehicle.max_roadveh > 0 && HasBit(roadtypes, roadtype)) {
|
||||
/* Can we actually build the vehicle type? */
|
||||
const Engine *e;
|
||||
FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
|
||||
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;
|
||||
}
|
||||
@@ -330,8 +324,7 @@ bool CanBuildRoadTypeInfrastructure(RoadType roadtype, CompanyID company)
|
||||
}
|
||||
|
||||
/* We should be able to build infrastructure when we have the actual vehicle type */
|
||||
const Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user