OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
28 #include "table/strings.h"
207 #define DEF_CMD(proc, flags, type) {proc, #proc, (CommandFlags)flags, type}
422 static const int command_type_lookup[] = {
440 static int _docommand_recursive = 0;
478 _docommand_recursive++;
481 if (_docommand_recursive == 1 || !(flags &
DC_EXEC) ) {
482 if (_docommand_recursive == 1) _cleared_object_areas.clear();
484 res = proc(tile, flags & ~
DC_EXEC, p1, p2, text);
490 if (_docommand_recursive == 1 &&
498 _docommand_recursive--;
505 if (_docommand_recursive == 1) _cleared_object_areas.clear();
506 res = proc(tile, flags, p1, p2, text);
509 _docommand_recursive--;
514 if (--_docommand_recursive == 0 && !(flags &
DC_BANKRUPT)) {
593 if (estimate_only || (
IsLocalCompany() && error_part1 != 0 && my_cmd)) {
596 }
else if (estimate_only) {
598 }
else if (!only_sending && res.
GetCost() != 0 && tile != 0 &&
IsLocalCompany() && _game_mode != GM_EDITOR) {
607 if (!estimate_only && !only_sending && callback !=
nullptr) {
608 callback(res, tile, p1, p2, cmd);
619 #define return_dcpi(cmd) { _docommand_recursive = 0; return cmd; }
637 assert(_docommand_recursive == 0);
638 _docommand_recursive = 1;
641 _additional_cash_required = 0;
650 assert(proc !=
nullptr);
676 bool test_and_exec_can_differ = (cmd_flags &
CMD_NO_TEST) != 0;
679 _cleared_object_areas.clear();
694 if (res.
Failed() || estimate_only ||
699 Debug(desync, 1,
"cmdf: {:08x}; {:02x}; {:02x}; {:06x}; {:08x}; {:08x}; {:08x}; \"{}\" ({})",
_date,
_date_fract, (
int)
_current_company, tile, p1, p2, cmd & ~
CMD_NETWORK_COMMAND, text,
GetCommandName(cmd));
719 Debug(desync, 1,
"cmd: {:08x}; {:02x}; {:02x}; {:06x}; {:08x}; {:08x}; {:08x}; \"{}\" ({})",
_date,
_date_fract, (
int)
_current_company, tile, p1, p2, cmd & ~
CMD_NETWORK_COMMAND, text,
GetCommandName(cmd));
723 _cleared_object_areas.clear();
744 if (!test_and_exec_can_differ) {
746 }
else if (res2.
Failed()) {
752 if (_additional_cash_required != 0 && res2.
GetCost() == 0) {
809 for (uint i = 0; i < num_registers; i++) {
CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Sell shares in an opposing company.
CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Delete a town (scenario editor or worldgen only).
CommandCost CmdExpandTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Expand a town (scenario editor only).
@ PSM_LEAVE_TESTMODE
Leave command test mode, revert to previous mode.
void Change(const U &new_value)
Change the value of the variable.
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change engine renewal parameters.
CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the name of the company.
CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Clone a vehicle.
CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a piece of road.
CommandCost CmdChangeBankBalance(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the bank bank balance of a company by inserting or removing money without affecting the loan.
uint32 TileIndex
The index/ID of a Tile.
uint32 cmd
command being executed.
CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Convert existing rail to waypoint.
CommandProc CmdRefitVehicle
Refits a vehicle to the specified cargo type.
CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a long piece of road.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
static Titem * Get(size_t index)
Returns Titem with given index.
@ CMDPL_NO_ACTIONS
No user actions may be executed.
CommandCost CmdSetGroupFlag(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
(Un)set group flag from a group
CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Rename a town (server-only).
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
static SigSegState UpdateSignalsInBuffer(Owner owner)
Updates blocks in _globset buffer.
CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Add an order to the orderlist of a vehicle.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build signals on a stretch of track.
CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a buoy.
Class to backup a specific variable and restore it later.
CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a ship depot.
CommandCost CmdMassStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Starts or stops a lot of vehicles.
CommandCost CmdTownCargoGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the cargo goal of a town.
@ CMD_OFFLINE
the command cannot be executed in a multiplayer game; single-player only
DateFract _date_fract
Fractional part of the day.
@ CMDT_VEHICLE_CONSTRUCTION
Construction, modification (incl. refit) and destruction of vehicles.
const char * GetCommandName(uint32 cmd)
CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new town.
CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the name of the president.
static const Command _command_proc_table[]
The master command table.
CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Give a custom name to your vehicle.
CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build/Fund an industry.
CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Clear an OrderBackup.
#define return_dcpi(cmd)
Helper to deduplicate the code for returning.
CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Alter a group.
void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
Define a callback function for the client, after the command is finished.
@ CMD_NO_EST
the command is never estimated.
static const uint TILE_SIZE
Tile size in world coordinates.
Structure for buffering the build command when selecting a station to join.
CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new story page element.
CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a goal.
CommandCost CmdTownRating(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the rating of a company in a town.
CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Rename a waypoint.
bool Verify() const
Check whether the variable is currently equals the backup.
CommandFlags flags
The (command) flags to that apply to this command.
CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Rename a sign.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
@ DC_ALL_TILES
allow this command also on MP_VOID tiles
TileIndex last_build_coordinate
Coordinate of the last build thing by this company.
CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new vehicle group.
CommandCost CmdStoryPageButton(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Clicked/used a button on a story page.
@ CMDT_CHEAT
A cheat of some sorts.
@ CMDT_COMPANY_SETTING
Changing settings related to a company.
const uint32 * GetTextRefStack() const
Returns a pointer to the values for the TextRefStack of the error message.
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Autoreplaces a vehicle Trains are replaced as a whole chain, free wagons in depot are replaced on the...
Owner
Enum for all companies/owners.
CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a single tile from a waypoint.
@ DC_EXEC
execute the given command
bool IsCommandAllowedWhilePaused(uint32 cmd)
Returns whether the command is allowed while the game is paused.
StringID GetErrorMessage() const
Returns the error message of a command.
static bool IsLocalCompany()
Is the current company the local company?
static uint32 textref_stack[16]
Values to put on the TextRefStack for the error message.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const std::string &text, CompanyID company)
Prepare a DoCommand to be send over the network.
DoCommandFlag
List of flags for a command.
CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new goal.
CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Add all vehicles in the given group to the default group and then deletes the group.
CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const std::string &text, bool my_cmd, bool estimate_only)
CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove bus or truck stops.
CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Sell a vehicle.
CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Builds a lock.
bool Succeeded() const
Did this command succeed?
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
static uint TileX(TileIndex tile)
Get the X component of a tile.
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32 *textref_stack=nullptr)
Display an error message in a window.
CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Clone/share/copy an order-list of another vehicle.
CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Add/remove refit orders from an order.
CommandCost CmdTownGrowthRate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the growth rate of the town.
@ CMDT_END
Magic end marker.
@ PM_UNPAUSED
A normal unpaused game.
CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Acquire shares in an opposing company.
std::string text
possible text sent for name changes etc.
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a single piece of track.
CommandCost CmdCreateSubsidy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new subsidy.
bool IsValidCommand(uint32 cmd)
CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Modify an order in the orderlist of a vehicle.
CommandFlags
Command flags for the command table _command_proc_table.
CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Place an Airport.
static uint MapSize()
Get the size of the map.
void UseTextRefStack(const GRFFile *grffile, uint num_registers)
Activate usage of the NewGRF TextRefStack for the error message.
Common return value for all commands.
uint textref_stack_size
Number of uint32 values to put on the TextRefStack for the error message.
Date _date
Current date in days (day counter)
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
@ CMD_AUTO
set the DC_AUTO flag on this command
Define a command with the flags which belongs to it.
CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove signals.
uint GetTextRefStackSize() const
Returns the number of uint32 values for the TextRefStack of the error message.
CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Clear a piece of landscape.
CommandCost CmdCustomNewsItem(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new custom news item.
CommandCost CmdOpenCloseAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Open/close an airport to incoming aircraft.
CommandType type
The type of command.
bool Failed() const
Did this command fail?
CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Move a rail vehicle around inside the depot.
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Add all shared vehicles of all vehicles from a group.
@ CMDPL_NO_LANDSCAPING
No landscaping actions may be executed.
PauseMode _pause_mode
The current pause mode.
const GRFFile * GetTextRefStackGRF() const
Returns the NewGRF providing the TextRefStack of the error message.
@ CMDT_ROUTE_MANAGEMENT
Modifications to route management (orders, groups, etc).
@ PSM_LEAVE_COMMAND
Leave command scope, revert to previous mode.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Reply to a goal question.
CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Network-safe changing of settings (server-only).
@ WL_INFO
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Send a vehicle to the depot.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a single tile from a rail station.
@ CMD_CLIENT_ID
set p2 with the ClientID of the sending client.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
Money GetCost() const
The costs as made up to this moment.
@ CLIENT_ID_SERVER
Servers always have this ID.
CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Create a new story page.
CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Do a town action.
bool _networking
are we in networking mode?
bool _shift_pressed
Is Shift pressed?
CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Ask a goal related question.
Money GetAvailableMoneyForCommand()
CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Increase the loan of your company.
@ CMD_FLAGS_MASK
mask for all command flags
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
CommandCost CmdSetGroupLivery(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Set the livery for a vehicle group.
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
Display animated income or costs on the map.
CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build rail station.
CommandFlags GetCommandFlags(uint32 cmd)
CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build rail on a stretch of track.
CommandCost CmdRenameEngine(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Rename an engine.
CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Display a story page for all clients that are allowed to view the story page.
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Update title of a story page.
CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the company's company-colour.
CommandCost CmdSetGoalCompleted(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Update completed state of a goal.
CommandCallback * callback
any callback function executed upon successful completion of the command.
CommandCost CmdIndustryCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change industry properties.
bool _generating_world
Whether we are generating the map or not.
CommandCost CmdTownSetText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Set a custom text in the Town window.
CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build Tunnel.
CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Clear a big piece of landscape.
const GRFFile * textref_stack_grffile
NewGRF providing the TextRefStack content.
CommandCost CmdRenameDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Rename a depot.
CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the company manager's face.
CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Control the companies: add, delete, etc.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
CommandCost CmdDeleteOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Delete an order from the orderlist of a vehicle.
CompanyID _current_company
Company currently doing an action.
CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Pause/Unpause the game (server-only).
@ CMDT_VEHICLE_MANAGEMENT
Stopping, starting, sending to depot, turning around, replace orders etc.
CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Plant a tree.
@ CMD_NO_WATER
set the DC_NO_WATER flag on this command
void Trash()
Trash the backup.
@ CMD_NETWORK_COMMAND
execute the command without sending it on the network
StringID message
Warning message for when success is unset.
CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Autoreplace all vehicles in the depot.
CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a single piece of rail.
CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Set the visibility of an engine.
void Restore()
Restore the variable.
@ CMD_ALL_TILES
allow this command also on MP_VOID tiles
@ CMD_ID_MASK
mask for the command ID
CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Accept an engine prototype.
CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a story page element.
CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Update goal text of a goal.
@ COMPANY_SPECTATOR
The client is spectating.
CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Add a vehicle to a group.
CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change one of the per-company settings.
CommandCost CmdDepotSellAllVehicles(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Sells all vehicles in a depot.
CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build signals, alternate between double/single, signal/semaphore, pre/exit/combo-signals,...
CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a Bridge.
@ CMDT_SERVER_SETTING
Pausing/removing companies/server settings.
CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a train depot.
CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a piece of canal.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
@ CMD_NO_TEST
the command's output may differ between test and execute due to town rating changes etc.
CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Move an order inside the orderlist.
@ CMD_COMPANY_CTRL
used in multiplayer to create a new companies etc.
CommandCost CmdForceTrainProceed(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Force a train through a red signal.
CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a road depot.
CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Buy up another company.
CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Convert one rail type to the other.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
CommandCost CmdScrollViewport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Scroll players main viewport.
void ShowEstimatedCostOrIncome(Money cost, int x, int y)
Display estimated costs.
Money cost
The cost of this action.
static DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
#define Debug(name, level, format_string,...)
Ouptut a line of debugging information.
CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove signals on a stretch of track.
#define lengthof(x)
Return the length of an fixed size array.
@ CMDPL_ALL_ACTIONS
All actions may be executed.
CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Update progress text of a goal.
const char * name
A human readable name for the procedure.
Class for temporary storage of data.
static void SwitchMode(PersistentStorageMode mode, bool ignore_prev_mode=false)
Clear temporary changes made since the last call to SwitchMode, and set whether subsequent changes sh...
CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Convert one road subtype to another.
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove all vehicles from a group.
CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Start/Stop a vehicle.
CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build an object object.
@ PSM_ENTER_COMMAND
Enter command scope, changes will be permanent.
ConstructionSettings construction
construction of things in-game
CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Place a sign at the given coordinates.
CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Defines the callback type for all command handler functions.
CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Update a new story page element.
CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a vehicle.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
void SubtractMoneyFromCompany(const CommandCost &cost)
Subtract money from the _current_company, if the company is valid.
CommandCost CmdMoneyCheat(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the financial flow of your company.
CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Transfer funds (money) from one company to another.
@ CMD_SERVER
the command can only be initiated by the server
CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build rail on a stretch of track.
@ CMD_SPECTATOR
the command may be initiated by a spectator
@ DC_QUERY_COST
query cost only, don't build.
TileIndex tile
tile command being executed on.
@ CMD_STR_CTRL
the command's string may contain control strings
uint8 command_pause_level
level/amount of commands that can't be executed while paused
@ PSM_ENTER_TESTMODE
Enter command test mode, changes will be temporary.
CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a long piece of road.
@ CMDPL_NO_CONSTRUCTION
No construction actions may be executed.
CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Remove a story page and associated story page elements.
CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Turn a roadvehicle around.
CommandCost CmdEngineCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Allow or forbid a specific company to use an engine.
@ CMDT_MONEY_MANAGEMENT
Management of money, i.e. loans and shares.
void SetTownRatingTestMode(bool mode)
Switch the town rating to test-mode, to allow commands to be tested without affecting current ratings...
CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Decrease the loan of your company.
CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Reverse train.
CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Update date of a story page.
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a bus or truck stop.
Dynamic data of a loaded NewGRF.
CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Rename a station.
CommandProc * proc
The procedure to actually executing.
CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Goto order of order-list.
bool success
Whether the comment went fine up to this moment.
CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Change the service interval of a vehicle.
CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
Build a dock/haven.