(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.

This commit is contained in:
rubidium 2009-02-09 21:20:05 +00:00
parent cd0b38d234
commit d846eef0b6
42 changed files with 197 additions and 194 deletions

View File

@ -246,7 +246,7 @@ uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi)
* @param p2 unused * @param p2 unused
* return result of operation. Could be cost, error * 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); 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 * @param p2 unused
* @return result of operation. Error or sold value * @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; 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) * - p2 bit 8-10 - VLW flag (for mass goto depot)
* @return o if everything went well * @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) { if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */ /* 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) * - p2 = (bit 16) - refit only this vehicle (ignored)
* @return cost of refit or error * @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); byte new_subtype = GB(p2, 8, 8);

View File

@ -47,7 +47,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group)
return er == NULL ? INVALID_ENGINE : er->to; 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; EngineRenew *er;
@ -72,7 +72,7 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
return CommandCost(); 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 *er = (EngineRenew *)(*erl);
EngineRenew *prev = NULL; EngineRenew *prev = NULL;

View File

@ -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) * @param whole_chain move all vehicles following 'v' (true), or only 'v' (false)
* @return success or error * @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); 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 new_head The new head of the completely replaced vehicle chain
* @param flags the command flags to use * @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(); 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) * @param nothing_to_do is set to 'false' when something was done (only valid when not failed)
* @return cost or error * @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; Vehicle *old_v = *single_unit;
assert(old_v->type == VEH_TRAIN && !IsArticulatedPart(old_v) && !IsRearDualheaded(old_v)); 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) * @param nothing_to_do is set to 'false' when something was done (only valid when not failed)
* @return cost or error * @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; Vehicle *old_head = *chain;
assert(old_head->IsPrimaryVehicle()); assert(old_head->IsPrimaryVehicle());
@ -601,7 +601,7 @@ static CommandCost ReplaceChain(Vehicle **chain, uint32 flags, bool wagon_remova
* @param p1 Index of vehicle * @param p1 Index of vehicle
* @param p2 not used * @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); CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES, 0);
bool nothing_to_do = true; bool nothing_to_do = true;

View File

@ -32,7 +32,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
* @param flags The calling command flags. * @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure. * @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. * 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. * @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure. * @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. * 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. * @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure. * @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); 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. * @param flags The calling command flags.
* @return 0 on success, CMD_ERROR on failure. * @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); return RemoveEngineReplacement(&c->engine_renew_list, engine, group, flags);
} }

View File

@ -61,7 +61,7 @@ static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
void DrawBridgeMiddle(const TileInfo *ti); 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); int CalcBridgeLenCostFactor(int x);
void ResetBridges(); void ResetBridges();

View File

@ -20,7 +20,7 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "table/clear_land.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[] = { static const Money *clear_price_table[] = {
&_price.clear_grass, &_price.clear_grass,
@ -357,7 +357,7 @@ void InitializeClearLand()
_settings_game.game_creation.snow_line = _settings_game.game_creation.snow_line_height * TILE_HEIGHT; _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); return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
} }

View File

@ -34,7 +34,7 @@ StringID _error_message;
* *
* @param yyyy The desired function name of the new command handler function. * @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(CmdBuildRailroadTrack);
DEF_COMMAND(CmdRemoveRailroadTrack); DEF_COMMAND(CmdRemoveRailroadTrack);
@ -376,7 +376,7 @@ static int _docommand_recursive = 0;
* @see CommandProc * @see CommandProc
* @return the cost * @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); 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 * @see CommandProc
* @return the cost * @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; CommandCost res;
@ -520,7 +520,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Command flags are used internally */ /* Command flags are used internally */
uint cmd_flags = GetCommandFlags(cmd); uint cmd_flags = GetCommandFlags(cmd);
/* Flags get send to the DoCommand */ /* 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 */ /* 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; if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return false;

View File

@ -53,8 +53,8 @@ static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID);
/** /**
* Execute a command * Execute a command
*/ */
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, const char *text = NULL); CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text = NULL);
CommandCost DoCommand(const CommandContainer *container, uint32 flags); CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags);
/** /**
* Execute a network safe DoCommand function * Execute a network safe DoCommand function
@ -91,9 +91,9 @@ Money GetAvailableMoneyForCommand();
* @param cmd_flags Flags from GetCommandFlags * @param cmd_flags Flags from GetCommandFlags
* @return flags for DoCommand * @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_NO_WATER) flags |= DC_NO_WATER;
if (cmd_flags & CMD_AUTO) flags |= DC_AUTO; if (cmd_flags & CMD_AUTO) flags |= DC_AUTO;
if (cmd_flags & CMD_ALL_TILES) flags |= DC_ALL_TILES; if (cmd_flags & CMD_ALL_TILES) flags |= DC_ALL_TILES;

View File

@ -293,7 +293,8 @@ enum {
* *
* This enums defines some flags which can be used for the commands. * 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_EXEC = 0x001, ///< execute the given command
DC_AUTO = 0x002, ///< don't allow building on structures DC_AUTO = 0x002, ///< don't allow building on structures
DC_QUERY_COST = 0x004, ///< query cost only, don't build. 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_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 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. * Used to combine a StringID with the command.
@ -361,7 +363,7 @@ enum {
* @param text Additional text * @param text Additional text
* @return The CommandCost of the command, which can be succeeded or failed. * @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. * Define a command with the flags which belongs to it.

View File

@ -568,7 +568,7 @@ void CompaniesYearlyLoop()
* if p1 = 5, then * if p1 = 5, then
* - p2 = enable renew_keep_length * - 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; 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_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 * @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; if (flags & DC_EXEC) _current_company = OWNER_NONE;

View File

@ -26,7 +26,7 @@ static Foundation GetFoundation_Dummy(TileIndex tile, Slope tileh)
return FOUNDATION_NONE; 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); return_cmd_error(STR_0001_OFF_EDGE_OF_MAP);
} }
@ -69,7 +69,7 @@ static TrackStatus GetTileTrackStatus_Dummy(TileIndex tile, TransportType mode,
return 0; 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); return_cmd_error(STR_0001_OFF_EDGE_OF_MAP);
} }

View File

@ -1856,7 +1856,7 @@ extern int GetAmountOwnedBy(const Company *c, Owner owner);
* @param p1 company to buy the shares from * @param p1 company to buy the shares from
* @param p2 unused * @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); 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 p1 company to sell the shares from
* @param p2 unused * @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) */ /* Check if selling shares is allowed (protection against modified clients) */
/* Cannot sell own shares */ /* Cannot sell own shares */
@ -1934,7 +1934,7 @@ CommandCost CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint3
* @param p1 company to buy up * @param p1 company to buy up
* @param p2 unused * @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; CompanyID cid = (CompanyID)p1;

