summaryrefslogtreecommitdiff
path: root/src/goal.cpp
diff options
context:
space:
mode:
authordP <dp@dpointer.org>2021-02-02 19:14:26 +0300
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-02-14 23:21:43 +0100
commit91cc414588548e7752fb707b4547f63db597aca1 (patch)
tree22d5f6e1e66286a6e26bd93302bc4fe2f0be0501 /src/goal.cpp
parent751f595bb674192f22d6d091bf68ad263b120c35 (diff)
downloadopenttd-91cc414588548e7752fb707b4547f63db597aca1.tar.xz
Feature: [GS] Allow non-question type windows to have no buttons
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) {