summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2007-02-01 12:51:10 +0000
committerDarkvater <Darkvater@openttd.org>2007-02-01 12:51:10 +0000
commita5228fd33c30008201f111640a29599604ea4552 (patch)
treea608b39bb4ef180225f221d0510f390c4c00fd6a /src/main_gui.cpp
parentfd62bc46d08aa591a546c44445693eef9050911a (diff)
downloadopenttd-a5228fd33c30008201f111640a29599604ea4552.tar.xz
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp62
1 files changed, 49 insertions, 13 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 6aa995766..1a856b9ec 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -1146,18 +1146,19 @@ static const Widget _scen_edit_land_gen_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0223_LAND_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_NONE, 7, 170, 181, 0, 13, STR_NULL, STR_STICKY_BUTTON},
-{ WWT_PANEL, RESIZE_NONE, 7, 0, 181, 14, 95, 0x0, STR_NULL},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 23, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 24, 45, 14, 35, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 46, 67, 14, 35, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 68, 89, 14, 35, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 90, 111, 14, 35, SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 112, 134, 14, 35, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 135, 157, 14, 35, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, // XXX - dynamic
-{ WWT_IMGBTN, RESIZE_NONE, 14, 158, 179, 14, 35, SPR_IMG_TRANSMITTER, STR_028E_PLACE_TRANSMITTER},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 139, 149, 43, 54, STR_0224, STR_0228_INCREASE_SIZE_OF_LAND_AREA},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 139, 149, 56, 67, STR_0225, STR_0229_DECREASE_SIZE_OF_LAND_AREA},
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 34, 149, 75, 86, STR_SE_NEW_WORLD, STR_022A_GENERATE_RANDOM_LAND},
+{ WWT_PANEL, RESIZE_NONE, 7, 0, 181, 14, 102, 0x0, STR_NULL},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 23, 16, 37, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 24, 45, 16, 37, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 46, 67, 16, 37, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 68, 89, 16, 37, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 90, 111, 16, 37, SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 112, 134, 16, 37, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 135, 157, 16, 37, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, // XXX - dynamic
+{ WWT_IMGBTN, RESIZE_NONE, 14, 158, 179, 16, 37, SPR_IMG_TRANSMITTER, STR_028E_PLACE_TRANSMITTER},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 139, 150, 45, 56, SPR_ARROW_UP, STR_0228_INCREASE_SIZE_OF_LAND_AREA},
+{ WWT_IMGBTN, RESIZE_NONE, 14, 139, 150, 58, 69, SPR_ARROW_DOWN, STR_0229_DECREASE_SIZE_OF_LAND_AREA},
+{ WWT_TEXTBTN, RESIZE_NONE, 14, 34, 145, 76, 87, STR_SE_NEW_WORLD, STR_022A_GENERATE_RANDOM_LAND},
+{ WWT_TEXTBTN, RESIZE_NONE, 14, 34, 145, 89, 100, STR_022B_RESET_LANDSCAPE, STR_RESET_LANDSCAPE_TOOLTIP},
{ WIDGETS_END},
};
@@ -1237,6 +1238,34 @@ static OnButtonClick * const _editor_terraform_button_proc[] = {
EditorTerraformClick_Transmitter
};
+
+/** Callback function for the scenario editor 'reset landscape' confirmation window
+ * @param yes_clicked boolean value, true when yes was clicked, false otherwise */
+static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
+{
+ if (confirmed) {
+ Player *p;
+
+ /* Set generating_world to true to get instant-green grass after removing
+ * player property. */
+ _generating_world = true;
+ /* Delete all players */
+ FOR_ALL_PLAYERS(p) {
+ if (p->is_active) {
+ ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
+ p->is_active = false;
+ }
+ }
+ _generating_world = false;
+
+ /* Delete all stations owned by a player */
+ Station *st;
+ FOR_ALL_STATIONS(st) {
+ if (IsValidPlayer(st->owner)) delete st;
+ }
+ }
+}
+
static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
@@ -1296,6 +1325,13 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
HandleButtonClick(w, 14);
ShowCreateScenario();
break;
+ case 15: /* Reset landscape */
+ ShowQuery(
+ STR_022C_RESET_LANDSCAPE,
+ STR_RESET_LANDSCAPE_CONFIRMATION_TEXT,
+ NULL,
+ ResetLandscapeConfirmationCallback);
+ break;
}
break;
@@ -1332,7 +1368,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
}
static const WindowDesc _scen_edit_land_gen_desc = {
- WDP_AUTO, WDP_AUTO, 182, 96,
+ WDP_AUTO, WDP_AUTO, 182, 103,
WC_SCEN_LAND_GEN,0,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_scen_edit_land_gen_widgets,