View File

@ -467,7 +467,7 @@ void EnginesDailyLoop()
* @param p1 engine-prototype offered * @param p1 engine-prototype offered
* @param p2 unused * @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; Engine *e;
@ -581,7 +581,7 @@ static bool IsUniqueEngineName(const char *name)
* @param p1 engine ID to rename * @param p1 engine ID to rename
* @param p2 unused * @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; if (!IsEngineIndex(p1)) return CMD_ERROR;

View File

@ -75,7 +75,7 @@ void InitializeGroup(void)
* @param p1 vehicle type * @param p1 vehicle type
* @param p2 unused * @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; VehicleType vt = (VehicleType)p1;
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR; 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 * - p1 bit 0-15 : GroupID
* @param p2 unused * @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; if (!IsValidGroupID(p1)) return CMD_ERROR;
@ -162,7 +162,7 @@ static bool IsUniqueGroupName(const char *name)
* - p1 bit 0-15 : GroupID * - p1 bit 0-15 : GroupID
* @param p2 unused * @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; 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 * @param p2 vehicle to add to a group
* - p2 bit 0-15 : VehicleID * - 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; GroupID new_g = p1;
@ -244,7 +244,7 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* - p1 bit 0-15 : GroupID * - p1 bit 0-15 : GroupID
* @param p2 type of vehicles * @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; VehicleType type = (VehicleType)p2;
if (!IsValidGroupID(p1) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR; 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 * - p1 bit 0-15 : GroupID
* @param p2 type of vehicles * @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; VehicleType type = (VehicleType)p2;
if (!IsValidGroupID(p1) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR; if (!IsValidGroupID(p1) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR;
@ -318,7 +318,7 @@ CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, uint32 flags, uint32 p1, u
* @param p2 * @param p2
* - p2 bit 0 : 1 to set or 0 to clear protection. * - 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; if (!IsValidGroupID(p1)) return CMD_ERROR;

View File

@ -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); Industry *i = GetIndustryByTile(tile);
const IndustrySpec *indspec = GetIndustrySpec(i->type); 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 */ /* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
CompanyID old_company = _current_company; CompanyID old_company = _current_company;
_current_company = OWNER_TOWN; _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; _current_company = old_company;
if (not_clearable) return false; 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 * This function tries to flatten out the land below an industry, without
* damaging the surroundings too much. * 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) const int MKEND = -0x80; // used for last element in an IndustryTileTable (see build_industry.h)
int max_x = 0; 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 * @param seed random seed (possibly) used by industries
* @return the pointer of the newly created industry, or NULL if it failed * @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]; const IndustryTileTable *it = indspec->table[itspec_index];
bool custom_shape_check = false; 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 (!_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; if (!CheckIfFarEnoughFromIndustry(tile, type)) return NULL;
const Town *t = CheckMultipleIndustryInTown(tile, type); 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 * @param p2 seed to use for variable 8F
* @return index of the newly create industry, or CMD_ERROR if it failed * @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 IndustrySpec *indspec = GetIndustrySpec(GB(p1, 0, 16));
const Industry *ind = NULL; const Industry *ind = NULL;
@ -2349,7 +2349,7 @@ Money IndustrySpec::GetRemovalCost() const
return (_price.remove_house * this->removal_cost_multiplier) >> 8; 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()) { if (AutoslopeEnabled()) {
/* We imitate here TTDP's behaviour: /* We imitate here TTDP's behaviour:

View File

@ -588,7 +588,7 @@ void ClearSnowLine(void)
* @param p1 unused * @param p1 unused
* @param p2 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); 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 flags of operation to conduct
* @param p2 unused * @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; if (p1 >= MapSize()) return CMD_ERROR;

View File

@ -28,7 +28,7 @@
* @param p1 unused * @param p1 unused
* @param p2 face bitmasked * @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; 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 * p1 bits 8-9 set in use state or first/second colour
* @param p2 new colour for vehicles, property, etc. * @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 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 1: loans the maximum loan permitting money (press CTRL),
* when 2: loans the amount specified in p1 * 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); 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 1: pays back the maximum loan permitting money (press CTRL),
* when 2: pays back the amount specified in p1 * 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); Company *c = GetCompany(_current_company);
@ -226,7 +226,7 @@ static bool IsUniqueCompanyName(const char *name)
* @param p1 unused * @param p1 unused
* @param p2 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); bool reset = StrEmpty(text);
@ -262,7 +262,7 @@ static bool IsUniquePresidentName(const char *name)
* @param p1 unused * @param p1 unused
* @param p2 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); 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 p1 0 = decrease pause counter; 1 = increase pause counter
* @param p2 unused * @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) { if (flags & DC_EXEC) {
_pause_game += (p1 == 0) ? -1 : 1; _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 p1 the amount of money to receive (if negative), or spend (if positive)
* @param p2 unused * @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 #ifndef _DEBUG
if (_networking) return CMD_ERROR; 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 p1 the amount of money to transfer; max 20.000.000
* @param p2 the company to transfer the money to * @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; if (!_settings_game.economy.give_money) return CMD_ERROR;

View File

@ -94,7 +94,7 @@ public:
Money old_money = c->money; Money old_money = c->money;
c->money = INT64_MAX; 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; c->money = old_money;
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */ /* Because build_date is not set yet in every TileDesc, we make sure it is empty */

View File

@ -411,7 +411,7 @@ static uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle
* the maximum vehicle order id is 254. * the maximum vehicle order id is 254.
* @param p2 packed order to insert * @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; Vehicle *v;
VehicleID veh = GB(p1, 0, 16); 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 *dst delete the orders of this vehicle
* @param flags execution flags * @param flags execution flags
*/ */
static CommandCost DecloneOrder(Vehicle *dst, uint32 flags) static CommandCost DecloneOrder(Vehicle *dst, DoCommandFlag flags)
{ {
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
DeleteVehicleOrders(dst); DeleteVehicleOrders(dst);
@ -645,7 +645,7 @@ static CommandCost DecloneOrder(Vehicle *dst, uint32 flags)
* @param p1 the ID of the vehicle * @param p1 the ID of the vehicle
* @param p2 the order to delete (max 255) * @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; Vehicle *v;
VehicleID veh_id = p1; 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 p1 The ID of the vehicle which order is skipped
* @param p2 the selected order to which we want to skip * @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; Vehicle *v;
VehicleID veh_id = p1; 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 * @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 * 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; VehicleID veh = p1;
VehicleOrderID moving_order = GB(p2, 0, 16); 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 0 - 3) - what data to modify (@see ModifyOrderFlags)
* - p2 = (bit 4 - 15) - the data to modify * - 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. VehicleOrderID sel_ord = GB(p1, 16, 16); // XXX - automatically truncated to 8 bits.
VehicleID veh = GB(p1, 0, 16); 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) * - 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 * @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; Vehicle *dst;
VehicleID veh_src = GB(p1, 16, 16); 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 8-15 Cargo subtype
* - bit 16-23 number of order to modify * - 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; const Vehicle *v;
Order *order; 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 * 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;" * 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; Vehicle *v;
VehicleOrderID cur_ord = GB(p2, 0, 16); VehicleOrderID cur_ord = GB(p2, 0, 16);

View File

@ -303,7 +303,7 @@ static inline bool ValParamTrackOrientation(Track track) {return IsValidTrack(tr
* @param p1 railtype of being built piece (normal, mono, maglev) * @param p1 railtype of being built piece (normal, mono, maglev)
* @param p2 rail track to build * @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; Slope tileh;
RailType railtype = (RailType)p1; RailType railtype = (RailType)p1;
@ -442,7 +442,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* @param p1 unused * @param p1 unused
* @param p2 rail orientation * @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; Track track = (Track)p2;
TrackBits trackbit; 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 4-6) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 7) - 0 = build, 1 = remove tracks * - 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); CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
Track track = (Track)GB(p2, 4, 3); 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 * - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @see CmdRailTrackHelper * @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); 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 * - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @see CmdRailTrackHelper * @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); 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, * @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction" * 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; 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 * @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. * 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); Track track = (Track)GB(p1, 0, 3);
bool ctrl_pressed = HasBit(p1, 3); // was the CTRL button pressed 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 7- 9) - default signal type
* - p2 = (bit 24-31) - user defined signals_density * - 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); CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
int signal_ctr; int signal_ctr;
@ -1150,7 +1150,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1,
* - p2 = (bit 24-31) - user defined signals_density * - p2 = (bit 24-31) - user defined signals_density
* @see CmdSignalTrackHelper * @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); 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 * - (bit 4) - 0 = signals, 1 = semaphores
* @param p2 unused * @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); 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 * - p2 = (bit 24-31) - user defined signals_density
* @see CmdSignalTrackHelper * @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 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 p1 start tile of drag
* @param p2 new railtype to convert to * @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); CommandCost cost(EXPENSES_CONSTRUCTION);
RailType totype = (RailType)p2; 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; 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) if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER)
return CMD_ERROR; return CMD_ERROR;
@ -1446,7 +1446,7 @@ static CommandCost RemoveTrainDepot(TileIndex tile, uint32 flags)
return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot); 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 cost(EXPENSES_CONSTRUCTION);
CommandCost ret; CommandCost ret;
@ -2547,7 +2547,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol
return cost; 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; uint z_old;
Slope tileh_old = GetTileSlope(tile, &z_old); Slope tileh_old = GetTileSlope(tile, &z_old);

