summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-04-20 12:52:02 +0000
committerDarkvater <darkvater@openttd.org>2005-04-20 12:52:02 +0000
commit29347840c2ad7401b19d4998038de496733bd295 (patch)
tree61e16f646b0b64644bcb6f3b444f20671ddac588
parentcc65bd1702dbe947552945a5bb35a2d0307207fb (diff)
downloadopenttd-29347840c2ad7401b19d4998038de496733bd295.tar.xz
(svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
-rw-r--r--intro_gui.c71
-rw-r--r--lang/english.txt10
2 files changed, 57 insertions, 24 deletions
diff --git a/intro_gui.c b/intro_gui.c
index 0859517de..c42ba0793 100644
--- a/intro_gui.c
+++ b/intro_gui.c
@@ -12,27 +12,29 @@
extern void SwitchMode(int new_mode);
-/*
-static void ShowSelectTutorialWindow()
-{
-}
-*/
+#if 0
+static void ShowSelectTutorialWindow() {}
+#endif
-/* We go from TOP to the BOTTOM and from LEFT to the RIGHT. I know this is
- * a highly unusual concept, guys, but I hope you'll manage to follow. --pasky */
static const Widget _select_game_widgets[] = {
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},
-{ WWT_IMGBTN, RESIZE_NONE, 13, 0, 335, 14, 196, 0x0, STR_NULL},
+{ WWT_IMGBTN, RESIZE_NONE, 13, 0, 335, 14, 196, STR_NULL, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 40, 51, STR_0220_CREATE_SCENARIO,STR_02FE_CREATE_A_CUSTOMIZED_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING},
-{ WWT_PANEL_2, RESIZE_NONE, 12, 10, 85, 69, 122, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
-{ WWT_PANEL_2, RESIZE_NONE, 12, 90, 165, 69, 122, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
-{ WWT_PANEL_2, RESIZE_NONE, 12, 170, 245, 69, 122, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
-{ WWT_PANEL_2, RESIZE_NONE, 12, 250, 325, 69, 122, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE},
-{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 136, 147, STR_SINGLE_PLAYER, STR_02FF_SELECT_SINGLE_PLAYER_GAME},
-{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 136, 147, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME},
+{ WWT_PANEL_2, RESIZE_NONE, 12, 10, 86, 59, 113, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
+{ WWT_PANEL_2, RESIZE_NONE, 12, 90, 166, 59, 113, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
+{ WWT_PANEL_2, RESIZE_NONE, 12, 170, 246, 59, 113, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
+{ WWT_PANEL_2, RESIZE_NONE, 12, 250, 326, 59, 113, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE},
+
+{ WWT_PANEL, RESIZE_NONE, 12, 219, 254, 120, 131, STR_NULL, STR_NULL},
+{ WWT_CLOSEBOX, RESIZE_NONE, 12, 255, 266, 120, 131, STR_0225, STR_NULL},
+{ WWT_PANEL, RESIZE_NONE, 12, 279, 314, 120, 131, STR_NULL, STR_NULL},
+{ WWT_CLOSEBOX, RESIZE_NONE, 12, 315, 326, 120, 131, STR_0225, STR_NULL},
+
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 138, 149, STR_SINGLE_PLAYER, STR_02FF_SELECT_SINGLE_PLAYER_GAME},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 138, 149, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 159, 170, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 159, 170, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 177, 188, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP},
@@ -43,16 +45,25 @@ static const Widget _select_game_widgets[] = {
extern void HandleOnEditText(WindowEvent *e);
extern void HandleOnEditTextCancel(void);
-static void SelectGameWndProc(Window *w, WindowEvent *e) {
- switch(e->event) {
+static void SelectGameWndProc(Window *w, WindowEvent *e)
+{
+ /* We do +/- 6 for the map_xy because 64 is 2^6, but it is the lowest available element */
+ static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID};
+
+ switch (e->event) {
case WE_PAINT:
- w->click_state = (w->click_state & ~(1<<10) & ~(0xF << 6)) | (1 << (_opt_newgame.landscape + 6)) | (1<<10);
+ w->click_state = (w->click_state & ~(1 << 14) & ~(0xF << 6)) | (1 << (_opt_newgame.landscape + 6)) | (1 << 14);
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
DrawWindowWidgets(w);
+
+ DrawString(170, 121, STR_MAPSIZE, 0);
+ DrawString(223, 121, mapsizes[_patches.map_x - 6], 0x10);
+ DrawString(270, 121, STR_BY, 0);
+ DrawString(283, 121, mapsizes[_patches.map_y - 6], 0x10);
break;
case WE_CLICK:
- switch(e->click.widget) {
+ switch (e->click.widget) {
case 2: DoCommandP(0, 0, 0, NULL, CMD_START_NEW_GAME); break;
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
case 4: DoCommandP(0, InteractiveRandom(), 0, NULL, CMD_CREATE_SCENARIO); break;
@@ -61,7 +72,13 @@ static void SelectGameWndProc(Window *w, WindowEvent *e) {
// XXX: Useless usage of the CMD infrastructure?
DoCommandP(0, e->click.widget - 6, 0, NULL, CMD_SET_NEW_LANDSCAPE_TYPE);
break;
- case 11:
+ case 10: case 11: /* Mapsize X */
+ ShowDropDownMenu(w, mapsizes, _patches.map_x - 6, 11, 0, 0);
+ break;
+ case 12: case 13: /* Mapsize Y */
+ ShowDropDownMenu(w, mapsizes, _patches.map_y - 6, 13, 0, 0);
+ break;
+ case 15:
#ifdef ENABLE_NETWORK
if (!_network_available) {
ShowErrorMessage(-1, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
@@ -71,15 +88,23 @@ static void SelectGameWndProc(Window *w, WindowEvent *e) {
ShowErrorMessage(-1 ,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
#endif
break;
- case 12: ShowGameOptions(); break;
- case 13: ShowGameDifficulty(); break;
- case 14: ShowPatchesSelection(); break;
- case 15: AskExitGame(); break;
+ case 16: ShowGameOptions(); break;
+ case 17: ShowGameDifficulty(); break;
+ case 18: ShowPatchesSelection(); break;
+ case 19: AskExitGame(); break;
}
break;
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
case WE_ON_EDIT_TEXT_CANCEL: HandleOnEditTextCancel(); break;
+
+ case WE_DROPDOWN_SELECT: /* Mapsize selection */
+ switch (e->dropdown.button) {
+ case 11: _patches.map_x = e->dropdown.index + 6; break;
+ case 13: _patches.map_y = e->dropdown.index + 6; break;
+ }
+ SetWindowDirty(w);
+ break;
}
}
diff --git a/lang/english.txt b/lang/english.txt
index 197a9ffe7..c78bff835 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -325,6 +325,14 @@ STR_0142_TUTORIAL_DEMONSTRATION :{BLACK}Tutorial
STR_SINGLE_PLAYER :{BLACK}Single player
STR_MULTIPLAYER :{BLACK}Multiplayer
+STR_64 :64
+STR_128 :128
+STR_256 :256
+STR_512 :512
+STR_1024 :1024
+STR_2048 :2048
+STR_MAPSIZE :{BLACK}Mapsize:
+STR_BY :{BLACK}*
STR_0148_GAME_OPTIONS :{BLACK}Game Options
STR_0150_SOMEONE :someone{SKIP}{SKIP}
@@ -1583,7 +1591,7 @@ STR_204D_INITIATE_A_SMALL_LOCAL :{WHITE}{STRING}
STR_204E_INITIATE_A_MEDIUM_LOCAL :{WHITE}{STRING}{}{YELLOW} Initiate a medium local advertising campaign, to attract more passengers and cargo to your transport services.{} Cost: {CURRENCY}
STR_204F_INITIATE_A_LARGE_LOCAL :{WHITE}{STRING}{}{YELLOW} Initiate a large local advertising campaign, to attract more passengers and cargo to your transport services.{} Cost: {CURRENCY}
STR_2050_FUND_THE_RECONSTRUCTION :{WHITE}{STRING}{}{YELLOW} Fund the reconstruction of the urban road network. Causes considerable disruption to road traffic for up to 6 months.{} Cost: {CURRENCY}
-STR_2051_BUILD_A_STATUE_IN_HONOR :{WHITE}{STRING}{}{YELLOW} Build a statue in honor of your company.{} Cost: {CURRENCY}
+STR_2051_BUILD_A_STATUE_IN_HONOR :{WHITE}{STRING}{}{YELLOW} Build a statue in honour of your company.{} Cost: {CURRENCY}
STR_2052_FUND_THE_CONSTRUCTION_OF :{WHITE}{STRING}{}{YELLOW} Fund the construction of new commercial buildings in the town.{} Cost: {CURRENCY}
STR_2053_BUY_1_YEAR_S_EXCLUSIVE :{WHITE}{STRING}{}{YELLOW} Buy 1 year's exclusive transport rights in town. Town authority will only allow passengers and cargo to use your company's stations.{} Cost: {CURRENCY}
STR_TOWN_BRIBE_THE_LOCAL_AUTHORITY_DESC :{WHITE}{STRING}{}{YELLOW} Bribe the local authority to increase your rating, at the risk of a severe penalty if caught.{} Cost: {CURRENCY}