command.h
changeset 1804 fbe724472bb4
parent 1796 614d996f6be7
child 1820 d03c56850dc2
equal deleted inserted replaced
1803:8fd9dca6d2c6 1804:fbe724472bb4
   157 	CMD_NETWORK_COMMAND = 0x800,		// execute the command without sending it on the network
   157 	CMD_NETWORK_COMMAND = 0x800,		// execute the command without sending it on the network
   158 	CMD_NO_TEST_IF_IN_NETWORK = 0x1000, // When enabled, the command will bypass the no-DC_EXEC round if in network
   158 	CMD_NO_TEST_IF_IN_NETWORK = 0x1000, // When enabled, the command will bypass the no-DC_EXEC round if in network
   159 	CMD_SHOW_NO_ERROR = 0x2000,
   159 	CMD_SHOW_NO_ERROR = 0x2000,
   160 };
   160 };
   161 
   161 
       
   162 /** Command flags for the command table
       
   163  * @see _command_proc_table
       
   164  */
       
   165 enum {
       
   166 	CMD_SERVER  = 0x1, /// the command can only be initiated by the server
       
   167 	CMD_OFFLINE = 0x2, /// the command cannot be executed in a multiplayer game; single-player only
       
   168 };
       
   169 
       
   170 typedef struct Command {
       
   171 	CommandProc *proc;
       
   172 	byte flags;
       
   173 } Command;
       
   174 
   162 //#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
   175 //#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
   163 #define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)
   176 #define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)
   164 
   177 
   165 /**
   178 /**
   166  * Check the return value of a DoCommand*() function
   179  * Check the return value of a DoCommand*() function
   176 /* command.c */
   189 /* command.c */
   177 int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
   190 int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
   178 int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
   191 int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
   179 
   192 
   180 bool IsValidCommand(uint cmd);
   193 bool IsValidCommand(uint cmd);
       
   194 byte GetCommandFlags(uint cmd);
   181 int32 GetAvailableMoneyForCommand(void);
   195 int32 GetAvailableMoneyForCommand(void);
   182 
   196 
   183 /* Validate functions for rail building */
       
   184 static inline bool ValParamRailtype(uint32 rail) { return rail <= GetPlayer(_current_player)->max_railtype;}
       
   185 #endif /* COMMAND_H */
   197 #endif /* COMMAND_H */