View File

@ -112,7 +112,7 @@ Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
* @param town_check Shall the town rating checked/affected * @param town_check Shall the town rating checked/affected
* @return true when it is allowed to remove the road bits * @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; 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 rt roadtype to remove
* @param crossing_check should we check if there is a tram track when we are removing road from crossing? * @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); RoadTypes rts = GetRoadTypes(tile);
/* The tile doesn't have the given road type */ /* 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 * bit 4..5 road type
* @param p2 unused * @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); RoadType rt = (RoadType)GB(p1, 4, 2);
if (!IsValidRoadType(rt)) return CMD_ERROR; 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 * bit 6..7 disallowed directions to toggle
* @param p2 the town that is building the road (0 if not applicable) * @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); CommandCost cost(EXPENSES_CONSTRUCTION);
@ -683,7 +683,7 @@ do_clear:;
* - p2 = (bit 3 + 4) - road type * - p2 = (bit 3 + 4) - road type
* - p2 = (bit 5) - set road direction * - 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); CommandCost cost(EXPENSES_CONSTRUCTION);
bool had_bridge = false; 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 2) - direction: 0 = along x-axis, 1 = along y-axis (p2 & 4)
* - p2 = (bit 3 + 4) - road type * - 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); 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, * @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction" * 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); DiagDirection dir = Extract<DiagDirection, 0>(p1);
RoadType rt = (RoadType)GB(p1, 2, 2); 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); 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; 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); 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)) { switch (GetRoadTileType(tile)) {
case ROAD_TILE_NORMAL: { 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()) { if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
switch (GetRoadTileType(tile)) { switch (GetRoadTileType(tile)) {

View File

@ -25,7 +25,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb);
* @param town_check Shall the town rating checked/affected * @param town_check Shall the town rating checked/affected
* @return true when it is allowed to remove the road bits * @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 * Draw the catenary for tram road bits

View File

@ -158,7 +158,7 @@ void RoadVehUpdateCache(Vehicle *v)
* @param p1 bus/truck type being built (engine) * @param p1 bus/truck type being built (engine)
* @param p2 unused * @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; Vehicle *v;
UnitID unit_num; UnitID unit_num;
@ -313,7 +313,7 @@ bool RoadVehicle::IsStoppedInDepot() const
* @param p1 vehicle ID to be sold * @param p1 vehicle ID to be sold
* @param p2 unused * @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; Vehicle *v;
@ -418,7 +418,7 @@ bool RoadVehicle::FindClosestDepot(TileIndex *location, DestinationID *destinati
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h) * - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot) * - 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) { if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */ /* Mass goto depot requested */
@ -441,7 +441,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
* @param p1 vehicle ID to turn * @param p1 vehicle ID to turn
* @param p2 unused * @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; Vehicle *v;
@ -1336,7 +1336,7 @@ static bool CanBuildTramTrackOnTile(CompanyID c, TileIndex t, RoadBits r)
CompanyID original_company = _current_company; CompanyID original_company = _current_company;
_current_company = c; _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; _current_company = original_company;
return CmdSucceeded(ret); return CmdSucceeded(ret);
@ -1984,7 +1984,7 @@ void RoadVehicle::OnNewDay()
* - p2 = (bit 16) - refit only this vehicle * - p2 = (bit 16) - refit only this vehicle
* @return cost of refit or error * @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; Vehicle *v;
CommandCost cost(EXPENSES_ROADVEH_RUN); CommandCost cost(EXPENSES_ROADVEH_RUN);

