--- a/src/command.h Wed Jun 13 12:05:56 2007 +0000
+++ b/src/command.h Tue Jun 19 07:21:01 2007 +0000
@@ -184,7 +184,7 @@
CMD_OFFLINE = 0x2, ///< the command cannot be executed in a multiplayer game; single-player only
};
-typedef int32 CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
+typedef CommandCost CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
struct Command {
CommandProc *proc;
@@ -199,15 +199,17 @@
* @param res the resulting value from the command to be checked
* @return Return true if the command failed, false otherwise
*/
-static inline bool CmdFailed(int32 res)
+static inline bool CmdFailed(CommandCost res)
{
/* lower 16bits are the StringID of the possible error */
return res <= (CMD_ERROR | INVALID_STRING_ID);
}
+static inline bool CmdSucceeded(CommandCost res) { return !CmdFailed(res); }
+
/* command.cpp */
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
-int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
+CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd);
#ifdef ENABLE_NETWORK