(svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.

This commit is contained in:
tron
2005-04-14 11:17:36 +00:00
parent 3b9931fcba
commit cada1e24b5
3 changed files with 15 additions and 9 deletions

View File

@@ -177,6 +177,12 @@ enum {
//#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
#define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)
static inline bool CmdFailed(int32 res)
{
// lower 16bits are the StringID of the possible error
return res <= (CMD_ERROR | INVALID_STRING_ID);
}
/* command.c */
int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);