summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-25 19:42:57 +0000
committerrubidium <rubidium@openttd.org>2009-09-25 19:42:57 +0000
commit025876aa25ea8211cc0b1cd6f88dd65979bd4d2c (patch)
tree83e58f9ed323aaafcbe66d9a917d569207d09d68 /src
parent2080c0990c3db7ceac1c11375e2f9190e46e7320 (diff)
downloadopenttd-025876aa25ea8211cc0b1cd6f88dd65979bd4d2c.tar.xz
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
Diffstat (limited to 'src')
-rw-r--r--src/settings_gui.cpp89
1 files changed, 45 insertions, 44 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 14e05edd9..eecaa09a0 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -523,47 +523,6 @@ enum GameDifficultyWidgets {
GDW_CANCEL,
};
-static const NWidgetPart _nested_game_difficulty_widgets[] = {
- NWidget(WWT_CAPTION, COLOUR_MAUVE, GDW_CAPTION), SetMinimalSize(370, 14), SetDataTip(STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
- NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_UPPER_BG),
- NWidget(NWID_SPACER), SetMinimalSize(0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetMinimalSize(10, 0),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_EASY), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_EASY, STR_NULL),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_MEDIUM), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_MEDIUM, STR_NULL),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_HARD), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_HARD, STR_NULL),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_CUSTOM), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_CUSTOM, STR_NULL),
- NWidget(NWID_SPACER), SetMinimalSize(12, 0),
- EndContainer(),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetMinimalSize(10, 0),
- NWidget(WWT_TEXTBTN, COLOUR_GREEN, GDW_HIGHSCORE), SetMinimalSize(348, 12), SetDataTip(STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL),
- NWidget(NWID_SPACER), SetMinimalSize(12, 0),
- EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(0, 2),
- EndContainer(),
- NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_SETTING_BG), SetMinimalSize(370, 221),
- EndContainer(),
- NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_LOWER_BG),
- NWidget(NWID_SPACER), SetMinimalSize(0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetMinimalSize(105, 0),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_ACCEPT), SetMinimalSize(81, 12), SetDataTip(STR_DIFFICULTY_LEVEL_SAVE, STR_NULL),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_CANCEL), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
- NWidget(NWID_SPACER), SetMinimalSize(103, 0),
- EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(0, 2),
- EndContainer(),
-};
-
-/* Window definition for the game difficulty settings window */
-static const WindowDesc _game_difficulty_desc(
- WDP_CENTER, WDP_CENTER, 370, 279, 370, 279,
- WC_GAME_OPTIONS, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
- NULL, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
-);
-
void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
struct GameDifficultyWindow : public Window {
@@ -583,9 +542,9 @@ private:
};
public:
- GameDifficultyWindow() : Window()
+ GameDifficultyWindow(const WindowDesc *desc) : Window()
{
- this->InitNested(&_game_difficulty_desc);
+ this->InitNested(desc);
/* Copy current settings (ingame or in intro) to temporary holding place
* change that when setting stuff, copy back on clicking 'OK' */
@@ -740,10 +699,52 @@ public:
}
};
+/** Widget definition for the game difficulty settings window */
+static const NWidgetPart _nested_game_difficulty_widgets[] = {
+ NWidget(WWT_CAPTION, COLOUR_MAUVE, GDW_CAPTION), SetMinimalSize(370, 14), SetDataTip(STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_UPPER_BG),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 2),
+ NWidget(NWID_HORIZONTAL),
+ NWidget(NWID_SPACER), SetMinimalSize(10, 0),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_EASY), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_EASY, STR_NULL),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_MEDIUM), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_MEDIUM, STR_NULL),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_HARD), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_HARD, STR_NULL),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_CUSTOM), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_CUSTOM, STR_NULL),
+ NWidget(NWID_SPACER), SetMinimalSize(12, 0),
+ EndContainer(),
+ NWidget(NWID_HORIZONTAL),
+ NWidget(NWID_SPACER), SetMinimalSize(10, 0),
+ NWidget(WWT_TEXTBTN, COLOUR_GREEN, GDW_HIGHSCORE), SetMinimalSize(348, 12), SetDataTip(STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL),
+ NWidget(NWID_SPACER), SetMinimalSize(12, 0),
+ EndContainer(),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 2),
+ EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_SETTING_BG), SetMinimalSize(370, 221),
+ EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_LOWER_BG),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 2),
+ NWidget(NWID_HORIZONTAL),
+ NWidget(NWID_SPACER), SetMinimalSize(105, 0),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_ACCEPT), SetMinimalSize(81, 12), SetDataTip(STR_DIFFICULTY_LEVEL_SAVE, STR_NULL),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_CANCEL), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
+ NWidget(NWID_SPACER), SetMinimalSize(103, 0),
+ EndContainer(),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 2),
+ EndContainer(),
+};
+
+/** Window definition for the game difficulty settings window */
+static const WindowDesc _game_difficulty_desc(
+ WDP_CENTER, WDP_CENTER, 370, 279, 370, 279,
+ WC_GAME_OPTIONS, WC_NONE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ NULL, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
+);
+
void ShowGameDifficulty()
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
- new GameDifficultyWindow();
+ new GameDifficultyWindow(&_game_difficulty_desc);
}
static const int SETTING_HEIGHT = 11; ///< Height of a single setting in the tree view in pixels