Changeset - r13121:92c390f71088
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-09-25 19:36:09
rubidium@openttd.org
(svn r17636) -Codechange: make the difficulty setting window nested
1 file changed with 4 insertions and 19 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -523,22 +523,6 @@ enum GameDifficultyWidgets {
 
	GDW_CANCEL,
 
};
 

	
 
/* Widget definition for the game difficulty settings window */
 
static const Widget _game_difficulty_widgets[] = {
 
{    WWT_CAPTION,   RESIZE_NONE,  COLOUR_MAUVE,      0,   369,     0,    13, STR_DIFFICULTY_LEVEL_CAPTION,           STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // GDW_CAPTION
 
{      WWT_PANEL,   RESIZE_NONE,  COLOUR_MAUVE,      0,   369,    14,    41, 0x0,                                    STR_NULL},                           // GDW_UPPER_BG
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_YELLOW,    10,    96,    16,    27, STR_DIFFICULTY_LEVEL_EASY,              STR_NULL},                           // GDW_LVL_EASY
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_YELLOW,    97,   183,    16,    27, STR_DIFFICULTY_LEVEL_MEDIUM,            STR_NULL},                           // GDW_LVL_MEDIUM
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_YELLOW,   184,   270,    16,    27, STR_DIFFICULTY_LEVEL_HARD,              STR_NULL},                           // GDW_LVL_HARD
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_YELLOW,   271,   357,    16,    27, STR_DIFFICULTY_LEVEL_CUSTOM,            STR_NULL},                           // GDW_LVL_CUSTOM
 
{    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_GREEN,     10,   357,    28,    39, STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL},                           // GDW_HIGHSCORE
 
{      WWT_PANEL,   RESIZE_NONE,  COLOUR_MAUVE,      0,   369,    42,   262, 0x0,                                    STR_NULL},                           // GDW_SETTING_BG
 
{      WWT_PANEL,   RESIZE_NONE,  COLOUR_MAUVE,      0,   369,   263,   278, 0x0,                                    STR_NULL},                           // GDW_LOWER_BG
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_YELLOW,   105,   185,   265,   276, STR_DIFFICULTY_LEVEL_SAVE,               STR_NULL},                           // GDW_ACCEPT
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_YELLOW,   186,   266,   265,   276, STR_BUTTON_CANCEL,                       STR_NULL},                           // GDW_CANCEL
 
{   WIDGETS_END},
 
};
 

	
 
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),
 
@@ -577,7 +561,7 @@ static const WindowDesc _game_difficulty
 
	WDP_CENTER, WDP_CENTER, 370, 279, 370, 279,
 
	WC_GAME_OPTIONS, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
 
	_game_difficulty_widgets, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
 
	NULL, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
 
);
 

	
 
void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
 
@@ -599,8 +583,10 @@ private:
 
	};
 

	
 
public:
 
	GameDifficultyWindow() : Window(&_game_difficulty_desc)
 
	GameDifficultyWindow() : Window()
 
	{
 
		this->InitNested(&_game_difficulty_desc);
 

	
 
		/* Copy current settings (ingame or in intro) to temporary holding place
 
		 * change that when setting stuff, copy back on clicking 'OK' */
 
		this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
 
@@ -618,7 +604,6 @@ public:
 
		this->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
 
		this->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client)
 
		this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
 
		this->FindWindowPlacementAndResize(&_game_difficulty_desc);
 
	}
 

	
 
	virtual void OnPaint()
0 comments (0 inline, 0 general)