mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 04:34:16 +01:00
Codechange: use std::string as script API return type
This commit is contained in:
@@ -299,9 +299,9 @@
|
||||
return ::Vehicle::Get(vehicle_id)->unitnumber;
|
||||
}
|
||||
|
||||
/* static */ char *ScriptVehicle::GetName(VehicleID vehicle_id)
|
||||
/* static */ std::optional<std::string> ScriptVehicle::GetName(VehicleID vehicle_id)
|
||||
{
|
||||
if (!IsPrimaryVehicle(vehicle_id)) return nullptr;
|
||||
if (!IsPrimaryVehicle(vehicle_id)) return std::nullopt;
|
||||
|
||||
::SetDParam(0, vehicle_id);
|
||||
return GetString(STR_VEHICLE_NAME);
|
||||
|
||||
Reference in New Issue
Block a user