author | convert-repo |
Mon, 07 Apr 2008 16:21:55 +0000 | |
changeset 10076 | dfd70e42c4ae |
parent 8920 | 04df97185061 |
child 10230 | bf81856a1101 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6150
diff
changeset
|
3 |
/** @file intro_gui.cpp */ |
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6150
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1796
diff
changeset
|
6 |
#include "openttd.h" |
0 | 7 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
8 |
#include "window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
9 |
#include "textbuf_gui.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5682
diff
changeset
|
10 |
#include "network/network.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
1891
diff
changeset
|
11 |
#include "variables.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
12 |
#include "heightmap.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
13 |
#include "genworld.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5682
diff
changeset
|
14 |
#include "network/network_gui.h" |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
4938
diff
changeset
|
15 |
#include "newgrf.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8603
diff
changeset
|
16 |
#include "strings_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8617
diff
changeset
|
17 |
#include "window_func.h" |
8645
83500ad80b08
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
8627
diff
changeset
|
18 |
#include "fios.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8704
diff
changeset
|
19 |
#include "gfx_func.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
20 |
#include "settings_type.h" |
0 | 21 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
22 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
23 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
24 |
|
0 | 25 |
static const Widget _select_game_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
26 |
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL}, |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
4938
diff
changeset
|
27 |
{ WWT_PANEL, RESIZE_NONE, 13, 0, 335, 14, 194, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
28 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
29 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
30 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
31 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 40, 51, STR_PLAY_HEIGHTMAP, STR_PLAY_HEIGHTMAP_HINT}, |
6145
d34703513ed0
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
6144
diff
changeset
|
32 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 58, 69, STR_SCENARIO_EDITOR, STR_02FE_CREATE_A_CUSTOMIZED_GAME}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
33 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 58, 69, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME}, |
1711
786fc0df2b6e
(svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents:
1625
diff
changeset
|
34 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
35 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 77, 131, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
36 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 77, 131, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
37 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 77, 131, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
38 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 77, 131, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE}, |
1711
786fc0df2b6e
(svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents:
1625
diff
changeset
|
39 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
40 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 139, 150, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
41 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 139, 150, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
42 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 157, 168, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP}, |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
4938
diff
changeset
|
43 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 157, 168, STR_NEWGRF_SETTINGS_BUTTON, STR_NULL}, |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
4938
diff
changeset
|
44 |
|
5315
ce659994e392
(svn r7471) -Codechange: Centre the 'quit' button on the main menu.
Darkvater
parents:
5237
diff
changeset
|
45 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 104, 231, 175, 186, STR_0304_QUIT, STR_0305_QUIT_OPENTTD}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
46 |
{ WIDGETS_END}, |
0 | 47 |
}; |
48 |
||
1794
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
49 |
static inline void SetNewLandscapeType(byte landscape) |
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
50 |
{ |
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
51 |
_opt_newgame.landscape = landscape; |
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
52 |
InvalidateWindowClasses(WC_SELECT_GAME); |
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
53 |
} |
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
54 |
|
8861
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
55 |
enum SelectGameIntroWidgets { |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
56 |
SGI_GENERATE_GAME = 2, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
57 |
SGI_LOAD_GAME, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
58 |
SGI_PLAY_SCENARIO, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
59 |
SGI_PLAY_HEIGHTMAP, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
60 |
SGI_EDIT_SCENARIO, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
61 |
SGI_PLAY_NETWORK, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
62 |
SGI_TEMPERATE_LANDSCAPE, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
63 |
SGI_ARCTIC_LANDSCAPE, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
64 |
SGI_TROPIC_LANDSCAPE, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
65 |
SGI_TOYLAND_LANDSCAPE, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
66 |
SGI_OPTIONS, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
67 |
SGI_DIFFICULTIES, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
68 |
SGI_PATCHES_OPTIONS, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
69 |
SGI_GRF_SETTINGS, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
70 |
SGI_EXIT, |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
71 |
}; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
72 |
|
1711
786fc0df2b6e
(svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents:
1625
diff
changeset
|
73 |
static void SelectGameWndProc(Window *w, WindowEvent *e) |
786fc0df2b6e
(svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents:
1625
diff
changeset
|
74 |
{ |
786fc0df2b6e
(svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents:
1625
diff
changeset
|
75 |
switch (e->event) { |
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
76 |
case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + 8); break; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4634
diff
changeset
|
77 |
|
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
78 |
case WE_PAINT: |
8861
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
79 |
w->SetWidgetLoweredState(SGI_TEMPERATE_LANDSCAPE, _opt_newgame.landscape == LT_TEMPERATE); |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
80 |
w->SetWidgetLoweredState(SGI_ARCTIC_LANDSCAPE, _opt_newgame.landscape == LT_ARCTIC); |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
81 |
w->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _opt_newgame.landscape == LT_TROPIC); |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
82 |
w->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _opt_newgame.landscape == LT_TOYLAND); |
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
83 |
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level); |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
84 |
DrawWindowWidgets(w); |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
85 |
break; |
0 | 86 |
|
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
87 |
case WE_CLICK: |
7394
75d35728b8b1
(svn r10145) -Fix: make compiling with networking disabled (again) possible.
rubidium
parents:
7051
diff
changeset
|
88 |
#ifdef ENABLE_NETWORK |
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
89 |
/* Do not create a network server when you (just) have closed one of the game |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
90 |
* creation/load windows for the network server. */ |
8862
5d1cc8ce9d15
(svn r11932) -Codechange: Forgot two occurences of widget enumification
belugas
parents:
8861
diff
changeset
|
91 |
if (SGI_GENERATE_GAME <= e->we.click.widget && e->we.click.widget <= SGI_EDIT_SCENARIO) _is_network_server = false; |
7394
75d35728b8b1
(svn r10145) -Fix: make compiling with networking disabled (again) possible.
rubidium
parents:
7051
diff
changeset
|
92 |
#endif /* ENABLE_NETWORK */ |
7051
d0e0ab1460f0
(svn r9757) -Fix [FS#1244842]: when you have closed the "Load game"/"New game" windows accessible from the "New Server" window, any creation of new game/loading from the intro menu should not start a server.
rubidium
parents:
6683
diff
changeset
|
93 |
|
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
94 |
switch (e->we.click.widget) { |
8861
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
95 |
case SGI_GENERATE_GAME: ShowGenerateLandscape(); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
96 |
case SGI_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
97 |
case SGI_PLAY_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
98 |
case SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
99 |
case SGI_EDIT_SCENARIO: StartScenarioEditor(); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
100 |
|
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
101 |
case SGI_PLAY_NETWORK: |
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
102 |
if (!_network_available) { |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
103 |
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
104 |
} else { |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
105 |
ShowNetworkGameWindow(); |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
106 |
} |
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
107 |
break; |
8861
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
108 |
|
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
109 |
case SGI_TEMPERATE_LANDSCAPE: case SGI_ARCTIC_LANDSCAPE: |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
110 |
case SGI_TROPIC_LANDSCAPE: case SGI_TOYLAND_LANDSCAPE: |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
111 |
w->RaiseWidget(_opt_newgame.landscape + SGI_TEMPERATE_LANDSCAPE); |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
112 |
SetNewLandscapeType(e->we.click.widget - SGI_TEMPERATE_LANDSCAPE); |
8860
719c078f7a80
(svn r11930) -Codechange: a bit of code style application
belugas
parents:
8766
diff
changeset
|
113 |
break; |
8861
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
114 |
|
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
115 |
case SGI_OPTIONS: ShowGameOptions(); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
116 |
case SGI_DIFFICULTIES: ShowGameDifficulty(); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
117 |
case SGI_PATCHES_OPTIONS: ShowPatchesSelection(); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
118 |
case SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break; |
c6655b4f7d44
(svn r11931) -Codechange: enumify the widgets numbers. Give breathing room on the case switches too...
belugas
parents:
8860
diff
changeset
|
119 |
case SGI_EXIT: HandleExitGameRequest(); break; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3888
diff
changeset
|
120 |
} |
0 | 121 |
break; |
122 |
} |
|
123 |
} |
|
124 |
||
125 |
static const WindowDesc _select_game_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7762
diff
changeset
|
126 |
WDP_CENTER, WDP_CENTER, 336, 195, 336, 195, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5835
diff
changeset
|
127 |
WC_SELECT_GAME, WC_NONE, |
0 | 128 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
129 |
_select_game_widgets, |
|
130 |
SelectGameWndProc |
|
131 |
}; |
|
132 |
||
6573 | 133 |
void ShowSelectGameWindow() |
0 | 134 |
{ |
135 |
AllocateWindowDesc(&_select_game_desc); |
|
136 |
} |
|
137 |
||
5670
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
138 |
static void AskExitGameCallback(Window *w, bool confirmed) |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
139 |
{ |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
140 |
if (confirmed) _exit_game = true; |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
141 |
} |
0 | 142 |
|
6573 | 143 |
void AskExitGame() |
2639 | 144 |
{ |
0 | 145 |
#if defined(_WIN32) |
8920
04df97185061
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8862
diff
changeset
|
146 |
SetDParam(0, STR_OSNAME_WINDOWS); |
0 | 147 |
#elif defined(__APPLE__) |
8920
04df97185061
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8862
diff
changeset
|
148 |
SetDParam(0, STR_OSNAME_OSX); |
0 | 149 |
#elif defined(__BEOS__) |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
150 |
SetDParam(0, STR_OSNAME_BEOS); |
0 | 151 |
#elif defined(__MORPHOS__) |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
152 |
SetDParam(0, STR_OSNAME_MORPHOS); |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
153 |
#elif defined(__AMIGA__) |
587 | 154 |
SetDParam(0, STR_OSNAME_AMIGAOS); |
810
7c51ba5a4368
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents:
774
diff
changeset
|
155 |
#elif defined(__OS2__) |
7c51ba5a4368
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents:
774
diff
changeset
|
156 |
SetDParam(0, STR_OSNAME_OS2); |
6547
c0989f46fd02
(svn r9018) -Change: added SunOS as OS name in the quit dialog
miham
parents:
6527
diff
changeset
|
157 |
#elif defined(SUNOS) |
c0989f46fd02
(svn r9018) -Change: added SunOS as OS name in the quit dialog
miham
parents:
6527
diff
changeset
|
158 |
SetDParam(0, STR_OSNAME_SUNOS); |
0 | 159 |
#else |
8920
04df97185061
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8862
diff
changeset
|
160 |
SetDParam(0, STR_OSNAME_UNIX); |
0 | 161 |
#endif |
5670
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
162 |
ShowQuery( |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
163 |
STR_00C7_QUIT, |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
164 |
STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
165 |
NULL, |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
166 |
AskExitGameCallback |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
167 |
); |
0 | 168 |
} |
169 |
||
170 |
||
5670
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
171 |
static void AskExitToGameMenuCallback(Window *w, bool confirmed) |
2639 | 172 |
{ |
5670
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
173 |
if (confirmed) _switch_mode = SM_MENU; |
0 | 174 |
} |
175 |
||
6573 | 176 |
void AskExitToGameMenu() |
0 | 177 |
{ |
5670
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
178 |
ShowQuery( |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
179 |
STR_0161_QUIT_GAME, |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
180 |
(_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_QUIT_SCENARIO_QUERY, |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
181 |
NULL, |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
182 |
AskExitToGameMenuCallback |
c6dcca763ebb
(svn r7622) -Codechange: Convert some more windows to ShowQuery. This includes the depot
Darkvater
parents:
5352
diff
changeset
|
183 |
); |
0 | 184 |
} |