mirror of https://github.com/OpenTTD/OpenTTD
Merge 3c44d5ba5a
into a46a3a97f3
commit
3b8fba842c
|
@ -28,6 +28,7 @@
|
||||||
* \li AICargo::CC_POTABLE
|
* \li AICargo::CC_POTABLE
|
||||||
* \li AICargo::CC_NON_POTABLE
|
* \li AICargo::CC_NON_POTABLE
|
||||||
* \li AIVehicleList_Waypoint
|
* \li AIVehicleList_Waypoint
|
||||||
|
* \li AIBaseStation::GetBaseStationID
|
||||||
*
|
*
|
||||||
* Other changes:
|
* Other changes:
|
||||||
* \li AIBridge::GetBridgeID renamed to AIBridge::GetBridgeType
|
* \li AIBridge::GetBridgeID renamed to AIBridge::GetBridgeType
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
* \li GSCargo::CC_NON_POTABLE
|
* \li GSCargo::CC_NON_POTABLE
|
||||||
* \li GSVehicleList_Waypoint
|
* \li GSVehicleList_Waypoint
|
||||||
* \li GSBaseStation::GetOwner
|
* \li GSBaseStation::GetOwner
|
||||||
|
* \li GSBaseStation::GetBaseStationID
|
||||||
*
|
*
|
||||||
* Other changes:
|
* Other changes:
|
||||||
* \li GSBridge::GetBridgeID renamed to GSBridge::GetBridgeType
|
* \li GSBridge::GetBridgeID renamed to GSBridge::GetBridgeType
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
return ScriptCompany::ToScriptCompanyID(::BaseStation::Get(station_id)->owner);
|
return ScriptCompany::ToScriptCompanyID(::BaseStation::Get(station_id)->owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ StationID ScriptBaseStation::GetBaseStationID(TileIndex tile)
|
||||||
|
{
|
||||||
|
if (!::IsValidTile(tile) || !::IsTileType(tile, MP_STATION) || ::BaseStation::GetByTile(tile) == nullptr) return StationID::Invalid();
|
||||||
|
return ::GetStationIndex(tile);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ std::optional<std::string> ScriptBaseStation::GetName(StationID station_id)
|
/* static */ std::optional<std::string> ScriptBaseStation::GetName(StationID station_id)
|
||||||
{
|
{
|
||||||
if (!IsValidBaseStation(station_id)) return std::nullopt;
|
if (!IsValidBaseStation(station_id)) return std::nullopt;
|
||||||
|
|
|
@ -42,6 +42,15 @@ public:
|
||||||
*/
|
*/
|
||||||
static ScriptCompany::CompanyID GetOwner(StationID station_id);
|
static ScriptCompany::CompanyID GetOwner(StationID station_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the StationID of a tile, if there is a basestation.
|
||||||
|
* @param tile The tile to find the StationID of.
|
||||||
|
* @pre IsValidTile(tile).
|
||||||
|
* @return StationID of the basestation.
|
||||||
|
* @post Use IsValidBaseStation() to see if the basestation is valid.
|
||||||
|
*/
|
||||||
|
static StationID GetBaseStationID(TileIndex tile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of a basestation.
|
* Get the name of a basestation.
|
||||||
* @param station_id The basestation to get the name of.
|
* @param station_id The basestation to get the name of.
|
||||||
|
|
Loading…
Reference in New Issue