Index: command.c =================================================================== --- command.c (revision 7633) +++ command.c (working copy) @@ -314,7 +314,7 @@ /* This function range-checks a cmd, and checks if the cmd is not NULL */ bool IsValidCommand(uint cmd) { - cmd &= 0xFF; + cmd &= CMD_MASK; return cmd < lengthof(_command_proc_table) && @@ -323,7 +323,7 @@ byte GetCommandFlags(uint cmd) { - return _command_proc_table[cmd & 0xFF].flags; + return _command_proc_table[cmd & CMD_MASK].flags; } @@ -437,8 +437,8 @@ if (cmd & CMD_NO_WATER) flags |= DC_NO_WATER; // get pointer to command handler - assert((cmd & 0xFF) < lengthof(_command_proc_table)); - proc = _command_proc_table[cmd & 0xFF].proc; + assert((cmd & CMD_MASK) < lengthof(_command_proc_table)); + proc = _command_proc_table[cmd & CMD_MASK].proc; if (proc == NULL) { _cmd_text = NULL; return false; @@ -454,16 +454,16 @@ // disconnect the road system), but the exec will succeed and this // fact will trigger an assertion failure. --pasky notest = - (cmd & 0xFF) == CMD_CLEAR_AREA || - (cmd & 0xFF) == CMD_CONVERT_RAIL || - (cmd & 0xFF) == CMD_LEVEL_LAND || - (cmd & 0xFF) == CMD_REMOVE_ROAD || - (cmd & 0xFF) == CMD_REMOVE_LONG_ROAD; + (cmd & CMD_MASK) == CMD_CLEAR_AREA || + (cmd & CMD_MASK) == CMD_CONVERT_RAIL || + (cmd & CMD_MASK) == CMD_LEVEL_LAND || + (cmd & CMD_MASK) == CMD_REMOVE_ROAD || + (cmd & CMD_MASK) == CMD_REMOVE_LONG_ROAD; _docommand_recursive = 1; // cost estimation only? - if (!IsGeneratingWorld() && _shift_pressed && IsLocalPlayer() && !(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR))) { + if (!IsGeneratingWorld() && _shift_pressed && IsLocalPlayer() && !(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR)) && ((cmd & CMD_MASK) != CMD_PAUSE)) { // estimate the cost. res = proc(tile, flags, p1, p2); if (CmdFailed(res)) { Index: command.h =================================================================== --- command.h (revision 7633) +++ command.h (working copy) @@ -142,7 +142,12 @@ CMD_DEPOT_MASS_AUTOREPLACE = 119, }; +/* Specifies which bits are used in the actual command specification (as opposed to any optional flags) such as CMD_NETWORK_COMMAND */ enum { + CMD_MASK = 0xFF +}; + +enum { DC_EXEC = 0x01, DC_AUTO = 0x02, // don't allow building on structures DC_QUERY_COST = 0x04, // query cost only, don't build.