View File

@ -1973,7 +1973,7 @@ static const SettingDesc *GetSettingDescription(uint index)
* The new value is properly clamped to its minimum/maximum when setting * The new value is properly clamped to its minimum/maximum when setting
* @see _settings * @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); const SettingDesc *sd = GetSettingDescription(p1);

View File

@ -728,7 +728,7 @@ void Ship::Tick()
* @param p1 ship type being built (engine) * @param p1 ship type being built (engine)
* @param p2 unused * @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; 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 p1 vehicle ID to be sold
* @param p2 unused * @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; 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 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot) * - 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) { if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */ /* 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) * - p2 = (bit 16) - refit only this vehicle (ignored)
* @return cost of refit or error * @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; Vehicle *v;
CommandCost cost(EXPENSES_SHIP_RUN); CommandCost cost(EXPENSES_SHIP_RUN);

View File

@ -90,7 +90,7 @@ static void MarkSignDirty(Sign *si)
* @param p1 unused * @param p1 unused
* @param p2 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 */ /* Try to locate a new sign */
if (!Sign::CanAllocateItem()) return_cmd_error(STR_2808_TOO_MANY_SIGNS); 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 * @param p2 unused
* @return 0 if succesfull, otherwise CMD_ERROR * @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; if (!IsValidSignID(p1)) return CMD_ERROR;

View File

@ -696,7 +696,7 @@ static void DeleteStationIfEmpty(Station *st)
UpdateStationSignCoord(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. /** Tries to clear the given area.
* @param tile TileIndex to start check * @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) * @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. * @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); CommandCost cost(EXPENSES_CONSTRUCTION);
int allowed_z = -1; 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 8-15) - custom station id
* - p2 = (bit 16-31) - station ID to join (INVALID_STATION if build new one) * - 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? */ /* Does the authority allow this? */
if (!CheckIfAuthorityAllowsNewStation(tile_org, flags)) return CMD_ERROR; if (!CheckIfAuthorityAllowsNewStation(tile_org, flags)) return CMD_ERROR;
@ -1192,7 +1192,7 @@ restart:
* @param p1 start_tile * @param p1 start_tile
* @param p2 unused * @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; 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 there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) { 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 5: allow stations directly adjacent to other stations.
* bit 16..31: station ID to join (INVALID_STATION if build new one) * 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 type = HasBit(p2, 0);
bool is_drive_through = HasBit(p2, 1); bool is_drive_through = HasBit(p2, 1);
@ -1544,7 +1544,7 @@ static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *)
* @param tile TileIndex been queried * @param tile TileIndex been queried
* @return cost or failure of operation * @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)) { if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) {
return CMD_ERROR; return CMD_ERROR;
@ -1617,7 +1617,7 @@ static CommandCost RemoveRoadStop(Station *st, uint32 flags, TileIndex tile)
* @param p1 not used * @param p1 not used
* @param p2 bit 0: 0 for Bus stops, 1 for truck stops * @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 */ /* 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; 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 0) - allow airports directly adjacent to other airports.
* - p2 = (bit 16-31) - station ID to join (INVALID_STATION if build new one) * - 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; bool airport_upgrade = true;
StationID station_to_join = GB(p2, 16, 16); StationID station_to_join = GB(p2, 16, 16);
@ -1991,7 +1991,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
return cost; return cost;
} }
static CommandCost RemoveAirport(Station *st, uint32 flags) static CommandCost RemoveAirport(Station *st, DoCommandFlag flags)
{ {
if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) { if (_current_company != OWNER_WATER && !CheckOwnership(st->owner)) {
return CMD_ERROR; return CMD_ERROR;
@ -2058,7 +2058,7 @@ static CommandCost RemoveAirport(Station *st, uint32 flags)
* @param p1 unused * @param p1 unused
* @param p2 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 (!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); 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; return false;
} }
static CommandCost RemoveBuoy(Station *st, uint32 flags) static CommandCost RemoveBuoy(Station *st, DoCommandFlag flags)
{ {
/* XXX: strange stuff */ /* XXX: strange stuff */
if (!IsValidCompanyID(_current_company)) return_cmd_error(INVALID_STRING_ID); 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 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) * @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); StationID station_to_join = GB(p2, 16, 16);
bool distant_join = (station_to_join != INVALID_STATION); 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); 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; 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 p1 station ID that is to be renamed
* @param p2 unused * @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; 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 * @param flags command flags
* @return true if the road can be cleared * @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 */ /* The road can always be cleared if it was not a town-owned road */
if (!GetStopBuiltOnTownRoad(tile)) return true; 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); 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) { if (flags & DC_AUTO) {
switch (GetStationType(tile)) { switch (GetStationType(tile)) {
@ -3232,7 +3232,7 @@ void InitializeStations()
_station_tick_ctr = 0; _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()) { 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. /* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.

View File

@ -228,7 +228,7 @@ static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int
* @param p2 direction; eg up (non-zero) or down (zero) * @param p2 direction; eg up (non-zero) or down (zero)
* @return error or cost of terraforming * @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; _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) * @param p2 height difference; eg raise (+1), lower (-1) or level (0)
* @return error or cost of terraforming * @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; if (p1 >= MapSize()) return CMD_ERROR;

View File

@ -66,7 +66,7 @@ struct TileDesc {
*/ */
typedef void DrawTileProc(TileInfo *ti); typedef void DrawTileProc(TileInfo *ti);
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); 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 * 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. * @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.) * @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. * Set of callback functions for performing tile operations of a given tile type.

View File

@ -52,7 +52,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
* Travelling time if p1 bit 25 is set. * Travelling time if p1 bit 25 is set.
* - p2 = (bit 16-31) - Waiting 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; 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 * @param p1 Various bitstuffed elements
* - p1 = (bit 0-15) - Vehicle with the orders to change. * - 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; 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 0) - Set to 1 to enable, 0 to disable autofill.
* - p2 = (bit 1) - Set to 1 to preserve waiting times in non-destructive mode * - 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; if (!_settings_game.order.timetabling) return CMD_ERROR;

View File

@ -18,6 +18,7 @@
#include "viewport_type.h" #include "viewport_type.h"
#include "economy_type.h" #include "economy_type.h"
#include "map_type.h" #include "map_type.h"
#include "command_type.h"
enum { enum {
HOUSE_NO_CLASS = 0, HOUSE_NO_CLASS = 0,
@ -280,7 +281,7 @@ enum {
TOWN_HAS_STADIUM = 2 ///< There can be only one stadium by town. 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) static inline HouseSpec *GetHouseSpecs(HouseID house_id)
{ {
@ -352,7 +353,7 @@ void ResetHouses();
void ClearTownHouse(Town *t, TileIndex tile); void ClearTownHouse(Town *t, TileIndex tile);
void UpdateTownMaxPass(Town *t); void UpdateTownMaxPass(Town *t);
void UpdateTownRadius(Town *t); void UpdateTownRadius(Town *t);
bool CheckIfAuthorityAllowsNewStation(TileIndex tile, uint32 flags); bool CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags);
Town *ClosestTownFromTile(TileIndex tile, uint threshold); Town *ClosestTownFromTile(TileIndex tile, uint threshold);
void ChangeTownRating(Town *t, int add, int max); void ChangeTownRating(Town *t, int add, int max);
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile); HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile);

View File

@ -516,7 +516,7 @@ static bool ClickTile_Town(TileIndex tile)
return false; 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 (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
if (!CanDeleteHouse(tile)) return CMD_ERROR; 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) * 3..5 town road layout (@see TownLayout)
* @param p2 unused * @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 */ /* Only in the scenario editor */
if (_game_mode != GM_EDITOR) return CMD_ERROR; 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 p1 town ID to rename
* @param p2 unused * @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; 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 p1 town to do the action at
* @param p2 action to perform, @see _town_action_proc for the list of available actions * @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; 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 tile The tile where the station shall be constructed.
* @param flags Command flags. DC_NO_TOWN_RATING is tested. * @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; 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 { 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 magic_bulldozer cheat is active, town doesn't restrict your destructive actions */
if (t == NULL || !IsValidCompanyID(_current_company) || _cheats.magic_bulldozer.value) if (t == NULL || !IsValidCompanyID(_current_company) || _cheats.magic_bulldozer.value)
@ -2692,7 +2692,7 @@ void InitializeTowns()
_total_towns = 0; _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()) { if (AutoslopeEnabled()) {
HouseID house = GetHouseType(tile); HouseID house = GetHouseType(tile);

View File

@ -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); const RailVehicleInfo *rvi = RailVehInfo(engine);
CommandCost value(EXPENSES_NEW_VEHICLES, GetEngine(engine)->GetCost()); 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 p1 engine type id
* @param p2 bit 1 prevents any free cars from being added to the train * @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) */ /* 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); 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 * - 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 * @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 s = GB(p1, 0, 16);
VehicleID d = GB(p1, 16, 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 * - 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 * 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 */ /* Check if we deleted a vehicle window */
Window *w = NULL; Window *w = NULL;
@ -1905,7 +1905,7 @@ static void ReverseTrainDirection(Vehicle *v)
* @param p1 train to reverse * @param p1 train to reverse
* @param p2 if true, reverse a unit in a train (needs to be in a depot) * @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; 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 p1 train to ignore the red signal
* @param p2 unused * @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; 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 * - p2 = (bit 16) - refit only this vehicle
* @return cost of refit or error * @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); CargoID new_cid = GB(p2, 0, 8);
byte new_subtype = GB(p2, 8, 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 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot) * - 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) { if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */ /* Mass goto depot requested */

View File

@ -320,7 +320,7 @@ void GenerateTrees()
* @param p1 tree type, -1 means random. * @param p1 tree type, -1 means random.
* @param p2 end tile of area-drag * @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; StringID msg = INVALID_STRING_ID;
CommandCost cost(EXPENSES_OTHER); CommandCost cost(EXPENSES_OTHER);
@ -526,7 +526,7 @@ static Foundation GetFoundation_Trees(TileIndex tile, Slope tileh)
return FOUNDATION_NONE; return FOUNDATION_NONE;
} }
static CommandCost ClearTile_Trees(TileIndex tile, byte flags) static CommandCost ClearTile_Trees(TileIndex tile, DoCommandFlag flags)
{ {
uint num; uint num;
@ -762,7 +762,7 @@ void InitializeTrees()
_trees_tick_ctr = 0; _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); return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
} }

