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

@@ -357,12 +357,12 @@ CommandCost CmdDeleteGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint3
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
/* Remove all vehicles from the group */
DoCommand(flags, CMD_REMOVE_ALL_VEHICLES_GROUP, 0, p1, 0);
Command<CMD_REMOVE_ALL_VEHICLES_GROUP>::Do(flags, 0, p1, 0, {});
/* Delete sub-groups */
for (const Group *gp : Group::Iterate()) {
if (gp->parent == g->index) {
DoCommand(flags, CMD_DELETE_GROUP, 0, gp->index, 0);
Command<CMD_DELETE_GROUP>::Do(flags, 0, gp->index, 0, {});
}
}
@@ -581,7 +581,7 @@ CommandCost CmdAddSharedVehicleGroup(DoCommandFlag flags, TileIndex tile, uint32
/* For each shared vehicles add it to the group */
for (Vehicle *v2 = v->FirstShared(); v2 != nullptr; v2 = v2->NextShared()) {
if (v2->group_id != id_g) DoCommand(flags, CMD_ADD_VEHICLE_GROUP, tile, id_g, v2->index, text);
if (v2->group_id != id_g) Command<CMD_ADD_VEHICLE_GROUP>::Do(flags, tile, id_g, v2->index, text);
}
}
}
@@ -617,7 +617,7 @@ CommandCost CmdRemoveAllVehiclesGroup(DoCommandFlag flags, TileIndex tile, uint3
if (v->group_id != old_g) continue;
/* Add The Vehicle to the default group */
DoCommand(flags, CMD_ADD_VEHICLE_GROUP, tile, DEFAULT_GROUP, v->index, text);
Command<CMD_ADD_VEHICLE_GROUP>::Do(flags,tile, DEFAULT_GROUP, v->index, text);
}
}