command.h
changeset 1691 fcd9fefaed02
parent 1623 30298d952174
child 1713 d970350410b2
--- a/command.h	Thu Apr 14 09:58:04 2005 +0000
+++ b/command.h	Thu Apr 14 11:17:36 2005 +0000
@@ -177,6 +177,12 @@
 //#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);