src/command.cpp
changeset 6943 1914f26aee04
parent 6832 fec0caeac27d
child 6950 14ecb0acdfb4
equal deleted inserted replaced
6942:9a0a07c109d0 6943:1914f26aee04
    15 #include "variables.h"
    15 #include "variables.h"
    16 #include "genworld.h"
    16 #include "genworld.h"
    17 
    17 
    18 const char* _cmd_text = NULL;
    18 const char* _cmd_text = NULL;
    19 
    19 
    20 #define DEF_COMMAND(yyyy) int32 yyyy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
    20 #define DEF_COMMAND(yyyy) CommandCost yyyy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
    21 
    21 
    22 DEF_COMMAND(CmdBuildRailroadTrack);
    22 DEF_COMMAND(CmdBuildRailroadTrack);
    23 DEF_COMMAND(CmdRemoveRailroadTrack);
    23 DEF_COMMAND(CmdRemoveRailroadTrack);
    24 DEF_COMMAND(CmdBuildSingleRail);
    24 DEF_COMMAND(CmdBuildSingleRail);
    25 DEF_COMMAND(CmdRemoveSingleRail);
    25 DEF_COMMAND(CmdRemoveSingleRail);
   349 }
   349 }
   350 
   350 
   351 
   351 
   352 static int _docommand_recursive;
   352 static int _docommand_recursive;
   353 
   353 
   354 int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
   354 CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
   355 {
   355 {
   356 	int32 res;
   356 	CommandCost res;
   357 	CommandProc *proc;
   357 	CommandProc *proc;
   358 
   358 
   359 	/* Do not even think about executing out-of-bounds tile-commands */
   359 	/* Do not even think about executing out-of-bounds tile-commands */
   360 	if (tile >= MapSize() || IsTileType(tile, MP_VOID)) {
   360 	if (tile >= MapSize() || IsTileType(tile, MP_VOID)) {
   361 		_cmd_text = NULL;
   361 		_cmd_text = NULL;
   423 
   423 
   424 /* toplevel network safe docommand function for the current player. must not be called recursively.
   424 /* toplevel network safe docommand function for the current player. must not be called recursively.
   425  * the callback is called when the command succeeded or failed. */
   425  * the callback is called when the command succeeded or failed. */
   426 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
   426 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
   427 {
   427 {
   428 	int32 res = 0, res2;
   428 	CommandCost res = 0, res2;
   429 	CommandProc *proc;
   429 	CommandProc *proc;
   430 	uint32 flags;
   430 	uint32 flags;
   431 	bool notest;
   431 	bool notest;
   432 	StringID error_part1;
   432 	StringID error_part1;
   433 
   433