30 #include "table/strings.h" 201 #define DEF_CMD(proc, flags, type) {proc, #proc, (CommandFlags)flags, type} 369 return cmd <
lengthof(_command_proc_table) && _command_proc_table[cmd].
proc != NULL;
408 static const int command_type_lookup[] = {
426 static int _docommand_recursive = 0;
464 _docommand_recursive++;
467 if (_docommand_recursive == 1 || !(flags &
DC_EXEC) ) {
468 if (_docommand_recursive == 1) _cleared_object_areas.Clear();
470 res = proc(tile, flags & ~DC_EXEC, p1, p2, text);
476 if (_docommand_recursive == 1 &&
483 if (!(flags & DC_EXEC)) {
484 _docommand_recursive--;
491 if (_docommand_recursive == 1) _cleared_object_areas.Clear();
492 res = proc(tile, flags, p1, p2, text);
495 _docommand_recursive--;
500 if (--_docommand_recursive == 0 && !(flags &
DC_BANKRUPT)) {
572 #ifdef ENABLE_NETWORK 581 if (estimate_only || (
IsLocalCompany() && error_part1 != 0 && my_cmd)) {
584 }
else if (estimate_only) {
586 }
else if (!only_sending && res.
GetCost() != 0 && tile != 0 &&
IsLocalCompany() && _game_mode != GM_EDITOR) {
595 if (!estimate_only && !only_sending && callback != NULL) {
596 callback(res, tile, p1, p2);
608 #define return_dcpi(cmd) { _docommand_recursive = 0; return cmd; } 626 assert(_docommand_recursive == 0);
627 _docommand_recursive = 1;
630 _additional_cash_required = 0;
634 assert(cmd_id <
lengthof(_command_proc_table));
639 assert(proc != NULL);
646 #ifdef ENABLE_NETWORK 667 bool test_and_exec_can_differ = (cmd_flags &
CMD_NO_TEST) != 0;
670 _cleared_object_areas.Clear();
685 if (res.
Failed() || estimate_only ||
690 DEBUG(desync, 1,
"cmdf: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)",
_date,
_date_fract, (
int)
_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text,
GetCommandName(cmd));
696 #ifdef ENABLE_NETWORK 712 DEBUG(desync, 1,
"cmd: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)",
_date,
_date_fract, (
int)
_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text,
GetCommandName(cmd));
716 _cleared_object_areas.Clear();
737 if (!test_and_exec_can_differ) {
739 }
else if (res2.
Failed()) {
745 if (_additional_cash_required != 0 && res2.
GetCost() == 0) {
802 for (uint i = 0; i < num_registers; i++) {
Functions related to OTTD's strings.
CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Transfer funds (money) from one company to another.
CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove signals on a stretch of track.
static bool IsLocalCompany()
Is the current company the local company?
CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename a sign.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
used in multiplayer to create a new companies etc.
Definition of stuff that is very close to a company, like the company struct itself.
CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a vehicle.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
CommandCost CmdDeleteOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Delete an order from the orderlist of a vehicle.
bool _networking
are we in networking mode?
CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new goal.
set the DC_NO_WATER flag on this command
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company)
Prepare a DoCommand to be send over the network.
CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a piece of canal.
const char * GetCommandName(uint32 cmd)
CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Place a sign at the given coordinates.
No landscaping actions may be executed.
Leave command test mode, revert to previous mode.
CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Ask a goal related question.
CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new vehicle group.
Enter command test mode, changes will be tempoary.
set p2 with the ClientID of the sending client.
CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build signals on a stretch of track.
static Titem * Get(size_t index)
Returns Titem with given index.
Money GetAvailableMoneyForCommand()
Functions related to dates.
CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build signals, alternate between double/single, signal/semaphore, pre/exit/combo-signals, and what-else not.
CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the company manager's face.
static uint32 textref_stack[16]
Values to put on the TextRefStack for the error message.
CommandCost CmdSetGroupReplaceProtection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
(Un)set global replace protection from a group
Class for temporary storage of data.
query cost only, don't build.
CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a piece of road.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
CommandType type
The type of command.
set the DC_AUTO flag on this command
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
CommandCost CmdMoneyCheat(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the financial flow of your company.
CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a single piece of rail.
CommandCost CmdDepotSellAllVehicles(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Sells all vehicles in a depot.
CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clear a big piece of landscape.
static uint TileX(TileIndex tile)
Get the X component of a tile.
CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Acquire shares in an opposing company.
CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build rail on a stretch of track.
void Change(const U &new_value)
Change the value of the variable.
CommandFlags
Command flags for the command table _command_proc_table.
CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update a new story page element.
All actions may be executed.
CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Reverse train.
void UseTextRefStack(const GRFFile *grffile, uint num_registers)
Activate usage of the NewGRF TextRefStack for the error message.
CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Do a town action.
static SigSegState UpdateSignalsInBuffer(Owner owner)
Updates blocks in _globset buffer.
void SetTownRatingTestMode(bool mode)
Switch the town rating to test-mode, to allow commands to be tested without affecting current ratings...
The client is spectating.
Define a command with the flags which belongs to it.
const char * name
A human readable name for the procedure.
Functions related to world/map generation.
Money GetCost() const
The costs as made up to this moment.
Common return value for all commands.
CommandCost CmdMassStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Starts or stops a lot of vehicles.
CommandFlags GetCommandFlags(uint32 cmd)
CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Network-safe changing of settings (server-only).
CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Set the visibility of an engine.
char text[32 *MAX_CHAR_LENGTH]
possible text sent for name changes etc, in bytes including '\0'.
static const uint TILE_SIZE
Tile size in world coordinates.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Autoreplace all vehicles in the depot.
CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Give a custom name to your vehicle.
Servers always have this ID.
CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a bus or truck stop.
const GRFFile * GetTextRefStackGRF() const
Returns the NewGRF providing the TextRefStack of the error message.
CommandCost CmdRenameDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename a depot.
bool IsValidCommand(uint32 cmd)
Class to backup a specific variable and restore it later.
CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clone a vehicle.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
company bankrupts, skip money check, skip vehicle on tile check in some cases
The object is owned by a superuser / goal script.
Pausing/removing companies/server settings.
CommandCost CmdExpandTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Expand a town (scenario editor only).
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a story page and associated story page elements.
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=NULL, uint textref_stack_size=0, const uint32 *textref_stack=NULL)
Display an error message in a window.
CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Pause/Unpause the game (server-only).
CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a ship depot.
CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the name of the company.
mask for all command flags
CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a story page element.
Functions related to errors.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
DateFract _date_fract
Fractional part of the day.
CommandCost CmdCreateSubsidy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new subsidy.
bool Verify() const
Check whether the variable is currently equals the backup.
CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Decrease the loan of your company.
CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update progress text of a goal.
execute the command without sending it on the network
CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove bus or truck stops.
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 CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Buy up another company.
CommandCost CmdForceTrainProceed(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Force a train through a red signal.
CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Convert one rail type to the other.
StringID GetErrorMessage() const
Returns the error message of a command.
Construction, modification (incl. refit) and destruction of vehicles.
Structure for buffering the build command when selecting a station to join.
CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Accept an engine prototype.
DoCommandFlag
List of flags for a command.
CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the company's company-colour.
CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Add an order to the orderlist of a vehicle.
bool Succeeded() const
Did this command succeed?
the command may be executed by COMPANY_DEITY
Definition of base types and functions in a cross-platform compatible way.
CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove signals.
const GRFFile * textref_stack_grffile
NewGRF providing the TextRefStack content.
CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a road depot.
A number of safeguards to prevent using unsafe methods.
CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only)
CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Move an order inside the orderlist.
the command's output may differ between test and execute due to town rating changes etc...
CommandCost CmdTownGrowthRate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the growth rate of the town.
StringID message
Warning message for when success is unset.
const uint32 * GetTextRefStack() const
Returns a pointer to the values for the TextRefStack of the error message.
CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Turn a roadvehicle around.
uint textref_stack_size
Number of uint32 values to put on the TextRefStack for the error message.
Renaming stuff, changing company colours, placing signs, etc.
static DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a dock/haven.
Basic functions/variables used all over the place.
CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build an object object.
Construction and destruction of objects on the map.
CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename a station.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Delete a town (scenario editor or worldgen only).
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove all vehicles from a group.
CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build Tunnel.
#define lengthof(x)
Return the length of an fixed size array.
PauseModeByte _pause_mode
The current pause mode.
CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Sell shares in an opposing company.
CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a train depot.
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change engine renewal parameters.
CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Goto order of order-list.
the command can only be initiated by the server
uint32 StringID
Numeric value that represents a string, independent of the selected language.
CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update title of a story page.
the command's string may contain control strings
bool Failed() const
Did this command fail?
CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clear a piece of landscape.
CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Modify an order in the orderlist of a vehicle.
Enter command scope, changes will be permanent.
CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build/Fund an industry.
CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new story page element.
Leave command scope, revert to previous mode.
No construction actions may be executed.
the command may be initiated by a spectator
allow this command also on MP_VOID tiles
bool _shift_pressed
Is Shift pressed?
CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update date of a story page.
CommandCallback * callback
any callback function executed upon successful completion of the command.
#define DEBUG(name, level,...)
Output a line of debugging information.
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a single piece of track.
bool IsCommandAllowedWhilePaused(uint32 cmd)
Returns whether the command is allowed while the game is paused.
void ShowEstimatedCostOrIncome(Money cost, int x, int y)
Display estimated costs.
Management of money, i.e. loans and shares.
CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Move a rail vehicle around inside the depot.
execute the given command
void Trash()
Trash the backup.
CommandCost CmdTownCargoGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the cargo goal of a town.
uint GetTextRefStackSize() const
Returns the number of uint32 values for the TextRefStack of the error message.
Functions related to companies.
CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clear an OrderBackup.
CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Alter a group.
CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Display a story page for all clients that are allowed to view the story page.
static uint MapSize()
Get the size of the map.
bool _generating_world
Whether we are generating the map or not.
CommandCost CmdOpenCloseAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Open/close an airport to incoming aircraft.
CommandCost CmdChangeBankBalance(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the bank bank balance of a company by inserting or removing money without affecting the loan...
CommandProc * proc
The procedure to actually executing.
CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the name of the president.
CompanyByte _current_company
Company currently doing an action.
uint32 TileIndex
The index/ID of a Tile.
CommandFlags flags
The (command) flags to that apply to this command.
Modifications to route management (orders, groups, etc).
CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Builds a lock.
Types used for networking.
uint8 command_pause_level
level/amount of commands that can't be executed while paused
CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a buoy.
CommandCost CmdCustomNewsItem(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new custom news item.
CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Add all vehicles in the given group to the default group and then deletes the group.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Convert existing rail to waypoint.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
TileIndex last_build_coordinate
Coordinate of the last build thing by this company.
CommandCost CmdRenameEngine(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename an engine.
CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a long piece of road.
#define return_dcpi(cmd)
Helper to deduplicate the code for returning.
CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a goal.
CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new story page.
void SubtractMoneyFromCompany(CommandCost cost)
Subtract money from the _current_company, if the company is valid.
CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Defines the callback type for all command handler functions.
Functions related to OTTD's landscape.
CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Increase the loan of your company.
Stopping, starting, sending to depot, turning around, replace orders etc.
Functions related to commands.
static const Command _command_proc_table[]
The master command table.
CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Add/remove refit orders from an order.
CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a single tile from a rail station.
CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Send a vehicle to the depot.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
TileIndex tile
tile command being executed on.
CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Refits a vehicle to the specified cargo type.
bool success
Whether the comment went fine up to this moment.
CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clone/share/copy an order-list of another vehicle.
ConstructionSettings construction
construction of things in-game
CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update goal text of a goal.
void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
Define a callback function for the client, after the command is finished.
the command cannot be executed in a multiplayer game; single-player only
CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the service interval of a vehicle.
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Autoreplaces a vehicle Trains are replaced as a whole chain, free wagons in depot are replaced on the...
CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Place an Airport.
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename a waypoint.
Changing settings related to a company.
CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Add a vehicle to a group.
void Restore()
Restore the variable.
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Reply to a goal question.
CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build rail station.
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Add all shared vehicles of all vehicles from a group.
TYPE GetValue(uint pos) const
Gets the value from a given position.
No user actions may be executed.
Owner
Enum for all companies/owners.
CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a long piece of road.
CommandCost CmdSetGoalCompleted(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update completed state of a goal.
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
Display animated income or costs on the map.
CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change one of the per-company settings.
Functions related to signals.
Functions related to text effects.
CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a single tile from a waypoint.
GUI functions that shouldn't be here.
CommandCost CmdTownSetText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Set a custom text in the Town window.
CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename a town (server-only).
CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Plant a tree.
CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build rail on a stretch of track.
Date _date
Current date in days (day counter)
Money cost
The cost of this action.
CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Sell a vehicle.
Class for backupping variables and making sure they are restored later.
uint32 cmd
command being executed.
CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new town.
allow this command also on MP_VOID tiles
CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a Bridge.
Dynamic data of a loaded NewGRF.
CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Control the companies: add, delete, etc.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Start/Stop a vehicle.