File diff r10854:9dc46af240e5 → r10855:5a3c2f38f98e
src/command.cpp
Show inline comments
 
@@ -211,13 +211,13 @@ static const Command _command_proc_table
 
	{CmdLandscapeClear,                             0}, /* CMD_LANDSCAPE_CLEAR */
 
	{CmdBuildBridge,                         CMD_AUTO}, /* CMD_BUILD_BRIDGE */
 
	{CmdBuildRailroadStation, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_RAILROAD_STATION */
 
	{CmdBuildTrainDepot,      CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_TRAIN_DEPOT */
 
	{CmdBuildSingleSignal,                   CMD_AUTO}, /* CMD_BUILD_SIGNALS */
 
	{CmdRemoveSingleSignal,                  CMD_AUTO}, /* CMD_REMOVE_SIGNALS */
 
	{CmdTerraformLand,                       CMD_AUTO}, /* CMD_TERRAFORM_LAND */
 
	{CmdTerraformLand,       CMD_ALL_TILES | CMD_AUTO}, /* CMD_TERRAFORM_LAND */
 
	{CmdPurchaseLandArea,     CMD_NO_WATER | CMD_AUTO}, /* CMD_PURCHASE_LAND_AREA */
 
	{CmdSellLandArea,                               0}, /* CMD_SELL_LAND_AREA */
 
	{CmdBuildTunnel,                         CMD_AUTO}, /* CMD_BUILD_TUNNEL */
 
	{CmdRemoveFromRailroadStation,                  0}, /* CMD_REMOVE_FROM_RAILROAD_STATION */
 
	{CmdConvertRail,                                0}, /* CMD_CONVERT_RAILD */
 
	{CmdBuildTrainWaypoint,                         0}, /* CMD_BUILD_TRAIN_WAYPOINT */
 
@@ -308,13 +308,13 @@ static const Command _command_proc_table
 
	{CmdClearArea,                        CMD_NO_TEST}, /* CMD_CLEAR_AREA; destroying multi-tile houses makes town rating differ between test and execution */
 

	
 
	{CmdMoneyCheat,                       CMD_OFFLINE}, /* CMD_MONEY_CHEAT */
 
	{CmdBuildCanal,                          CMD_AUTO}, /* CMD_BUILD_CANAL */
 
	{CmdCompanyCtrl,                                0}, /* CMD_COMPANY_CTRL */
 

	
 
	{CmdLevelLand,             CMD_NO_TEST | CMD_AUTO}, /* CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once */
 
	{CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO}, /* CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once */
 

	
 
	{CmdRefitRailVehicle,                           0}, /* CMD_REFIT_RAIL_VEHICLE */
 
	{CmdRestoreOrderIndex,                          0}, /* CMD_RESTORE_ORDER_INDEX */
 
	{CmdBuildLock,                           CMD_AUTO}, /* CMD_BUILD_LOCK */
 

	
 
	{CmdBuildSignalTrack,                    CMD_AUTO}, /* CMD_BUILD_SIGNAL_TRACK */
 
@@ -400,13 +400,13 @@ CommandCost DoCommand(const CommandConta
 
 */
 
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, const char *text)
 
{
 
	CommandCost res;
 

	
 
	/* Do not even think about executing out-of-bounds tile-commands */
 
	if (!IsValidTile(tile)) return CMD_ERROR;
 
	if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (flags & DC_ALL_TILES) == 0))) return CMD_ERROR;
 

	
 
	CommandProc *proc = _command_proc_table[cmd].proc;
 

	
 
	if (_docommand_recursive == 0) _error_message = INVALID_STRING_ID;
 

	
 
	_docommand_recursive++;
 
@@ -494,15 +494,12 @@ bool DoCommandP(const CommandContainer *
 
 * @return true if the command succeeded, else false
 
 */
 
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd)
 
{
 
	assert(_docommand_recursive == 0);
 

	
 
	/* Do not even think about executing out-of-bounds tile-commands */
 
	if (!IsValidTile(tile)) return false;
 

	
 
	CommandCost res, res2;
 

	
 
	int x = TileX(tile) * TILE_SIZE;
 
	int y = TileY(tile) * TILE_SIZE;
 

	
 
	_error_message = INVALID_STRING_ID;
 
@@ -525,12 +522,15 @@ bool DoCommandP(TileIndex tile, uint32 p
 

	
 
	/* Command flags are used internally */
 
	uint cmd_flags = GetCommandFlags(cmd);
 
	/* Flags get send to the DoCommand */
 
	uint32 flags = CommandFlagsToDCFlags(cmd_flags);
 

	
 
	/* Do not even think about executing out-of-bounds tile-commands */
 
	if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return false;
 

	
 
	bool notest = (cmd_flags & CMD_NO_TEST) != 0;
 

	
 
	_docommand_recursive = 1;
 

	
 
	/* cost estimation only? */
 
	if (!IsGeneratingWorld() &&