View File

@ -150,7 +150,7 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z)
return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform); 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) { if (flags & DC_QUERY_COST) {
return bridge_len <= (_settings_game.construction.longbridges ? 100U : 16U); 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 8-14) - rail type or road types.
* - p2 = (bit 15-16) - transport type. * - 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; BridgeType bridge_type;
RailType railtype = INVALID_RAILTYPE; RailType railtype = INVALID_RAILTYPE;
@ -463,7 +463,7 @@ not_valid_below:;
* @param p1 railtype or roadtypes. bit 9 set means road tunnel * @param p1 railtype or roadtypes. bit 9 set means road tunnel
* @param p2 unused * @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; TileIndexDiff delta;
TileIndex end_tile; TileIndex end_tile;
@ -590,7 +590,7 @@ static inline bool CheckAllowRemoveTunnelBridge(TileIndex tile)
return false; return false;
} }
static CommandCost DoClearTunnel(TileIndex tile, uint32 flags) static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
{ {
Town *t = NULL; Town *t = NULL;
TileIndex endtile; 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; DiagDirection direction;
TileIndexDiff delta; TileIndexDiff delta;
@ -726,7 +726,7 @@ static CommandCost DoClearBridge(TileIndex tile, uint32 flags)
return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * _price.clear_bridge); 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 (IsTunnel(tile)) {
if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST); 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; 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) { if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile) && GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) {
DiagDirection direction = GetTunnelBridgeDirection(tile); DiagDirection direction = GetTunnelBridgeDirection(tile);

View File

@ -49,7 +49,7 @@ static inline const UnmovableSpec *GetUnmovableSpec(UnmovableType type)
* @param flags docommand flags of calling function * @param flags docommand flags of calling function
* @return cost of the operation * @return cost of the operation
*/ */
static CommandCost DestroyCompanyHQ(CompanyID cid, uint32 flags) static CommandCost DestroyCompanyHQ(CompanyID cid, DoCommandFlag flags)
{ {
Company *c = GetCompany(cid); Company *c = GetCompany(cid);
@ -89,7 +89,7 @@ void UpdateCompanyHQ(Company *c, uint score)
MarkTileDirtyByTile(tile + TileDiffXY(1, 1)); 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 /** 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 * @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 p1 unused
* @param p2 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); Company *c = GetCompany(_current_company);
CommandCost cost(EXPENSES_PROPERTY); CommandCost cost(EXPENSES_PROPERTY);
@ -131,7 +131,7 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
* @param p2 unused * @param p2 unused
* @return error of cost of operation * @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); CommandCost cost(EXPENSES_CONSTRUCTION);
@ -158,7 +158,7 @@ CommandCost CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32
* @param p2 unused * @param p2 unused
* @return error or cost of operation * @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 (!IsOwnedLandTile(tile)) return CMD_ERROR;
if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER) 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); 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 (IsCompanyHQ(tile)) {
if (_current_company == OWNER_WATER) { 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 */ /* Owned land remains unsold */
if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost(); if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost();

View File

@ -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) * @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 * @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 */ /* Disable the effect of p2 bit 0, when DC_AUTOREPLACE is not set */
if ((flags & DC_AUTOREPLACE) == 0) SetBit(p2, 0); 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 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) * - 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; VehicleList list;
CommandCost return_value = CMD_ERROR; CommandCost return_value = CMD_ERROR;
@ -1089,7 +1089,7 @@ CommandCost CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uin
* @param p1 Vehicle type * @param p1 Vehicle type
* @param p2 unused * @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; VehicleList list;
@ -1126,7 +1126,7 @@ CommandCost CmdDepotSellAllVehicles(TileIndex tile, uint32 flags, uint32 p1, uin
* @param p1 Type of vehicle * @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) * @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; VehicleList list;
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES); 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 p1 the original vehicle's index
* @param p2 1 = shared orders, else copied orders * @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); CommandCost total_cost(EXPENSES_NEW_VEHICLES);
uint32 build_argument = 2; 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 * @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 * @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; VehicleList list;
@ -1528,7 +1528,7 @@ static bool IsUniqueVehicleName(const char *name)
* @param p1 vehicle ID to name * @param p1 vehicle ID to name
* @param p2 unused * @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; 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 p1 vehicle ID that is being service-interval-changed
* @param p2 new service interval * @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 */ 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); 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 (!CheckOwnership(this->owner)) return CMD_ERROR;
if (this->vehstatus & VS_CRASHED) return CMD_ERROR; if (this->vehstatus & VS_CRASHED) return CMD_ERROR;

