|
|
|
@ -270,39 +270,3 @@ RoadType GetRoadTypeByLabel(RoadTypeLabel label, bool allow_alternate_labels)
|
|
|
|
|
/* No matching label was found, so it is invalid */
|
|
|
|
|
return INVALID_ROADTYPE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the available RoadSubTypes for the provided RoadType
|
|
|
|
|
* If the given company is valid then will be returned a list of the available sub types at the current date, while passing
|
|
|
|
|
* a deity company will make all the sub types available
|
|
|
|
|
* @param rt the RoadType to filter
|
|
|
|
|
* @param c the company ID to check the roadtype against
|
|
|
|
|
* @param any_date whether to return only currently introduced roadtypes or also future ones
|
|
|
|
|
* @returns the existing RoadSubTypes
|
|
|
|
|
*/
|
|
|
|
|
RoadTypes ExistingRoadTypes(CompanyID c)
|
|
|
|
|
{
|
|
|
|
|
/* Check only players which can actually own vehicles, editor and gamescripts are considered deities */
|
|
|
|
|
if (c < OWNER_END) {
|
|
|
|
|
const Company *company = Company::GetIfValid(c);
|
|
|
|
|
if (company != nullptr) return company->avail_roadtypes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RoadTypes known_roadtypes = ROADTYPES_NONE;
|
|
|
|
|
|
|
|
|
|
/* Find used roadtypes */
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/* Check whether available for all potential companies */
|
|
|
|
|
if (e->company_avail != MAX_UVALUE(CompanyMask)) continue;
|
|
|
|
|
|
|
|
|
|
known_roadtypes |= GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the date introduced roadtypes as well. */
|
|
|
|
|
known_roadtypes = AddDateIntroducedRoadTypes(known_roadtypes, CalendarTime::MAX_DATE);
|
|
|
|
|
|
|
|
|
|
return known_roadtypes;
|
|
|
|
|
}
|
|
|
|
|