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

@@ -45,6 +45,7 @@
#include "company_base.h"
#include "core/random_func.hpp"
#include "core/backup_type.hpp"
#include "landscape_cmd.h"
#include "table/strings.h"
@@ -61,7 +62,7 @@ static void DisasterClearSquare(TileIndex tile)
case MP_RAILWAY:
if (Company::IsHumanID(GetTileOwner(tile)) && !IsRailDepot(tile)) {
Backup<CompanyID> cur_company(_current_company, OWNER_WATER, FILE_LINE);
DoCommand(DC_EXEC, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {});
cur_company.Restore();
/* update signals in buffer */
@@ -71,7 +72,7 @@ static void DisasterClearSquare(TileIndex tile)
case MP_HOUSE: {
Backup<CompanyID> cur_company(_current_company, OWNER_NONE, FILE_LINE);
DoCommand(DC_EXEC, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC, tile, 0, 0, {});
cur_company.Restore();
break;
}