View File

@ -594,7 +594,7 @@ public:
* @param command the command to execute. * @param command the command to execute.
* @return the cost of the depot action. * @return the cost of the depot action.
*/ */
CommandCost SendToDepot(uint32 flags, DepotCommand command); CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command);
}; };
/** /**

View File

@ -65,7 +65,7 @@ void TrainConsistChanged(Vehicle *v, bool same_length);
void TrainPowerChanged(Vehicle *v); void TrainPowerChanged(Vehicle *v);
Money GetTrainRunningCost(const 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); void VehicleEnterDepot(Vehicle *v);
bool CanBuildVehicleInfrastructure(VehicleType type); bool CanBuildVehicleInfrastructure(VehicleType type);

View File

@ -99,7 +99,7 @@ static void MarkCanalsAndRiversAroundDirty(TileIndex tile)
* @param p1 bit 0 depot orientation (Axis) * @param p1 bit 0 depot orientation (Axis)
* @param p2 unused * @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; 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 (!IsShipDepot(tile)) return CMD_ERROR;
if (!CheckTileOwnership(tile)) return CMD_ERROR; if (!CheckTileOwnership(tile)) return CMD_ERROR;
@ -188,7 +188,7 @@ static CommandCost RemoveShipDepot(TileIndex tile, uint32 flags)
} }
/** build a shiplift */ /** build a shiplift */
static CommandCost DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 flags) static CommandCost DoBuildShiplift(TileIndex tile, DiagDirection dir, DoCommandFlag flags)
{ {
CommandCost ret; CommandCost ret;
int delta; int delta;
@ -234,7 +234,7 @@ static CommandCost DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 fla
return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_water * 22 >> 3); 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)); TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));
@ -263,7 +263,7 @@ static CommandCost RemoveShiplift(TileIndex tile, uint32 flags)
* @param p1 unused * @param p1 unused
* @param p2 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)); DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile, NULL));
if (dir == INVALID_DIAGDIR) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); 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 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 * @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); CommandCost cost(EXPENSES_CONSTRUCTION);
int size_x, size_y; 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)) { switch (GetWaterTileType(tile)) {
case WATER_TILE_CLEAR: case WATER_TILE_CLEAR:
@ -1147,7 +1147,7 @@ static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *v, TileIndex tile, int
return VETSB_CONTINUE; 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 */ /* Canals can't be terraformed */
if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_MUST_DEMOLISH_CANAL_FIRST); if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_MUST_DEMOLISH_CANAL_FIRST);

