summaryrefslogtreecommitdiff
path: root/src/script/api/script_vehicle.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-11-30 23:21:16 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit41fa16f3254ffa9f44b85d6570a2293e8438b427 (patch)
treea508634b7dea7a0937e92c143db0a392cd99a4b0 /src/script/api/script_vehicle.cpp
parent57b82e2e99aa30a649d1fd80f192ccf5338dc7c4 (diff)
downloadopenttd-41fa16f3254ffa9f44b85d6570a2293e8438b427.tar.xz
Codechange: Don't use globals for return values from vehicle command procs.
Diffstat (limited to 'src/script/api/script_vehicle.cpp')
-rw-r--r--src/script/api/script_vehicle.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/api/script_vehicle.cpp b/src/script/api/script_vehicle.cpp
index c92502661..b7b5fd950 100644
--- a/src/script/api/script_vehicle.cpp
+++ b/src/script/api/script_vehicle.cpp
@@ -94,8 +94,8 @@
if (!ScriptEngine::IsBuildable(engine_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
- CommandCost res = ::Command<CMD_BUILD_VEHICLE>::Do(DC_QUERY_COST, depot, engine_id, true, cargo, INVALID_CLIENT_ID);
- return res.Succeeded() ? _returned_refit_capacity : -1;
+ auto [res, veh_id, refit_capacity, refit_mail] = ::Command<CMD_BUILD_VEHICLE>::Do(DC_QUERY_COST, depot, engine_id, true, cargo, INVALID_CLIENT_ID);
+ return res.Succeeded() ? refit_capacity : -1;
}
/* static */ VehicleID ScriptVehicle::CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders)
@@ -143,8 +143,8 @@
if (!IsValidVehicle(vehicle_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
- CommandCost res = ::Command<CMD_REFIT_VEHICLE>::Do(DC_QUERY_COST, vehicle_id, cargo, 0, false, false, 0);
- return res.Succeeded() ? _returned_refit_capacity : -1;
+ auto [res, refit_capacity, refit_mail] = ::Command<CMD_REFIT_VEHICLE>::Do(DC_QUERY_COST, vehicle_id, cargo, 0, false, false, 0);
+ return res.Succeeded() ? refit_capacity : -1;
}
/* static */ bool ScriptVehicle::RefitVehicle(VehicleID vehicle_id, CargoID cargo)