Codechange: Template DoCommand to automagically reflect the parameters of the command proc.

When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
This commit is contained in:
Michael Lutz
2021-10-30 01:31:46 +02:00
parent c88b104ec6
commit e740c24eb7
39 changed files with 320 additions and 229 deletions

View File

@@ -9,13 +9,13 @@
#include "../../stdafx.h"
#include "../../script/squirrel.hpp"
#include "../../command_func.h"
#include "../../company_func.h"
#include "../../company_base.h"
#include "../../network/network.h"
#include "../../genworld.h"
#include "../../string_func.h"
#include "../../strings_func.h"
#include "../../command_func.h"
#include "../script_storage.hpp"
#include "../script_instance.hpp"

View File

@@ -20,6 +20,7 @@
#include "../../train.h"
#include "../../vehicle_func.h"
#include "../../aircraft.h"
#include "../../vehicle_cmd.h"
#include "table/strings.h"
#include "../../safeguards.h"
@@ -91,7 +92,7 @@
if (!ScriptEngine::IsBuildable(engine_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
CommandCost res = ::DoCommand(DC_QUERY_COST, CMD_BUILD_VEHICLE, depot, engine_id | (cargo << 24), 0);
CommandCost res = ::Command<CMD_BUILD_VEHICLE>::Do(DC_QUERY_COST, depot, engine_id | (cargo << 24), 0, {});
return res.Succeeded() ? _returned_refit_capacity : -1;
}
@@ -140,7 +141,7 @@
if (!IsValidVehicle(vehicle_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
CommandCost res = ::DoCommand(DC_QUERY_COST, CMD_REFIT_VEHICLE, 0, vehicle_id, cargo);
CommandCost res = ::Command<CMD_REFIT_VEHICLE>::Do(DC_QUERY_COST, 0, vehicle_id, cargo, {});
return res.Succeeded() ? _returned_refit_capacity : -1;
}