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

@@ -24,6 +24,7 @@
#include "newgrf_generic.h"
#include "date_func.h"
#include "tree_cmd.h"
#include "landscape_cmd.h"
#include "table/strings.h"
#include "table/tree_land.h"
@@ -461,7 +462,7 @@ CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
switch (GetRawClearGround(current_tile)) {
case CLEAR_FIELDS:
case CLEAR_ROCKS: {
CommandCost ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, current_tile, 0, 0);
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, current_tile, 0, 0, {});
if (ret.Failed()) return ret;
cost.AddCost(ret);
break;
@@ -882,7 +883,7 @@ void InitializeTrees()
static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
{
return DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
}