command.h
changeset 3491 35d747bb5e82
parent 2819 f25fb6ee397f
child 3990 a317e665fb77
equal deleted inserted replaced
3490:d53bc3e794bd 3491:35d747bb5e82
   167 enum {
   167 enum {
   168 	CMD_SERVER  = 0x1, /// the command can only be initiated by the server
   168 	CMD_SERVER  = 0x1, /// the command can only be initiated by the server
   169 	CMD_OFFLINE = 0x2, /// the command cannot be executed in a multiplayer game; single-player only
   169 	CMD_OFFLINE = 0x2, /// the command cannot be executed in a multiplayer game; single-player only
   170 };
   170 };
   171 
   171 
       
   172 typedef int32 CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
       
   173 
   172 typedef struct Command {
   174 typedef struct Command {
   173 	CommandProc *proc;
   175 	CommandProc *proc;
   174 	byte flags;
   176 	byte flags;
   175 } Command;
   177 } Command;
   176 
   178 
   187 	// lower 16bits are the StringID of the possible error
   189 	// lower 16bits are the StringID of the possible error
   188 	return res <= (CMD_ERROR | INVALID_STRING_ID);
   190 	return res <= (CMD_ERROR | INVALID_STRING_ID);
   189 }
   191 }
   190 
   192 
   191 /* command.c */
   193 /* command.c */
   192 int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
   194 int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
   193 int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
       
   194 
   195 
   195 extern const char* _cmd_text; // Text, which gets sent with a command
   196 extern const char* _cmd_text; // Text, which gets sent with a command
   196 
   197 
   197 bool IsValidCommand(uint cmd);
   198 bool IsValidCommand(uint cmd);
   198 byte GetCommandFlags(uint cmd);
   199 byte GetCommandFlags(uint cmd);