summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp8
-rw-r--r--src/autoreplace.cpp4
-rw-r--r--src/autoreplace_cmd.cpp10
-rw-r--r--src/autoreplace_func.h8
-rw-r--r--src/bridge.h2
-rw-r--r--src/clear_cmd.cpp4
-rw-r--r--src/command.cpp8
-rw-r--r--src/command_func.h8
-rw-r--r--src/command_type.h6
-rw-r--r--src/company_cmd.cpp4
-rw-r--r--src/dummy_land.cpp4
-rw-r--r--src/economy.cpp6
-rw-r--r--src/engine.cpp4
-rw-r--r--src/group_cmd.cpp14
-rw-r--r--src/industry_cmd.cpp14
-rw-r--r--src/landscape.cpp4
-rw-r--r--src/misc_cmd.cpp18
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/order_cmd.cpp18
-rw-r--r--src/rail_cmd.cpp30
-rw-r--r--src/road_cmd.cpp20
-rw-r--r--src/road_internal.h2
-rw-r--r--src/roadveh_cmd.cpp12
-rw-r--r--src/settings.cpp2
-rw-r--r--src/ship_cmd.cpp8
-rw-r--r--src/signs.cpp4
-rw-r--r--src/station_cmd.cpp36
-rw-r--r--src/terraform_cmd.cpp4
-rw-r--r--src/tile_cmd.h4
-rw-r--r--src/timetable_cmd.cpp6
-rw-r--r--src/town.h5
-rw-r--r--src/town_cmd.cpp14
-rw-r--r--src/train_cmd.cpp16
-rw-r--r--src/tree_cmd.cpp6
-rw-r--r--src/tunnelbridge_cmd.cpp14
-rw-r--r--src/unmovable_cmd.cpp14
-rw-r--r--src/vehicle.cpp18
-rw-r--r--src/vehicle_base.h2
-rw-r--r--src/vehicle_func.h2
-rw-r--r--src/water_cmd.cpp16
-rw-r--r--src/waypoint.cpp8
-rw-r--r--src/waypoint.h2
42 files changed, 197 insertions, 194 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index a8d4355f4..200e83653 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -246,7 +246,7 @@ uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi)
* @param p2 unused
* return result of operation. Could be cost, error
*/
-CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsEngineBuildable(p1, VEH_AIRCRAFT, _current_company)) return_cmd_error(STR_AIRCRAFT_NOT_AVAILABLE);
@@ -449,7 +449,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
* @param p2 unused
* @return result of operation. Error or sold value
*/
-CommandCost CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSellAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidVehicleID(p1)) return CMD_ERROR;
@@ -497,7 +497,7 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination,
* - p2 bit 8-10 - VLW flag (for mass goto depot)
* @return o if everything went well
*/
-CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSendAircraftToHangar(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
@@ -525,7 +525,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
* - p2 = (bit 16) - refit only this vehicle (ignored)
* @return cost of refit or error
*/
-CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRefitAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
byte new_subtype = GB(p2, 8, 8);
diff --git a/src/autoreplace.cpp b/src/autoreplace.cpp
index f37731d14..fe9359c01 100644
--- a/src/autoreplace.cpp
+++ b/src/autoreplace.cpp
@@ -47,7 +47,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group)
return er == NULL ? INVALID_ENGINE : er->to;
}
-CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags)
+CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags)
{
EngineRenew *er;
@@ -72,7 +72,7 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
return CommandCost();
}
-CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, uint32 flags)
+CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags)
{
EngineRenew *er = (EngineRenew *)(*erl);
EngineRenew *prev = NULL;
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 3cad32e25..af7cd1f65 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -292,7 +292,7 @@ static inline CommandCost StartStopVehicle(const Vehicle *v, bool evaluate_callb
* @param whole_chain move all vehicles following 'v' (true), or only 'v' (false)
* @return success or error
*/
-static inline CommandCost MoveVehicle(const Vehicle *v, const Vehicle *after, uint32 flags, bool whole_chain)
+static inline CommandCost MoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
{
return DoCommand(0, v->index | (after != NULL ? after->index : INVALID_VEHICLE) << 16, whole_chain ? 1 : 0, flags, CMD_MOVE_RAIL_VEHICLE);
}
@@ -302,7 +302,7 @@ static inline CommandCost MoveVehicle(const Vehicle *v, const Vehicle *after, ui
* @param new_head The new head of the completely replaced vehicle chain
* @param flags the command flags to use
*/
-static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, uint32 flags)
+static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, DoCommandFlag flags)
{
CommandCost cost = CommandCost();
@@ -346,7 +346,7 @@ static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head,
* @param nothing_to_do is set to 'false' when something was done (only valid when not failed)
* @return cost or error
*/
-static CommandCost ReplaceFreeUnit(Vehicle **single_unit, uint32 flags, bool *nothing_to_do)
+static CommandCost ReplaceFreeUnit(Vehicle **single_unit, DoCommandFlag flags, bool *nothing_to_do)
{
Vehicle *old_v = *single_unit;
assert(old_v->type == VEH_TRAIN && !IsArticulatedPart(old_v) && !IsRearDualheaded(old_v));
@@ -395,7 +395,7 @@ static CommandCost ReplaceFreeUnit(Vehicle **single_unit, uint32 flags, bool *no
* @param nothing_to_do is set to 'false' when something was done (only valid when not failed)
* @return cost or error
*/
-static CommandCost ReplaceChain(Vehicle **chain, uint32 flags, bool wagon_removal, bool *nothing_to_do)
+static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon_removal, bool *nothing_to_do)
{
Vehicle *old_head = *chain;
assert(old_head->IsPrimaryVehicle());
@@ -601,7 +601,7 @@ static CommandCost ReplaceChain(Vehicle **chain, uint32 flags, bool wagon_remova
* @param p1 Index of vehicle
* @param p2 not used
*/
-CommandCost CmdAutoreplaceVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES, 0);
bool nothing_to_do = true;
diff --git a/src/autoreplace_func.h b/src/autoreplace_func.h
index 5e1d777c1..266e91084 100644
--- a/src/autoreplace_func.h
+++ b/src/autoreplace_func.h
@@ -32,7 +32,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
* @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure.
*/
-CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags);
+CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags);
/**
* Remove an engine replacement from a given renewlist.
@@ -41,7 +41,7 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
* @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure.
*/
-CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, uint32 flags);
+CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags);
/**
* Remove all engine replacement settings for the given company.
@@ -83,7 +83,7 @@ static inline bool EngineHasReplacementForCompany(const Company *c, EngineID eng
* @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure.
*/
-static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags)
+static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags)
{
return AddEngineReplacement(&c->engine_renew_list, old_engine, new_engine, group, flags);
}
@@ -95,7 +95,7 @@ static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID ol
* @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure.
*/
-static inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine, GroupID group, uint32 flags)
+static inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine, GroupID group, DoCommandFlag flags)
{
return RemoveEngineReplacement(&c->engine_renew_list, engine, group, flags);
}
diff --git a/src/bridge.h b/src/bridge.h
index b037316d8..4b98673df 100644
--- a/src/bridge.h
+++ b/src/bridge.h
@@ -61,7 +61,7 @@ static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
void DrawBridgeMiddle(const TileInfo *ti);
-bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags = 0);
+bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags = DC_NONE);
int CalcBridgeLenCostFactor(int x);
void ResetBridges();
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 9892fe0b1..1f1a7a50c 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -20,7 +20,7 @@
#include "table/sprites.h"
#include "table/clear_land.h"
-static CommandCost ClearTile_Clear(TileIndex tile, byte flags)
+static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags)
{
static const Money *clear_price_table[] = {
&_price.clear_grass,
@@ -357,7 +357,7 @@ void InitializeClearLand()
_settings_game.game_creation.snow_line = _settings_game.game_creation.snow_line_height * TILE_HEIGHT;
}
-static CommandCost TerraformTile_Clear(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}
diff --git a/src/command.cpp b/src/command.cpp
index 4fae93588..c70c4fff2 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -34,7 +34,7 @@ StringID _error_message;
*
* @param yyyy The desired function name of the new command handler function.
*/
-#define DEF_COMMAND(yyyy) CommandCost yyyy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+#define DEF_COMMAND(yyyy) CommandCost yyyy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
DEF_COMMAND(CmdBuildRailroadTrack);
DEF_COMMAND(CmdRemoveRailroadTrack);
@@ -376,7 +376,7 @@ static int _docommand_recursive = 0;
* @see CommandProc
* @return the cost
*/
-CommandCost DoCommand(const CommandContainer *container, uint32 flags)
+CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
{
return DoCommand(container->tile, container->p1, container->p2, flags, container->cmd & CMD_ID_MASK, container->text);
}
@@ -393,7 +393,7 @@ CommandCost DoCommand(const CommandContainer *container, uint32 flags)
* @see CommandProc
* @return the cost
*/
-CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, const char *text)
+CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text)
{
CommandCost res;
@@ -520,7 +520,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Command flags are used internally */
uint cmd_flags = GetCommandFlags(cmd);
/* Flags get send to the DoCommand */
- uint32 flags = CommandFlagsToDCFlags(cmd_flags);
+ DoCommandFlag flags = CommandFlagsToDCFlags(cmd_flags);
/* Do not even think about executing out-of-bounds tile-commands */
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return false;
diff --git a/src/command_func.h b/src/command_func.h
index d588ef807..b34780b27 100644
--- a/src/command_func.h
+++ b/src/command_func.h
@@ -53,8 +53,8 @@ static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID);
/**
* Execute a command
*/
-CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, const char *text = NULL);
-CommandCost DoCommand(const CommandContainer *container, uint32 flags);
+CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text = NULL);
+CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags);
/**
* Execute a network safe DoCommand function
@@ -91,9 +91,9 @@ Money GetAvailableMoneyForCommand();
* @param cmd_flags Flags from GetCommandFlags
* @return flags for DoCommand
*/
-static inline uint32 CommandFlagsToDCFlags(uint cmd_flags)
+static inline DoCommandFlag CommandFlagsToDCFlags(uint cmd_flags)
{
- uint32 flags = 0;
+ DoCommandFlag flags = DC_NONE;
if (cmd_flags & CMD_NO_WATER) flags |= DC_NO_WATER;
if (cmd_flags & CMD_AUTO) flags |= DC_AUTO;
if (cmd_flags & CMD_ALL_TILES) flags |= DC_ALL_TILES;
diff --git a/src/command_type.h b/src/command_type.h
index 6486aa30c..a94517563 100644
--- a/src/command_type.h
+++ b/src/command_type.h
@@ -293,7 +293,8 @@ enum {
*
* This enums defines some flags which can be used for the commands.
*/
-enum {
+enum DoCommandFlag {
+ DC_NONE = 0x000, ///< no flag is set
DC_EXEC = 0x001, ///< execute the given command
DC_AUTO = 0x002, ///< don't allow building on structures
DC_QUERY_COST = 0x004, ///< query cost only, don't build.
@@ -304,6 +305,7 @@ enum {
DC_AUTOREPLACE = 0x080, ///< autoreplace/autorenew is in progress, this shall disable vehicle limits when building, and ignore certain restrictions when undoing things (like vehicle attach callback)
DC_ALL_TILES = 0x100, ///< allow this command also on MP_VOID tiles
};
+DECLARE_ENUM_AS_BIT_SET(DoCommandFlag);
/**
* Used to combine a StringID with the command.
@@ -361,7 +363,7 @@ enum {
* @param text Additional text
* @return The CommandCost of the command, which can be succeeded or failed.
*/
-typedef CommandCost CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text);
+typedef CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text);
/**
* Define a command with the flags which belongs to it.
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index f86d9cad2..407abd425 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -568,7 +568,7 @@ void CompaniesYearlyLoop()
* if p1 = 5, then
* - p2 = enable renew_keep_length
*/
-CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidCompanyID(_current_company)) return CMD_ERROR;
@@ -711,7 +711,7 @@ void CompanyNewsInformation::FillData(const Company *c, const Company *other)
* @arg - network_server.c:838 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)@n
* @arg - network_client.c:536 DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) from where the map has been received
*/
-CommandCost CmdCompanyCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (flags & DC_EXEC) _current_company = OWNER_NONE;
diff --git a/src/dummy_land.cpp b/src/dummy_land.cpp
index c28952fea..6968e3cc9 100644
--- a/src/dummy_land.cpp
+++ b/src/dummy_land.cpp
@@ -26,7 +26,7 @@ static Foundation GetFoundation_Dummy(TileIndex tile, Slope tileh)
return FOUNDATION_NONE;
}
-static CommandCost ClearTile_Dummy(TileIndex tile, byte flags)
+static CommandCost ClearTile_Dummy(TileIndex tile, DoCommandFlag flags)
{
return_cmd_error(STR_0001_OFF_EDGE_OF_MAP);
}
@@ -69,7 +69,7 @@ static TrackStatus GetTileTrackStatus_Dummy(TileIndex tile, TransportType mode,
return 0;
}
-static CommandCost TerraformTile_Dummy(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Dummy(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
return_cmd_error(STR_0001_OFF_EDGE_OF_MAP);
}
diff --git a/src/economy.cpp b/src/economy.cpp
index c157b0271..91e0bdfa2 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1856,7 +1856,7 @@ extern int GetAmountOwnedBy(const Company *c, Owner owner);
* @param p1 company to buy the shares from
* @param p2 unused
*/
-CommandCost CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_OTHER);
@@ -1901,7 +1901,7 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32
* @param p1 company to sell the shares from
* @param p2 unused
*/
-CommandCost CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Check if selling shares is allowed (protection against modified clients) */
/* Cannot sell own shares */
@@ -1934,7 +1934,7 @@ CommandCost CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint3
* @param p1 company to buy up
* @param p2 unused
*/
-CommandCost CmdBuyCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CompanyID cid = (CompanyID)p1;
diff --git a/src/engine.cpp b/src/engine.cpp
index b11af2e10..499ac399d 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -467,7 +467,7 @@ void EnginesDailyLoop()
* @param p1 engine-prototype offered
* @param p2 unused
*/
-CommandCost CmdWantEnginePreview(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Engine *e;
@@ -581,7 +581,7 @@ static bool IsUniqueEngineName(const char *name)
* @param p1 engine ID to rename
* @param p2 unused
*/
-CommandCost CmdRenameEngine(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameEngine(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsEngineIndex(p1)) return CMD_ERROR;
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 6ec8f5f29..6b3242cfa 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -75,7 +75,7 @@ void InitializeGroup(void)
* @param p1 vehicle type
* @param p2 unused
*/
-CommandCost CmdCreateGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleType vt = (VehicleType)p1;
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
@@ -103,7 +103,7 @@ CommandCost CmdCreateGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
* - p1 bit 0-15 : GroupID
* @param p2 unused
*/
-CommandCost CmdDeleteGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidGroupID(p1)) return CMD_ERROR;
@@ -162,7 +162,7 @@ static bool IsUniqueGroupName(const char *name)
* - p1 bit 0-15 : GroupID
* @param p2 unused
*/
-CommandCost CmdRenameGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidGroupID(p1)) return CMD_ERROR;
@@ -197,7 +197,7 @@ CommandCost CmdRenameGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
* @param p2 vehicle to add to a group
* - p2 bit 0-15 : VehicleID
*/
-CommandCost CmdAddVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
GroupID new_g = p1;
@@ -244,7 +244,7 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* - p1 bit 0-15 : GroupID
* @param p2 type of vehicles
*/
-CommandCost CmdAddSharedVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleType type = (VehicleType)p2;
if (!IsValidGroupID(p1) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR;
@@ -281,7 +281,7 @@ CommandCost CmdAddSharedVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, ui
* - p1 bit 0-15 : GroupID
* @param p2 type of vehicles
*/
-CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleType type = (VehicleType)p2;
if (!IsValidGroupID(p1) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR;
@@ -318,7 +318,7 @@ CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, uint32 flags, uint32 p1, u
* @param p2
* - p2 bit 0 : 1 to set or 0 to clear protection.
*/
-CommandCost CmdSetGroupReplaceProtection(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetGroupReplaceProtection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidGroupID(p1)) return CMD_ERROR;
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 1eee2f936..63eb9ac6c 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -406,7 +406,7 @@ static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
}
}
-static CommandCost ClearTile_Industry(TileIndex tile, byte flags)
+static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
{
Industry *i = GetIndustryByTile(tile);
const IndustrySpec *indspec = GetIndustrySpec(i->type);
@@ -1262,7 +1262,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
CompanyID old_company = _current_company;
_current_company = OWNER_TOWN;
- bool not_clearable = CmdFailed(DoCommand(cur_tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR));
+ bool not_clearable = CmdFailed(DoCommand(cur_tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR));
_current_company = old_company;
if (not_clearable) return false;
@@ -1338,7 +1338,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
* This function tries to flatten out the land below an industry, without
* damaging the surroundings too much.
*/
-static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, uint32 flags, const IndustryTileTable *it, int type)
+static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileTable *it, int type)
{
const int MKEND = -0x80; // used for last element in an IndustryTileTable (see build_industry.h)
int max_x = 0;
@@ -1597,7 +1597,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
* @param seed random seed (possibly) used by industries
* @return the pointer of the newly created industry, or NULL if it failed
*/
-static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint32 flags, const IndustrySpec *indspec, uint itspec_index, uint32 seed)
+static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 seed)
{
const IndustryTileTable *it = indspec->table[itspec_index];
bool custom_shape_check = false;
@@ -1610,7 +1610,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
}
- if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
+ if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NONE, it, type)) return NULL;
if (!CheckIfFarEnoughFromIndustry(tile, type)) return NULL;
const Town *t = CheckMultipleIndustryInTown(tile, type);
@@ -1642,7 +1642,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
* @param p2 seed to use for variable 8F
* @return index of the newly create industry, or CMD_ERROR if it failed
*/
-CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
const IndustrySpec *indspec = GetIndustrySpec(GB(p1, 0, 16));
const Industry *ind = NULL;
@@ -2349,7 +2349,7 @@ Money IndustrySpec::GetRemovalCost() const
return (_price.remove_house * this->removal_cost_multiplier) >> 8;
}
-static CommandCost TerraformTile_Industry(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
if (AutoslopeEnabled()) {
/* We imitate here TTDP's behaviour:
diff --git a/src/landscape.cpp b/src/landscape.cpp
index d9a17e4ef..db0b30696 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -588,7 +588,7 @@ void ClearSnowLine(void)
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdLandscapeClear(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags);
}
@@ -599,7 +599,7 @@ CommandCost CmdLandscapeClear(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
* @param flags of operation to conduct
* @param p2 unused
*/
-CommandCost CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p1 >= MapSize()) return CMD_ERROR;
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index 34be4a675..d12b57743 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -28,7 +28,7 @@
* @param p1 unused
* @param p2 face bitmasked
*/
-CommandCost CmdSetCompanyManagerFace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CompanyManagerFace cmf = (CompanyManagerFace)p2;
@@ -49,7 +49,7 @@ CommandCost CmdSetCompanyManagerFace(TileIndex tile, uint32 flags, uint32 p1, ui
* p1 bits 8-9 set in use state or first/second colour
* @param p2 new colour for vehicles, property, etc.
*/
-CommandCost CmdSetCompanyColour(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p2 >= 16) return CMD_ERROR; // max 16 colours
@@ -130,7 +130,7 @@ CommandCost CmdSetCompanyColour(TileIndex tile, uint32 flags, uint32 p1, uint32
* when 1: loans the maximum loan permitting money (press CTRL),
* when 2: loans the amount specified in p1
*/
-CommandCost CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Company *c = GetCompany(_current_company);
@@ -174,7 +174,7 @@ CommandCost CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
* when 1: pays back the maximum loan permitting money (press CTRL),
* when 2: pays back the amount specified in p1
*/
-CommandCost CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Company *c = GetCompany(_current_company);
@@ -226,7 +226,7 @@ static bool IsUniqueCompanyName(const char *name)
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdRenameCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
bool reset = StrEmpty(text);
@@ -262,7 +262,7 @@ static bool IsUniquePresidentName(const char *name)
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdRenamePresident(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
bool reset = StrEmpty(text);
@@ -314,7 +314,7 @@ static void AskUnsafeUnpauseCallback(Window *w, bool confirmed)
* @param p1 0 = decrease pause counter; 1 = increase pause counter
* @param p2 unused
*/
-CommandCost CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (flags & DC_EXEC) {
_pause_game += (p1 == 0) ? -1 : 1;
@@ -350,7 +350,7 @@ CommandCost CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const c
* @param p1 the amount of money to receive (if negative), or spend (if positive)
* @param p2 unused
*/
-CommandCost CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdMoneyCheat(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
#ifndef _DEBUG
if (_networking) return CMD_ERROR;
@@ -367,7 +367,7 @@ CommandCost CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, co
* @param p1 the amount of money to transfer; max 20.000.000
* @param p2 the company to transfer the money to
*/
-CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!_settings_game.economy.give_money) return CMD_ERROR;
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index be1f8086c..ba1d3a1e9 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -94,7 +94,7 @@ public:
Money old_money = c->money;
c->money = INT64_MAX;
- CommandCost costclear = DoCommand(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
+ CommandCost costclear = DoCommand(tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
c->money = old_money;
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 30aeaa5b2..b980d1711 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -411,7 +411,7 @@ static uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle
* the maximum vehicle order id is 254.
* @param p2 packed order to insert
*/
-CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
VehicleID veh = GB(p1, 0, 16);
@@ -629,7 +629,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
* @param *dst delete the orders of this vehicle
* @param flags execution flags
*/
-static CommandCost DecloneOrder(Vehicle *dst, uint32 flags)
+static CommandCost DecloneOrder(Vehicle *dst, DoCommandFlag flags)
{
if (flags & DC_EXEC) {
DeleteVehicleOrders(dst);
@@ -645,7 +645,7 @@ static CommandCost DecloneOrder(Vehicle *dst, uint32 flags)
* @param p1 the ID of the vehicle
* @param p2 the order to delete (max 255)
*/
-CommandCost CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdDeleteOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
VehicleID veh_id = p1;
@@ -713,7 +713,7 @@ CommandCost CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
* @param p1 The ID of the vehicle which order is skipped
* @param p2 the selected order to which we want to skip
*/
-CommandCost CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
VehicleID veh_id = p1;
@@ -753,7 +753,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
* @note The target order will move one place down in the orderlist
* if you move the order upwards else it'll move it one place down
*/
-CommandCost CmdMoveOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleID veh = p1;
VehicleOrderID moving_order = GB(p2, 0, 16);
@@ -831,7 +831,7 @@ CommandCost CmdMoveOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
* - p2 = (bit 0 - 3) - what data to modify (@see ModifyOrderFlags)
* - p2 = (bit 4 - 15) - the data to modify
*/
-CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleOrderID sel_ord = GB(p1, 16, 16); // XXX - automatically truncated to 8 bits.
VehicleID veh = GB(p1, 0, 16);
@@ -1048,7 +1048,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
* - p1 = (bit 16-31) - source vehicle to clone orders from, if any (none for CO_UNSHARE)
* @param p2 mode of cloning: CO_SHARE, CO_COPY, or CO_UNSHARE
*/
-CommandCost CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *dst;
VehicleID veh_src = GB(p1, 16, 16);
@@ -1177,7 +1177,7 @@ CommandCost CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, co
* - bit 8-15 Cargo subtype
* - bit 16-23 number of order to modify
*/
-CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
const Vehicle *v;
Order *order;
@@ -1333,7 +1333,7 @@ void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *bak)
* If we do want to backup/restore it, just add UnitID uid to BackuppedOrders, and
* restore it as parameter 'y' (ugly hack I know) for example. "v->unitnumber = y;"
*/
-CommandCost CmdRestoreOrderIndex(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRestoreOrderIndex(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
VehicleOrderID cur_ord = GB(p2, 0, 16);
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 1786270ab..7d6725807 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -303,7 +303,7 @@ static inline bool ValParamTrackOrientation(Track track) {return IsValidTrack(tr
* @param p1 railtype of being built piece (normal, mono, maglev)
* @param p2 rail track to build
*/
-CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Slope tileh;
RailType railtype = (RailType)p1;
@@ -442,7 +442,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* @param p1 unused
* @param p2 rail orientation
*/
-CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)p2;
TrackBits trackbit;
@@ -668,7 +668,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
* - p2 = (bit 4-6) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
*/
-static CommandCost CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
Track track = (Track)GB(p2, 4, 3);
@@ -718,7 +718,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, u
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @see CmdRailTrackHelper
*/
-CommandCost CmdBuildRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdRailTrackHelper(tile, flags, p1, ClrBit(p2, 7), text);
}
@@ -734,7 +734,7 @@ CommandCost CmdBuildRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint3
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @see CmdRailTrackHelper
*/
-CommandCost CmdRemoveRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdRailTrackHelper(tile, flags, p1, SetBit(p2, 7), text);
}
@@ -748,7 +748,7 @@ CommandCost CmdRemoveRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint
* @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction"
*/
-CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Slope tileh;
@@ -812,7 +812,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* @param p2 used for CmdBuildManySignals() to copy direction of first signal
* TODO: p2 should be replaced by two bits for "along" and "against" the track.
*/
-CommandCost CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)GB(p1, 0, 3);
bool ctrl_pressed = HasBit(p1, 3); // was the CTRL button pressed
@@ -1024,7 +1024,7 @@ static bool CheckSignalAutoFill(TileIndex &tile, Trackdir &trackdir, int &signal
* - p2 = (bit 7- 9) - default signal type
* - p2 = (bit 24-31) - user defined signals_density
*/
-static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
int signal_ctr;
@@ -1150,7 +1150,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1,
* - p2 = (bit 24-31) - user defined signals_density
* @see CmdSignalTrackHelper
*/
-CommandCost CmdBuildSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdSignalTrackHelper(tile, flags, p1, p2,text);
}
@@ -1164,7 +1164,7 @@ CommandCost CmdBuildSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32
* - (bit 4) - 0 = signals, 1 = semaphores
* @param p2 unused
*/
-CommandCost CmdRemoveSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)GB(p1, 0, 3);
@@ -1219,7 +1219,7 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint3
* - p2 = (bit 24-31) - user defined signals_density
* @see CmdSignalTrackHelper
*/
-CommandCost CmdRemoveSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdSignalTrackHelper(tile, flags, p1, SetBit(p2, 5), text); // bit 5 is remove bit
}
@@ -1244,7 +1244,7 @@ Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
* @param p1 start tile of drag
* @param p2 new railtype to convert to
*/
-CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
RailType totype = (RailType)p2;
@@ -1417,7 +1417,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
return (cost.GetCost() == 0) ? CMD_ERROR : cost;
}
-static CommandCost RemoveTrainDepot(TileIndex tile, uint32 flags)
+static CommandCost RemoveTrainDepot(TileIndex tile, DoCommandFlag flags)
{
if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER)
return CMD_ERROR;
@@ -1446,7 +1446,7 @@ static CommandCost RemoveTrainDepot(TileIndex tile, uint32 flags)
return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot);
}
-static CommandCost ClearTile_Track(TileIndex tile, byte flags)
+static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
CommandCost ret;
@@ -2547,7 +2547,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol
return cost;
}
-static CommandCost TerraformTile_Track(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
uint z_old;
Slope tileh_old = GetTileSlope(tile, &z_old);
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 17f9f8f78..61b389540 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -112,7 +112,7 @@ Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
* @param town_check Shall the town rating checked/affected
* @return true when it is allowed to remove the road bits
*/
-bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, uint32 flags, bool town_check)
+bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, DoCommandFlag flags, bool town_check)
{
if (_game_mode == GM_EDITOR || remove == ROAD_NONE) return true;
@@ -170,7 +170,7 @@ bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType
* @param rt roadtype to remove
* @param crossing_check should we check if there is a tram track when we are removing road from crossing?
*/
-static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, RoadType rt, bool crossing_check, bool town_check = true)
+static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadType rt, bool crossing_check, bool town_check = true)
{
RoadTypes rts = GetRoadTypes(tile);
/* The tile doesn't have the given road type */
@@ -346,7 +346,7 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
* bit 4..5 road type
* @param p2 unused
*/
-CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
RoadType rt = (RoadType)GB(p1, 4, 2);
if (!IsValidRoadType(rt)) return CMD_ERROR;
@@ -440,7 +440,7 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
* bit 6..7 disallowed directions to toggle
* @param p2 the town that is building the road (0 if not applicable)
*/
-CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
@@ -683,7 +683,7 @@ do_clear:;
* - p2 = (bit 3 + 4) - road type
* - p2 = (bit 5) - set road direction
*/
-CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildLongRoad(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
bool had_bridge = false;
@@ -769,7 +769,7 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32
* - p2 = (bit 2) - direction: 0 = along x-axis, 1 = along y-axis (p2 & 4)
* - p2 = (bit 3 + 4) - road type
*/
-CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveLongRoad(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
@@ -834,7 +834,7 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint3
* @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction"
*/
-CommandCost CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
DiagDirection dir = Extract<DiagDirection, 0>(p1);
RoadType rt = (RoadType)GB(p1, 2, 2);
@@ -867,7 +867,7 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
return cost.AddCost(_price.build_road_depot);
}
-static CommandCost RemoveRoadDepot(TileIndex tile, uint32 flags)
+static CommandCost RemoveRoadDepot(TileIndex tile, DoCommandFlag flags)
{
if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER) return CMD_ERROR;
@@ -881,7 +881,7 @@ static CommandCost RemoveRoadDepot(TileIndex tile, uint32 flags)
return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_road_depot);
}
-static CommandCost ClearTile_Road(TileIndex tile, byte flags)
+static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
{
switch (GetRoadTileType(tile)) {
case ROAD_TILE_NORMAL: {
@@ -1588,7 +1588,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
}
}
-static CommandCost TerraformTile_Road(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
switch (GetRoadTileType(tile)) {
diff --git a/src/road_internal.h b/src/road_internal.h
index 9e3f3c510..9d3f782f4 100644
--- a/src/road_internal.h
+++ b/src/road_internal.h
@@ -25,7 +25,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb);
* @param town_check Shall the town rating checked/affected
* @return true when it is allowed to remove the road bits
*/
-bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, uint32 flags, bool town_check = true);
+bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, DoCommandFlag flags, bool town_check = true);
/**
* Draw the catenary for tram road bits
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 3bfb277ae..7027c94d9 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -158,7 +158,7 @@ void RoadVehUpdateCache(Vehicle *v)
* @param p1 bus/truck type being built (engine)
* @param p2 unused
*/
-CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
UnitID unit_num;
@@ -313,7 +313,7 @@ bool RoadVehicle::IsStoppedInDepot() const
* @param p1 vehicle ID to be sold
* @param p2 unused
*/
-CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSellRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
@@ -418,7 +418,7 @@ bool RoadVehicle::FindClosestDepot(TileIndex *location, DestinationID *destinati
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot)
*/
-CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSendRoadVehToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
@@ -441,7 +441,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
* @param p1 vehicle ID to turn
* @param p2 unused
*/
-CommandCost CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
@@ -1336,7 +1336,7 @@ static bool CanBuildTramTrackOnTile(CompanyID c, TileIndex t, RoadBits r)
CompanyID original_company = _current_company;
_current_company = c;
- CommandCost ret = DoCommand(t, ROADTYPE_TRAM << 4 | r, 0, 0, CMD_BUILD_ROAD);
+ CommandCost ret = DoCommand(t, ROADTYPE_TRAM << 4 | r, 0, DC_NONE, CMD_BUILD_ROAD);
_current_company = original_company;
return CmdSucceeded(ret);
@@ -1984,7 +1984,7 @@ void RoadVehicle::OnNewDay()
* - p2 = (bit 16) - refit only this vehicle
* @return cost of refit or error
*/
-CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRefitRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
CommandCost cost(EXPENSES_ROADVEH_RUN);
diff --git a/src/settings.cpp b/src/settings.cpp
index 4460e25fd..5102d4a59 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1973,7 +1973,7 @@ static const SettingDesc *GetSettingDescription(uint index)
* The new value is properly clamped to its minimum/maximum when setting
* @see _settings
*/
-CommandCost CmdChangeSetting(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
const SettingDesc *sd = GetSettingDescription(p1);
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 9dfa6c0d8..a7106e30f 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -728,7 +728,7 @@ void Ship::Tick()
* @param p1 ship type being built (engine)
* @param p2 unused
*/
-CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
UnitID unit_num;
@@ -820,7 +820,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
* @param p1 vehicle ID to be sold
* @param p2 unused
*/
-CommandCost CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSellShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
@@ -865,7 +865,7 @@ bool Ship::FindClosestDepot(TileIndex *location, DestinationID *destination, boo
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot)
*/
-CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSendShipToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
@@ -893,7 +893,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* - p2 = (bit 16) - refit only this vehicle (ignored)
* @return cost of refit or error
*/
-CommandCost CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRefitShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v;
CommandCost cost(EXPENSES_SHIP_RUN);
diff --git a/src/signs.cpp b/src/signs.cpp
index 267fa5e24..deb4f5d88 100644
--- a/src/signs.cpp
+++ b/src/signs.cpp
@@ -90,7 +90,7 @@ static void MarkSignDirty(Sign *si)
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Try to locate a new sign */
if (!Sign::CanAllocateItem()) return_cmd_error(STR_2808_TOO_MANY_SIGNS);
@@ -128,7 +128,7 @@ CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
* @param p2 unused
* @return 0 if succesfull, otherwise CMD_ERROR
*/
-CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidSignID(p1)) return CMD_ERROR;
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 103aadeeb..62760f318 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -696,7 +696,7 @@ static void DeleteStationIfEmpty(Station *st)
UpdateStationSignCoord(st);
}
-static CommandCost ClearTile_Station(TileIndex tile, byte flags);
+static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
/** Tries to clear the given area.
* @param tile TileIndex to start check
@@ -708,7 +708,7 @@ static CommandCost ClearTile_Station(TileIndex tile, byte flags);
* @param check_clear if clearing tile should be performed (in wich case, cost will be added)
* @return the cost in case of success, or an error code if it failed.
*/
-CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID *station, bool check_clear = true)
+CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag flags, uint invalid_dirs, StationID *station, bool check_clear = true)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
int allowed_z = -1;
@@ -900,7 +900,7 @@ static void GetStationLayout(byte *layout, int numtracks, int plat_len, const St
* - p2 = (bit 8-15) - custom station id
* - p2 = (bit 16-31) - station ID to join (INVALID_STATION if build new one)
*/
-CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Does the authority allow this? */
if (!CheckIfAuthorityAllowsNewStation(tile_org, flags)) return CMD_ERROR;
@@ -1192,7 +1192,7 @@ restart:
* @param p1 start_tile
* @param p2 unused
*/
-CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
TileIndex start = p1 == 0 ? tile : p1;
@@ -1297,7 +1297,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
}
-static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
+static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, DoCommandFlag flags)
{
/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) {
@@ -1395,7 +1395,7 @@ static RoadStop **FindRoadStopSpot(bool truck_station, Station *st)
* bit 5: allow stations directly adjacent to other stations.
* bit 16..31: station ID to join (INVALID_STATION if build new one)
*/
-CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
bool type = HasBit(p2, 0);
bool is_drive_through = HasBit(p2, 1);
@@ -1544,7 +1544,7 @@ static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *)
* @param tile TileIndex been queried
* @return cost or failure of operation
*/
-static CommandCost RemoveRoadStop(Station *st, uint32 flags, TileIndex tile)
+static CommandCost RemoveRoadStop(Station *st, DoCommandFlag flags, TileIndex tile)
{
if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) {
return CMD_ERROR;
@@ -1617,7 +1617,7 @@ static CommandCost RemoveRoadStop(Station *st, uint32 flags, TileIndex tile)
* @param p1 not used
* @param p2 bit 0: 0 for Bus stops, 1 for truck stops
*/
-CommandCost CmdRemoveRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Make sure the specified tile is a road stop of the correct type */
if (!IsTileType(tile, MP_STATION) || !IsRoadStop(tile) || (uint32)GetRoadStopType(tile) != GB(p2, 0, 1)) return CMD_ERROR;
@@ -1847,7 +1847,7 @@ void UpdateAirportsNoise()
* - p2 = (bit 0) - allow airports directly adjacent to other airports.
* - p2 = (bit 16-31) - station ID to join (INVALID_STATION if build new one)
*/
-CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
bool airport_upgrade = true;
StationID station_to_join = GB(p2, 16, 16);
@@ -1991,7 +1991,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
return cost;
}
-static CommandCost RemoveAirport(Station *st, uint32 flags)
+static CommandCost RemoveAirport(Station *st, DoCommandFlag flags)
{
if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) {
return CMD_ERROR;
@@ -2058,7 +2058,7 @@ static CommandCost RemoveAirport(Station *st, uint32 flags)
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsWaterTile(tile) || tile == 0) return_cmd_error(STR_304B_SITE_UNSUITABLE);
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
@@ -2120,7 +2120,7 @@ bool HasStationInUse(StationID station, CompanyID company)
return false;
}
-static CommandCost RemoveBuoy(Station *st, uint32 flags)
+static CommandCost RemoveBuoy(Station *st, DoCommandFlag flags)
{
/* XXX: strange stuff */
if (!IsValidCompanyID(_current_company)) return_cmd_error(INVALID_STRING_ID);
@@ -2168,7 +2168,7 @@ static const byte _dock_h_chk[4] = { 1, 2, 1, 2 };
* @param p1 (bit 0) - allow docks directly adjacent to other docks.
* @param p2 bit 16-31: station ID to join (INVALID_STATION if build new one)
*/
-CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
StationID station_to_join = GB(p2, 16, 16);
bool distant_join = (station_to_join != INVALID_STATION);
@@ -2269,7 +2269,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
return CommandCost(EXPENSES_CONSTRUCTION, _price.build_dock);
}
-static CommandCost RemoveDock(Station *st, uint32 flags)
+static CommandCost RemoveDock(Station *st, DoCommandFlag flags)
{
if (!CheckOwnership(st->owner)) return CMD_ERROR;
@@ -2917,7 +2917,7 @@ static bool IsUniqueStationName(const char *name)
* @param p1 station ID that is to be renamed
* @param p2 unused
*/
-CommandCost CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidStationID(p1)) return CMD_ERROR;
@@ -3174,7 +3174,7 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
* @param flags command flags
* @return true if the road can be cleared
*/
-static bool CanRemoveRoadWithStop(TileIndex tile, uint32 flags)
+static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
{
/* The road can always be cleared if it was not a town-owned road */
if (!GetStopBuiltOnTownRoad(tile)) return true;
@@ -3182,7 +3182,7 @@ static bool CanRemoveRoadWithStop(TileIndex tile, uint32 flags)
return CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, ROADTYPE_ROAD, flags);
}
-static CommandCost ClearTile_Station(TileIndex tile, byte flags)
+static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
{
if (flags & DC_AUTO) {
switch (GetStationType(tile)) {
@@ -3232,7 +3232,7 @@ void InitializeStations()
_station_tick_ctr = 0;
}
-static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp
index c67312973..22e4f905d 100644
--- a/src/terraform_cmd.cpp
+++ b/src/terraform_cmd.cpp
@@ -228,7 +228,7 @@ static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int
* @param p2 direction; eg up (non-zero) or down (zero)
* @return error or cost of terraforming
*/
-CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
_terraform_err_tile = INVALID_TILE;
@@ -354,7 +354,7 @@ CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
* @param p2 height difference; eg raise (+1), lower (-1) or level (0)
* @return error or cost of terraforming
*/
-CommandCost CmdLevelLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdLevelLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p1 >= MapSize()) return CMD_ERROR;
diff --git a/src/tile_cmd.h b/src/tile_cmd.h
index c7a09eb79..e7c178778 100644
--- a/src/tile_cmd.h
+++ b/src/tile_cmd.h
@@ -66,7 +66,7 @@ struct TileDesc {
*/
typedef void DrawTileProc(TileInfo *ti);
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
-typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
+typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
/**
* Tile callback function signature for obtaining accepted carog of a tile
@@ -127,7 +127,7 @@ typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
* @param tileh_new Slope after terraforming.
* @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
*/
-typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
+typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new);
/**
* Set of callback functions for performing tile operations of a given tile type.
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 030ca63c8..4ecfc4947 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -52,7 +52,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
* Travelling time if p1 bit 25 is set.
* - p2 = (bit 16-31) - Waiting time if p1 bit 25 is set
*/
-CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!_settings_game.order.timetabling) return CMD_ERROR;
@@ -110,7 +110,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* @param p1 Various bitstuffed elements
* - p1 = (bit 0-15) - Vehicle with the orders to change.
*/
-CommandCost CmdSetVehicleOnTime(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!_settings_game.order.timetabling) return CMD_ERROR;
@@ -138,7 +138,7 @@ CommandCost CmdSetVehicleOnTime(TileIndex tile, uint32 flags, uint32 p1, uint32
* - p2 = (bit 0) - Set to 1 to enable, 0 to disable autofill.
* - p2 = (bit 1) - Set to 1 to preserve waiting times in non-destructive mode
*/
-CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!_settings_game.order.timetabling) return CMD_ERROR;
diff --git a/src/town.h b/src/town.h
index 9d0240c5d..2aac3bd4e 100644
--- a/src/town.h
+++ b/src/town.h
@@ -18,6 +18,7 @@
#include "viewport_type.h"
#include "economy_type.h"
#include "map_type.h"
+#include "command_type.h"
enum {
HOUSE_NO_CLASS = 0,
@@ -280,7 +281,7 @@ enum {
TOWN_HAS_STADIUM = 2 ///< There can be only one stadium by town.
};
-bool CheckforTownRating(uint32 flags, Town *t, byte type);
+bool CheckforTownRating(DoCommandFlag flags, Town *t, byte type);
static inline HouseSpec *GetHouseSpecs(HouseID house_id)
{
@@ -352,7 +353,7 @@ void ResetHouses();
void ClearTownHouse(Town *t, TileIndex tile);
void UpdateTownMaxPass(Town *t);
void UpdateTownRadius(Town *t);
-bool CheckIfAuthorityAllowsNewStation(TileIndex tile, uint32 flags);
+bool CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags);
Town *ClosestTownFromTile(TileIndex tile, uint threshold);
void ChangeTownRating(Town *t, int add, int max);
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile);
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 36442ad1d..a03f50623 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -516,7 +516,7 @@ static bool ClickTile_Town(TileIndex tile)
return false;
}
-static CommandCost ClearTile_Town(TileIndex tile, byte flags)
+static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags)
{
if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
if (!CanDeleteHouse(tile)) return CMD_ERROR;
@@ -1510,7 +1510,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
* 3..5 town road layout (@see TownLayout)
* @param p2 unused
*/
-CommandCost CmdBuildTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Only in the scenario editor */
if (_game_mode != GM_EDITOR) return CMD_ERROR;
@@ -2098,7 +2098,7 @@ static bool IsUniqueTownName(const char *name)
* @param p1 town ID to rename
* @param p2 unused
*/
-CommandCost CmdRenameTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidTownID(p1)) return CMD_ERROR;
@@ -2368,7 +2368,7 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
* @param p1 town to do the action at
* @param p2 action to perform, @see _town_action_proc for the list of available actions
*/
-CommandCost CmdDoTownAction(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
@@ -2497,7 +2497,7 @@ static void UpdateTownUnwanted(Town *t)
* @param tile The tile where the station shall be constructed.
* @param flags Command flags. DC_NO_TOWN_RATING is tested.
*/
-bool CheckIfAuthorityAllowsNewStation(TileIndex tile, uint32 flags)
+bool CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
{
if (!IsValidCompanyID(_current_company) || (flags & DC_NO_TOWN_RATING)) return true;
@@ -2630,7 +2630,7 @@ static const int _default_rating_settings [3][3] = {
{ 96, 384, 768}, // Hostile
};
-bool CheckforTownRating(uint32 flags, Town *t, byte type)
+bool CheckforTownRating(DoCommandFlag flags, Town *t, byte type)
{
/* if magic_bulldozer cheat is active, town doesn't restrict your destructive actions */
if (t == NULL || !IsValidCompanyID(_current_company) || _cheats.magic_bulldozer.value)
@@ -2692,7 +2692,7 @@ void InitializeTowns()
_total_towns = 0;
}
-static CommandCost TerraformTile_Town(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
if (AutoslopeEnabled()) {
HouseID house = GetHouseType(tile);
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 6678e326f..810cee1b0 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -579,7 +579,7 @@ void DrawTrainEngine(int x, int y, EngineID engine, SpriteID pal)
}
}
-static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
+static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, DoCommandFlag flags)
{
const RailVehicleInfo *rvi = RailVehInfo(engine);
CommandCost value(EXPENSES_NEW_VEHICLES, GetEngine(engine)->GetCost());
@@ -725,7 +725,7 @@ static void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool buildin
* @param p1 engine type id
* @param p2 bit 1 prevents any free cars from being added to the train
*/
-CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Check if the engine-type is valid (for the company) */
if (!IsEngineBuildable(p1, VEH_TRAIN, _current_company)) return_cmd_error(STR_RAIL_VEHICLE_NOT_AVAILABLE);
@@ -988,7 +988,7 @@ static void NormaliseTrainConsist(Vehicle *v)
* - p1 (bit 16 - 31) what wagon to put the source wagon AFTER, XXX - INVALID_VEHICLE to make a new line
* @param p2 (bit 0) move all vehicles following the source vehicle
*/
-CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleID s = GB(p1, 0, 16);
VehicleID d = GB(p1, 16, 16);
@@ -1343,7 +1343,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* - p2 = 1: sell the vehicle and all vehicles following it in the chain
* if the wagon is dragged, don't delete the possibly belonging rear-engine to some front
*/
-CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSellRailWagon(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Check if we deleted a vehicle window */
Window *w = NULL;
@@ -1905,7 +1905,7 @@ static void ReverseTrainDirection(Vehicle *v)
* @param p1 train to reverse
* @param p2 if true, reverse a unit in a train (needs to be in a depot)
*/
-CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidVehicleID(p1)) return CMD_ERROR;
@@ -1955,7 +1955,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, ui
* @param p1 train to ignore the red signal
* @param p2 unused
*/
-CommandCost CmdForceTrainProceed(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdForceTrainProceed(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidVehicleID(p1)) return CMD_ERROR;
@@ -1978,7 +1978,7 @@ CommandCost CmdForceTrainProceed(TileIndex tile, uint32 flags, uint32 p1, uint32
* - p2 = (bit 16) - refit only this vehicle
* @return cost of refit or error
*/
-CommandCost CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRefitRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CargoID new_cid = GB(p2, 0, 8);
byte new_subtype = GB(p2, 8, 8);
@@ -2182,7 +2182,7 @@ bool Train::FindClosestDepot(TileIndex *location, DestinationID *destination, bo
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot)
*/
-CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSendTrainToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 7c2365a60..5dc5a00f1 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -320,7 +320,7 @@ void GenerateTrees()
* @param p1 tree type, -1 means random.
* @param p2 end tile of area-drag
*/
-CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
StringID msg = INVALID_STRING_ID;
CommandCost cost(EXPENSES_OTHER);
@@ -526,7 +526,7 @@ static Foundation GetFoundation_Trees(TileIndex tile, Slope tileh)
return FOUNDATION_NONE;
}
-static CommandCost ClearTile_Trees(TileIndex tile, byte flags)
+static CommandCost ClearTile_Trees(TileIndex tile, DoCommandFlag flags)
{
uint num;
@@ -762,7 +762,7 @@ void InitializeTrees()
_trees_tick_ctr = 0;
}
-static CommandCost TerraformTile_Trees(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index a8dd93c9e..763213e01 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -150,7 +150,7 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z)
return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
}
-bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags)
+bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags)
{
if (flags & DC_QUERY_COST) {
return bridge_len <= (_settings_game.construction.longbridges ? 100U : 16U);
@@ -176,7 +176,7 @@ bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, uint32 flags)
* - p2 = (bit 8-14) - rail type or road types.
* - p2 = (bit 15-16) - transport type.
*/
-CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
BridgeType bridge_type;
RailType railtype = INVALID_RAILTYPE;
@@ -463,7 +463,7 @@ not_valid_below:;
* @param p1 railtype or roadtypes. bit 9 set means road tunnel
* @param p2 unused
*/
-CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
TileIndexDiff delta;
TileIndex end_tile;
@@ -590,7 +590,7 @@ static inline bool CheckAllowRemoveTunnelBridge(TileIndex tile)
return false;
}
-static CommandCost DoClearTunnel(TileIndex tile, uint32 flags)
+static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
{
Town *t = NULL;
TileIndex endtile;
@@ -653,7 +653,7 @@ static CommandCost DoClearTunnel(TileIndex tile, uint32 flags)
}
-static CommandCost DoClearBridge(TileIndex tile, uint32 flags)
+static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
{
DiagDirection direction;
TileIndexDiff delta;
@@ -726,7 +726,7 @@ static CommandCost DoClearBridge(TileIndex tile, uint32 flags)
return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * _price.clear_bridge);
}
-static CommandCost ClearTile_TunnelBridge(TileIndex tile, byte flags)
+static CommandCost ClearTile_TunnelBridge(TileIndex tile, DoCommandFlag flags)
{
if (IsTunnel(tile)) {
if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST);
@@ -1462,7 +1462,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti
return VETSB_CONTINUE;
}
-static CommandCost TerraformTile_TunnelBridge(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile) && GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) {
DiagDirection direction = GetTunnelBridgeDirection(tile);
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 6fd04f2f7..6e86db8ff 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -49,7 +49,7 @@ static inline const UnmovableSpec *GetUnmovableSpec(UnmovableType type)
* @param flags docommand flags of calling function
* @return cost of the operation
*/
-static CommandCost DestroyCompanyHQ(CompanyID cid, uint32 flags)
+static CommandCost DestroyCompanyHQ(CompanyID cid, DoCommandFlag flags)
{
Company *c = GetCompany(cid);
@@ -89,7 +89,7 @@ void UpdateCompanyHQ(Company *c, uint score)
MarkTileDirtyByTile(tile + TileDiffXY(1, 1));
}
-extern CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID *station, bool check_clear = true);
+extern CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag flags, uint invalid_dirs, StationID *station, bool check_clear = true);
/** Build or relocate the HQ. This depends if the HQ is already built or not
* @param tile tile where the HQ will be built or relocated to
@@ -97,7 +97,7 @@ extern CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildCompanyHQ(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Company *c = GetCompany(_current_company);
CommandCost cost(EXPENSES_PROPERTY);
@@ -131,7 +131,7 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
* @param p2 unused
* @return error of cost of operation
*/
-CommandCost CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdPurchaseLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
@@ -158,7 +158,7 @@ CommandCost CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32
* @param p2 unused
* @return error or cost of operation
*/
-CommandCost CmdSellLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSellLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsOwnedLandTile(tile)) return CMD_ERROR;
if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER) return CMD_ERROR;
@@ -258,7 +258,7 @@ static Foundation GetFoundation_Unmovable(TileIndex tile, Slope tileh)
return IsOwnedLand(tile) ? FOUNDATION_NONE : FlatteningFoundation(tileh);
}
-static CommandCost ClearTile_Unmovable(TileIndex tile, byte flags)
+static CommandCost ClearTile_Unmovable(TileIndex tile, DoCommandFlag flags)
{
if (IsCompanyHQ(tile)) {
if (_current_company == OWNER_WATER) {
@@ -486,7 +486,7 @@ static void ChangeTileOwner_Unmovable(TileIndex tile, Owner old_owner, Owner new
}
}
-static CommandCost TerraformTile_Unmovable(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Unmovable(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
/* Owned land remains unsold */
if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost();
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index feba28022..ba7fb4d01 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -966,7 +966,7 @@ void AgeVehicle(Vehicle *v)
* @param p2 bit 0: Shall the start/stop newgrf callback be evaluated (only valid with DC_AUTOREPLACE for network safety)
* @return result of operation. Nothing if everything went well
*/
-CommandCost CmdStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
/* Disable the effect of p2 bit 0, when DC_AUTOREPLACE is not set */
if ((flags & DC_AUTOREPLACE) == 0) SetBit(p2, 0);
@@ -1039,7 +1039,7 @@ CommandCost CmdStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
* - bit 6 if set, then it's a vehicle list window, not a depot and Tile is ignored in this case
* - bit 8-11 Vehicle List Window type (ignored unless bit 1 is set)
*/
-CommandCost CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdMassStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleList list;
CommandCost return_value = CMD_ERROR;
@@ -1089,7 +1089,7 @@ CommandCost CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uin
* @param p1 Vehicle type
* @param p2 unused
*/
-CommandCost CmdDepotSellAllVehicles(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdDepotSellAllVehicles(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleList list;
@@ -1126,7 +1126,7 @@ CommandCost CmdDepotSellAllVehicles(TileIndex tile, uint32 flags, uint32 p1, uin
* @param p1 Type of vehicle
* @param p2 If bit 0 is set, then either replace all or nothing (instead of replacing until money runs out)
*/
-CommandCost CmdDepotMassAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
VehicleList list;
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES);
@@ -1178,7 +1178,7 @@ CommandCost CmdDepotMassAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uin
* @param p1 the original vehicle's index
* @param p2 1 = shared orders, else copied orders
*/
-CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost total_cost(EXPENSES_NEW_VEHICLES);
uint32 build_argument = 2;
@@ -1346,7 +1346,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
* @param vlw_flag tells what kind of list requested the goto depot
* @return 0 for success and CMD_ERROR if no vehicle is able to go to depot
*/
-CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service, Owner owner, uint16 vlw_flag, uint32 id)
+CommandCost SendAllVehiclesToDepot(VehicleType type, DoCommandFlag flags, bool service, Owner owner, uint16 vlw_flag, uint32 id)
{
VehicleList list;
@@ -1528,7 +1528,7 @@ static bool IsUniqueVehicleName(const char *name)
* @param p1 vehicle ID to name
* @param p2 unused
*/
-CommandCost CmdRenameVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidVehicleID(p1)) return CMD_ERROR;
@@ -1559,7 +1559,7 @@ CommandCost CmdRenameVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
* @param p1 vehicle ID that is being service-interval-changed
* @param p2 new service interval
*/
-CommandCost CmdChangeServiceInt(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
uint16 serv_int = GetServiceIntervalClamped(p2); /* Double check the service interval from the user-input */
@@ -2051,7 +2051,7 @@ void Vehicle::HandleLoading(bool mode)
InvalidateVehicleOrder(this, 0);
}
-CommandCost Vehicle::SendToDepot(uint32 flags, DepotCommand command)
+CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
{
if (!CheckOwnership(this->owner)) return CMD_ERROR;
if (this->vehstatus & VS_CRASHED) return CMD_ERROR;
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index fa2b1da85..a1ff402da 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -594,7 +594,7 @@ public:
* @param command the command to execute.
* @return the cost of the depot action.
*/
- CommandCost SendToDepot(uint32 flags, DepotCommand command);
+ CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command);
};
/**
diff --git a/src/vehicle_func.h b/src/vehicle_func.h
index 7db60936b..88ac292b4 100644
--- a/src/vehicle_func.h
+++ b/src/vehicle_func.h
@@ -65,7 +65,7 @@ void TrainConsistChanged(Vehicle *v, bool same_length);
void TrainPowerChanged(Vehicle *v);
Money GetTrainRunningCost(const Vehicle *v);
-CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service, Owner owner, uint16 vlw_flag, uint32 id);
+CommandCost SendAllVehiclesToDepot(VehicleType type, DoCommandFlag flags, bool service, Owner owner, uint16 vlw_flag, uint32 id);
void VehicleEnterDepot(Vehicle *v);
bool CanBuildVehicleInfrastructure(VehicleType type);
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 0adf4a7b7..57db1e767 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -99,7 +99,7 @@ static void MarkCanalsAndRiversAroundDirty(TileIndex tile)
* @param p1 bit 0 depot orientation (Axis)
* @param p2 unused
*/
-CommandCost CmdBuildShipDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
TileIndex tile2;
@@ -162,7 +162,7 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o)
}
}
-static CommandCost RemoveShipDepot(TileIndex tile, uint32 flags)
+static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
{
if (!IsShipDepot(tile)) return CMD_ERROR;
if (!CheckTileOwnership(tile)) return CMD_ERROR;
@@ -188,7 +188,7 @@ static CommandCost RemoveShipDepot(TileIndex tile, uint32 flags)
}
/** build a shiplift */
-static CommandCost DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 flags)
+static CommandCost DoBuildShiplift(TileIndex tile, DiagDirection dir, DoCommandFlag flags)
{
CommandCost ret;
int delta;
@@ -234,7 +234,7 @@ static CommandCost DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 fla
return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_water * 22 >> 3);
}
-static CommandCost RemoveShiplift(TileIndex tile, uint32 flags)
+static CommandCost RemoveShiplift(TileIndex tile, DoCommandFlag flags)
{
TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));
@@ -263,7 +263,7 @@ static CommandCost RemoveShiplift(TileIndex tile, uint32 flags)
* @param p1 unused
* @param p2 unused
*/
-CommandCost CmdBuildLock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile, NULL));
if (dir == INVALID_DIAGDIR) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
@@ -280,7 +280,7 @@ CommandCost CmdBuildLock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, con
* @param p1 start tile of stretch-dragging
* @param p2 specifies canal (0), water (1) or river (2); last two can only be built in scenario editor
*/
-CommandCost CmdBuildCanal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
int size_x, size_y;
@@ -343,7 +343,7 @@ CommandCost CmdBuildCanal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, co
}
}
-static CommandCost ClearTile_Water(TileIndex tile, byte flags)
+static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
{
switch (GetWaterTileType(tile)) {
case WATER_TILE_CLEAR:
@@ -1147,7 +1147,7 @@ static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *v, TileIndex tile, int
return VETSB_CONTINUE;
}
-static CommandCost TerraformTile_Water(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
/* Canals can't be terraformed */
if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_MUST_DEMOLISH_CANAL_FIRST);
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index c614a08e1..81bc5cd86 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -156,7 +156,7 @@ static Waypoint *FindDeletedWaypointCloseTo(TileIndex tile)
* @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction"
*/
-CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Waypoint *wp;
Slope tileh;
@@ -270,7 +270,7 @@ void WaypointsDailyLoop()
* @param justremove will indicate if it is removed from rail or if rails are removed too
* @return cost of operation or error
*/
-CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
+CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove)
{
Waypoint *wp;
@@ -318,7 +318,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
* @param p2 unused
* @return cost of operation or error
*/
-CommandCost CmdRemoveTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return RemoveTrainWaypoint(tile, flags, true);
}
@@ -342,7 +342,7 @@ static bool IsUniqueWaypointName(const char *name)
* @param p2 unused
* @return cost of operation or error
*/
-CommandCost CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidWaypointID(p1)) return CMD_ERROR;
diff --git a/src/waypoint.h b/src/waypoint.h
index e4af9c1a1..eb7bab0db 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -60,7 +60,7 @@ static inline Waypoint *GetWaypointByTile(TileIndex tile)
return GetWaypoint(GetWaypointIndex(tile));
}
-CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove);
+CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
Station *ComposeWaypointStation(TileIndex tile);
void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);