summaryrefslogtreecommitdiff
path: root/src/goal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/goal.cpp')
-rw-r--r--src/goal.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/goal.cpp b/src/goal.cpp
index 954d2f7bf..8ce8e2337 100644
--- a/src/goal.cpp
+++ b/src/goal.cpp
@@ -260,8 +260,9 @@ CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
} else {
if (company != INVALID_COMPANY && !Company::IsValidID(company)) return CMD_ERROR;
}
- if (CountBits(button_mask) < 1 || CountBits(button_mask) > 3) return CMD_ERROR;
- if (type >= GOAL_QUESTION_TYPE_COUNT) return CMD_ERROR;
+ uint min_buttons = (type == GQT_QUESTION ? 1 : 0);
+ if (CountBits(button_mask) < min_buttons || CountBits(button_mask) > 3) return CMD_ERROR;
+ if (type >= GQT_END) return CMD_ERROR;
if (flags & DC_EXEC) {
if (is_client) {