From 5dcb9e63e361d3212f1b4dbeb7f4253b23d45473 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 12 Jan 2009 15:27:39 +0000 Subject: (svn r15014) -Codechange: Add a helper function to get the needed DC_xxx flags from the result of GetCommandFlags(). --- src/command_func.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/command_func.h') diff --git a/src/command_func.h b/src/command_func.h index 1b8af25b9..a6b77c6a0 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -86,4 +86,17 @@ byte GetCommandFlags(uint32 cmd); */ Money GetAvailableMoneyForCommand(); +/** + * Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags + * @param cmd_flags Flags from GetCommandFlags + * @return flags for DoCommand + */ +static inline uint32 CommandFlagsToDCFlags(uint cmd_flags) +{ + uint32 flags = 0; + if (cmd_flags & CMD_NO_WATER) flags |= DC_NO_WATER; + if (cmd_flags & CMD_AUTO) flags |= DC_AUTO; + return flags; +} + #endif /* COMMAND_FUNC_H */ -- cgit v1.2.3-70-g09d2