summaryrefslogtreecommitdiff
path: root/src/goal_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-21 12:03:55 +0000
committerrubidium <rubidium@openttd.org>2012-01-21 12:03:55 +0000
commit9f162e7115031cb42f80db399d63774f479c4125 (patch)
tree42ece87142f91c22e55202c1bb4dcdd986554e56 /src/goal_gui.cpp
parent70c7fbd90eb0ace75d759725ba4d0085283f152c (diff)
downloadopenttd-9f162e7115031cb42f80db399d63774f479c4125.tar.xz
(svn r23827) -Feature [FS#4992]: [NoGo] Allow to chose the goal question window's title from a (small) set of options
Diffstat (limited to 'src/goal_gui.cpp')
-rw-r--r--src/goal_gui.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp
index abfb5a452..70dd6d5df 100644
--- a/src/goal_gui.cpp
+++ b/src/goal_gui.cpp
@@ -258,13 +258,15 @@ struct GoalQuestionWindow : Window {
char *question;
int buttons;
int button[3];
+ byte type;
- GoalQuestionWindow(const WindowDesc *desc, WindowNumber window_number, uint32 button_mask, const char *question) : Window()
+ GoalQuestionWindow(const WindowDesc *desc, WindowNumber window_number, byte type, uint32 button_mask, const char *question) : Window(), type(type)
{
+ assert(type < GOAL_QUESTION_TYPE_COUNT);
this->question = strdup(question);
/* Figure out which buttons we have to enable */
- int bit;
+ uint bit;
int n = 0;
FOR_EACH_SET_BIT(bit, button_mask) {
if (bit >= GOAL_QUESTION_BUTTON_COUNT) break;
@@ -287,6 +289,10 @@ struct GoalQuestionWindow : Window {
virtual void SetStringParameters(int widget) const
{
switch (widget) {
+ case WID_GQ_CAPTION:
+ SetDParam(0, STR_GOAL_QUESTION_CAPTION_QUESTION + this->type);
+ break;
+
case WID_GQ_BUTTON_1:
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[0]);
break;
@@ -341,7 +347,7 @@ struct GoalQuestionWindow : Window {
static const NWidgetPart _nested_goal_question_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
- NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_GOAL_QUESTION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_GQ_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GQ_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0),
@@ -371,7 +377,7 @@ static const WindowDesc _goal_question_list_desc(
);
-void ShowGoalQuestion(uint16 id, uint32 button_mask, const char *question)
+void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question)
{
- new GoalQuestionWindow(&_goal_question_list_desc, id, button_mask, question);
+ new GoalQuestionWindow(&_goal_question_list_desc, id, type, button_mask, question);
}