View File

@ -156,7 +156,7 @@ static Waypoint *FindDeletedWaypointCloseTo(TileIndex tile)
* @todo When checking for the tile slope, * @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction" * 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; Waypoint *wp;
Slope tileh; Slope tileh;
@ -270,7 +270,7 @@ void WaypointsDailyLoop()
* @param justremove will indicate if it is removed from rail or if rails are removed too * @param justremove will indicate if it is removed from rail or if rails are removed too
* @return cost of operation or error * @return cost of operation or error
*/ */
CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove) CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove)
{ {
Waypoint *wp; Waypoint *wp;
@ -318,7 +318,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
* @param p2 unused * @param p2 unused
* @return cost of operation or error * @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); return RemoveTrainWaypoint(tile, flags, true);
} }
@ -342,7 +342,7 @@ static bool IsUniqueWaypointName(const char *name)
* @param p2 unused * @param p2 unused
* @return cost of operation or error * @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; if (!IsValidWaypointID(p1)) return CMD_ERROR;

View File

@ -60,7 +60,7 @@ static inline Waypoint *GetWaypointByTile(TileIndex tile)
return GetWaypoint(GetWaypointIndex(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); Station *ComposeWaypointStation(TileIndex tile);
void ShowWaypointWindow(const Waypoint *wp); void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype); void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);