summaryrefslogtreecommitdiff
path: root/command.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-04-14 11:17:36 +0000
committertron <tron@openttd.org>2005-04-14 11:17:36 +0000
commitcada1e24b50d0a218b9b5ceadefed76b3d848bc5 (patch)
tree447124f75b7bb303261050370767d1ab3335f0c2 /command.h
parent3b9931fcba9586d2beca4f2d2feea37ef3eba047 (diff)
downloadopenttd-cada1e24b50d0a218b9b5ceadefed76b3d848bc5.tar.xz
(svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
Diffstat (limited to 'command.h')
-rw-r--r--command.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/command.h b/command.h
index 90a3283d2..16ececd50 100644
--- a/command.h
+++ b/command.h
@@ -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);