|
@@ -76,49 +76,49 @@ struct SelectGameWindow : public Window
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
this->DrawWidgets();
|
|
|
}
|
|
|
|
|
|
virtual void SetStringParameters(int widget) const
|
|
|
{
|
|
|
if (widget == SGI_DIFFICULTIES) SetDParam(0, STR_DIFFICULTY_LEVEL_EASY + _settings_newgame.difficulty.diff_level);
|
|
|
}
|
|
|
|
|
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
|
|
{
|
|
|
if (widget != SGI_DIFFICULTIES) return;
|
|
|
|
|
|
Dimension textdim = {0, 0};
|
|
|
for (uint i = STR_DIFFICULTY_LEVEL_EASY; i <= STR_DIFFICULTY_LEVEL_CUSTOM; i++) {
|
|
|
SetDParam(0, i);
|
|
|
textdim = maxdim(textdim, GetStringBoundingBox(STR_INTRO_DIFFICULTY));
|
|
|
}
|
|
|
textdim.width += padding.width;
|
|
|
textdim.height += padding.height;
|
|
|
*size = maxdim(*size, textdim);
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
|
{
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
/* Do not create a network server when you (just) have closed one of the game
|
|
|
* creation/load windows for the network server. */
|
|
|
if (IsInsideMM(widget, SGI_GENERATE_GAME, SGI_EDIT_SCENARIO + 1)) _is_network_server = false;
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
|
|
|
switch (widget) {
|
|
|
case SGI_GENERATE_GAME:
|
|
|
if (_ctrl_pressed) {
|
|
|
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
|
|
} else {
|
|
|
ShowGenerateLandscape();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case SGI_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
|
|
|
case SGI_PLAY_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
|
|
|
case SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
|
|
|
case SGI_EDIT_SCENARIO: StartScenarioEditor(); break;
|
|
|
|
|
|
case SGI_PLAY_NETWORK:
|
|
|
if (!_network_available) {
|
|
|
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
|