src/terraform_gui.cpp
author rubidium
Tue, 24 Jun 2008 15:58:01 +0000
changeset 9586 bd94ff37f38f
parent 9517 8470042a618f
child 9588 620c97d8cee4
permissions -rw-r--r--
(svn r13624) -Fix [FS#2106]: crash when one tries to raise the nothern corner of MP_VOID tiles (i.e. the southern corner of the tiles on the southern map edge) in the scenario editor.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8790
diff changeset
     3
/** @file terraform_gui.cpp GUI related to terraforming the map. */
6422
6679df1c05ba (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6106
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1780
diff changeset
     6
#include "openttd.h"
5385
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
     7
#include "bridge_map.h"
3144
33e42feae531 (svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents: 3076
diff changeset
     8
#include "clear_map.h"
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8236
diff changeset
     9
#include "player_func.h"
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8236
diff changeset
    10
#include "player_base.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
#include "gui.h"
8107
bb7deea89175 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8106
diff changeset
    12
#include "window_gui.h"
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8210
diff changeset
    13
#include "viewport_func.h"
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8210
diff changeset
    14
#include "gfx_func.h"
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents: 8108
diff changeset
    15
#include "command_func.h"
8790
4a7a796b3976 (svn r12501) -Codechange: split signs.h.
rubidium
parents: 8786
diff changeset
    16
#include "signs_func.h"
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2154
diff changeset
    17
#include "variables.h"
8131
160939e24ed3 (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: 8121
diff changeset
    18
#include "functions.h"
8157
1505def01945 (svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents: 8144
diff changeset
    19
#include "sound_func.h"
8786
1823ff88a054 (svn r12490) -Codechange: rename engine.h to engine_func.h and remove unneeded inclusions of engine.h and/or replace them with engine_type.h.
rubidium
parents: 8472
diff changeset
    20
#include "station_base.h"
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
    21
#include "unmovable_map.h"
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
    22
#include "textbuf_gui.h"
8236
8a5dd0b42e47 (svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents: 8224
diff changeset
    23
#include "genworld.h"
8270
e7c342f6b14c (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents: 8264
diff changeset
    24
#include "settings_type.h"
8459
86e0352eb993 (svn r12029) -Feature: Allow trees on shore.
frosch
parents: 8450
diff changeset
    25
#include "tree_map.h"
9126
5648d696456b (svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium
parents: 9116
diff changeset
    26
#include "landscape_type.h"
9127
14f21c5954ee (svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents: 9126
diff changeset
    27
#include "tilehighlight_func.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    29
#include "table/sprites.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    30
#include "table/strings.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    31
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1919
diff changeset
    32
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
	if (success) {
541
625227bb2a3d (svn r925) Use sound enums
tron
parents: 507
diff changeset
    35
		SndPlayTileFx(SND_1F_SPLAT, tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
	} else {
8210
cc873256f63a (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium
parents: 8205
diff changeset
    37
		extern TileIndex _terraform_err_tile;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
		SetRedErrorSquare(_terraform_err_tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    43
/** Scenario editor command that generates desert areas */
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    44
static void GenerateDesertArea(TileIndex end, TileIndex start)
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    45
{
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    46
	int size_x, size_y;
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    47
	int sx = TileX(start);
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    48
	int sy = TileY(start);
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    49
	int ex = TileX(end);
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    50
	int ey = TileY(end);
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    51
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    52
	if (_game_mode != GM_EDITOR) return;
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    53
6106
2898cd9417fd (svn r8841) -Fix
tron
parents: 5893
diff changeset
    54
	if (ex < sx) Swap(ex, sx);
2898cd9417fd (svn r8841) -Fix
tron
parents: 5893
diff changeset
    55
	if (ey < sy) Swap(ey, sy);
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    56
	size_x = (ex - sx) + 1;
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    57
	size_y = (ey - sy) + 1;
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    58
1710
c0a2a17cf887 (svn r2214) - Fix: Dragging the desert tool over half-desert turns it into full-desert; dragging the tool while pressing ctrl, will remove the desert area.
Darkvater
parents: 1632
diff changeset
    59
	_generating_world = true;
1981
3c9c682f1212 (svn r2487) Replace TILE_XY by TileXY/TileDiffXY
tron
parents: 1977
diff changeset
    60
	BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
1710
c0a2a17cf887 (svn r2214) - Fix: Dragging the desert tool over half-desert turns it into full-desert; dragging the tool while pressing ctrl, will remove the desert area.
Darkvater
parents: 1632
diff changeset
    61
		if (GetTileType(tile) != MP_WATER) {
8450
73371bb82922 (svn r12020) -Documentation: Correct description of TropicZone.
frosch
parents: 8444
diff changeset
    62
			SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
1780
082dfd92c20b (svn r2284) - Fix (regression): [ 1197177 ] Scenario editor: desert add/remove tool removes industries. Fixed a bit too agressive desert generator. It still does remove the industry (sand's a bitch on machinery), but at least it does it cleanly :)
Darkvater
parents: 1710
diff changeset
    63
			DoCommandP(tile, 0, 0, NULL, CMD_LANDSCAPE_CLEAR);
1710
c0a2a17cf887 (svn r2214) - Fix: Dragging the desert tool over half-desert turns it into full-desert; dragging the tool while pressing ctrl, will remove the desert area.
Darkvater
parents: 1632
diff changeset
    64
			MarkTileDirtyByTile(tile);
c0a2a17cf887 (svn r2214) - Fix: Dragging the desert tool over half-desert turns it into full-desert; dragging the tool while pressing ctrl, will remove the desert area.
Darkvater
parents: 1632
diff changeset
    65
		}
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    66
	} END_TILE_LOOP(tile, size_x, size_y, 0);
1710
c0a2a17cf887 (svn r2214) - Fix: Dragging the desert tool over half-desert turns it into full-desert; dragging the tool while pressing ctrl, will remove the desert area.
Darkvater
parents: 1632
diff changeset
    67
	_generating_world = false;
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    68
}
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
    69
3017
a75caf4efa2d (svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents: 2955
diff changeset
    70
/** Scenario editor command that generates rocky areas */
2615
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    71
static void GenerateRockyArea(TileIndex end, TileIndex start)
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    72
{
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    73
	int size_x, size_y;
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    74
	bool success = false;
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    75
	int sx = TileX(start);
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    76
	int sy = TileY(start);
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    77
	int ex = TileX(end);
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    78
	int ey = TileY(end);
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    79
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    80
	if (_game_mode != GM_EDITOR) return;
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    81
6106
2898cd9417fd (svn r8841) -Fix
tron
parents: 5893
diff changeset
    82
	if (ex < sx) Swap(ex, sx);
2898cd9417fd (svn r8841) -Fix
tron
parents: 5893
diff changeset
    83
	if (ey < sy) Swap(ey, sy);
2615
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    84
	size_x = (ex - sx) + 1;
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    85
	size_y = (ey - sy) + 1;
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    86
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    87
	BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
5385
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    88
		switch (GetTileType(tile)) {
8459
86e0352eb993 (svn r12029) -Feature: Allow trees on shore.
frosch
parents: 8450
diff changeset
    89
			case MP_TREES:
86e0352eb993 (svn r12029) -Feature: Allow trees on shore.
frosch
parents: 8450
diff changeset
    90
				if (GetTreeGround(tile) == TREE_GROUND_SHORE) continue;
86e0352eb993 (svn r12029) -Feature: Allow trees on shore.
frosch
parents: 8450
diff changeset
    91
			/* FALL THROUGH */
5385
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    92
			case MP_CLEAR:
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    93
				MakeClear(tile, CLEAR_ROCKS, 3);
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    94
				break;
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    95
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    96
			default: continue;
2615
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
    97
		}
5385
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    98
		MarkTileDirtyByTile(tile);
3868f2e6db9b (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 5072
diff changeset
    99
		success = true;
2615
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
   100
	} END_TILE_LOOP(tile, size_x, size_y, 0);
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
   101
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
   102
	if (success) SndPlayTileFx(SND_1F_SPLAT, end);
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
   103
}
e97a3034eef4 (svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents: 2186
diff changeset
   104
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   105
/**
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   106
 * A central place to handle all X_AND_Y dragged GUI functions.
6422
6679df1c05ba (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6106
diff changeset
   107
 * @param e WindowEvent variable holding in its higher bits (excluding the lower
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   108
 * 4, since that defined the X_Y drag) the type of action to be performed
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   109
 * @return Returns true if the action was found and handled, and false otherwise. This
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   110
 * allows for additional implements that are more local. For example X_Y drag
6422
6679df1c05ba (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6106
diff changeset
   111
 * of convertrail which belongs in rail_gui.cpp and not terraform_gui.cpp
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   112
 **/
9293
96e818608056 (svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
rubidium
parents: 9273
diff changeset
   113
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   114
{
9293
96e818608056 (svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
rubidium
parents: 9273
diff changeset
   115
	switch (proc) {
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   116
		case DDSP_DEMOLISH_AREA:
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   117
			DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   118
			break;
8196
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   119
		case DDSP_RAISE_AND_LEVEL_AREA:
8204
b017e732f925 (svn r11767) -Fix: do not call rail specific functions when building road bridge
smatz
parents: 8202
diff changeset
   120
			DoCommandP(end_tile, start_tile, 1, CcTerraform, CMD_LEVEL_LAND | CMD_MSG(STR_0808_CAN_T_RAISE_LAND_HERE));
8196
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   121
			break;
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   122
		case DDSP_LOWER_AND_LEVEL_AREA:
8202
6ebbaeb5f4b5 (svn r11765) -Fix: compile warning (Roujin).
rubidium
parents: 8196
diff changeset
   123
			DoCommandP(end_tile, start_tile, (uint32)-1, CcTerraform, CMD_LEVEL_LAND | CMD_MSG(STR_0809_CAN_T_LOWER_LAND_HERE));
8196
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   124
			break;
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   125
		case DDSP_LEVEL_AREA:
7521
0da1e91510e4 (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents: 7341
diff changeset
   126
			DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_LEVEL_LAND);
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   127
			break;
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   128
		case DDSP_CREATE_ROCKS:
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   129
			GenerateRockyArea(end_tile, start_tile);
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   130
			break;
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   131
		case DDSP_CREATE_DESERT:
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   132
			GenerateDesertArea(end_tile, start_tile);
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   133
			break;
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   134
		case DDSP_CREATE_WATER:
7521
0da1e91510e4 (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents: 7341
diff changeset
   135
			DoCommandP(end_tile, start_tile, _ctrl_pressed, CcBuildCanal, CMD_BUILD_CANAL | CMD_MSG(STR_CANT_BUILD_CANALS));
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   136
			break;
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   137
		case DDSP_CREATE_RIVER:
9517
8470042a618f (svn r13513) -Codechange: Give proper message when building a river fails.
belugas
parents: 9413
diff changeset
   138
			DoCommandP(end_tile, start_tile, 2, CcBuildCanal, CMD_BUILD_CANAL | CMD_MSG(STR_CANT_PLACE_RIVERS));
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   139
			break;
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   140
		default:
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6600
diff changeset
   141
			return false;
1632
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   142
	}
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   143
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   144
	return true;
10c391e108b7 (svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents: 1363
diff changeset
   145
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
typedef void OnButtonClick(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
static const uint16 _terraform_keycodes[] = {
606
da90c837064c (svn r1030) Some toolbar icons are arranged differently:
dominik
parents: 545
diff changeset
   150
	'Q',
da90c837064c (svn r1030) Some toolbar icons are arranged differently:
dominik
parents: 545
diff changeset
   151
	'W',
da90c837064c (svn r1030) Some toolbar icons are arranged differently:
dominik
parents: 545
diff changeset
   152
	'E',
936
2f79a0bd8bb1 (svn r1424) Add dynamite to landscaping toolbar (hotkey 'D')
dominik
parents: 867
diff changeset
   153
	'D',
606
da90c837064c (svn r1030) Some toolbar icons are arranged differently:
dominik
parents: 545
diff changeset
   154
	'U',
da90c837064c (svn r1030) Some toolbar icons are arranged differently:
dominik
parents: 545
diff changeset
   155
	'I',
613
a0e37d7c9ba8 (svn r1037) Rearranged landscaping hotkeys a bit more.
dominik
parents: 608
diff changeset
   156
	'O',
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
9150
e6cc68a33274 (svn r13012) -Fix (r13011): the PlaceProc that was moved depended on another function...
rubidium
parents: 9149
diff changeset
   159
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2);
e6cc68a33274 (svn r13012) -Fix (r13011): the PlaceProc that was moved depended on another function...
rubidium
parents: 9149
diff changeset
   160
9149
b4c7d2c33bda (svn r13011) -Codechange: move PlaceProc_BuyLand out of rail_gui.cpp to the place where it is used and remove some unneeded globalisations of some other PlaceProc functions.
rubidium
parents: 9143
diff changeset
   161
static void PlaceProc_BuyLand(TileIndex tile)
b4c7d2c33bda (svn r13011) -Codechange: move PlaceProc_BuyLand out of rail_gui.cpp to the place where it is used and remove some unneeded globalisations of some other PlaceProc functions.
rubidium
parents: 9143
diff changeset
   162
{
b4c7d2c33bda (svn r13011) -Codechange: move PlaceProc_BuyLand out of rail_gui.cpp to the place where it is used and remove some unneeded globalisations of some other PlaceProc functions.
rubidium
parents: 9143
diff changeset
   163
	DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND));
b4c7d2c33bda (svn r13011) -Codechange: move PlaceProc_BuyLand out of rail_gui.cpp to the place where it is used and remove some unneeded globalisations of some other PlaceProc functions.
rubidium
parents: 9143
diff changeset
   164
}
b4c7d2c33bda (svn r13011) -Codechange: move PlaceProc_BuyLand out of rail_gui.cpp to the place where it is used and remove some unneeded globalisations of some other PlaceProc functions.
rubidium
parents: 9143
diff changeset
   165
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1919
diff changeset
   166
void PlaceProc_DemolishArea(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
{
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   168
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
2817
cdf488223c23 (svn r3365) Staticise 36 functions
tron
parents: 2790
diff changeset
   171
static void PlaceProc_RaiseLand(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
{
8196
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   173
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_RAISE_AND_LEVEL_AREA);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
2817
cdf488223c23 (svn r3365) Staticise 36 functions
tron
parents: 2790
diff changeset
   176
static void PlaceProc_LowerLand(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
{
8196
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   178
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LOWER_AND_LEVEL_AREA);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
9149
b4c7d2c33bda (svn r13011) -Codechange: move PlaceProc_BuyLand out of rail_gui.cpp to the place where it is used and remove some unneeded globalisations of some other PlaceProc functions.
rubidium
parents: 9143
diff changeset
   181
static void PlaceProc_LevelLand(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
{
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   183
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   184
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   186
/** Enum referring to the widgets of the terraform toolbar */
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   187
enum TerraformToolbarWidgets {
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   188
	TTW_CLOSEBOX = 0,                     ///< Close window button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   189
	TTW_CAPTION,                          ///< Window caption
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   190
	TTW_STICKY,                           ///< Sticky window button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   191
	TTW_SEPERATOR,                        ///< Thin seperator line between level land button and demolish button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   192
	TTW_BUTTONS_START,                    ///< Start of pushable buttons
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   193
	TTW_LOWER_LAND = TTW_BUTTONS_START,   ///< Lower land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   194
	TTW_RAISE_LAND,                       ///< Raise land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   195
	TTW_LEVEL_LAND,                       ///< Level land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   196
	TTW_DEMOLISH,                         ///< Demolish aka dynamite button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   197
	TTW_BUY_LAND,                         ///< Buy land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   198
	TTW_PLANT_TREES,                      ///< Plant trees button (note: opens seperate window, no place-push-button)
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   199
	TTW_PLACE_SIGN,                       ///< Place sign button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   200
};
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   201
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
static void TerraformClick_Lower(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   204
	HandlePlacePushButton(w, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerLand);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   205
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   207
static void TerraformClick_Raise(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   208
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   209
	HandlePlacePushButton(w, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseLand);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
static void TerraformClick_Level(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   214
	HandlePlacePushButton(w, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   215
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
936
2f79a0bd8bb1 (svn r1424) Add dynamite to landscaping toolbar (hotkey 'D')
dominik
parents: 867
diff changeset
   217
static void TerraformClick_Dynamite(Window *w)
2f79a0bd8bb1 (svn r1424) Add dynamite to landscaping toolbar (hotkey 'D')
dominik
parents: 867
diff changeset
   218
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   219
	HandlePlacePushButton(w, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH , VHM_RECT, PlaceProc_DemolishArea);
936
2f79a0bd8bb1 (svn r1424) Add dynamite to landscaping toolbar (hotkey 'D')
dominik
parents: 867
diff changeset
   220
}
2f79a0bd8bb1 (svn r1424) Add dynamite to landscaping toolbar (hotkey 'D')
dominik
parents: 867
diff changeset
   221
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   222
static void TerraformClick_BuyLand(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   223
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   224
	HandlePlacePushButton(w, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, VHM_RECT, PlaceProc_BuyLand);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   226
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   227
static void TerraformClick_Trees(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
{
3817
96de009b0592 (svn r4827) -Fix (FS#160) In the terraform toolbar, don't treat the plant tree button as place-push-button, because it isn't
celestar
parents: 3447
diff changeset
   229
	/* This button is NOT a place-push-button, so don't treat it as such */
96de009b0592 (svn r4827) -Fix (FS#160) In the terraform toolbar, don't treat the plant tree button as place-push-button, because it isn't
celestar
parents: 3447
diff changeset
   230
	ShowBuildTreesToolbar();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
static void TerraformClick_PlaceSign(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   235
	HandlePlacePushButton(w, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, VHM_RECT, PlaceProc_Sign);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   236
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
static OnButtonClick * const _terraform_button_proc[] = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
	TerraformClick_Lower,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   240
	TerraformClick_Raise,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
	TerraformClick_Level,
936
2f79a0bd8bb1 (svn r1424) Add dynamite to landscaping toolbar (hotkey 'D')
dominik
parents: 867
diff changeset
   242
	TerraformClick_Dynamite,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
	TerraformClick_BuyLand,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   244
	TerraformClick_Trees,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   245
	TerraformClick_PlaceSign,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   247
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   248
struct TerraformToolbarWindow : Window {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   249
	TerraformToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   250
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   251
		this->FindWindowPlacementAndResize(desc);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   252
	}
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2615
diff changeset
   253
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   254
	~TerraformToolbarWindow()
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   255
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   256
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   258
	virtual void OnPaint()
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   259
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   260
		this->DrawWidgets();
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   261
	}
616
63b0ac55529e (svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik
parents: 613
diff changeset
   262
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   263
	virtual void OnClick(Point pt, int widget)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   264
	{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   265
		if (widget >= TTW_BUTTONS_START) _terraform_button_proc[widget - TTW_BUTTONS_START](this);
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   266
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   267
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   268
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   269
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   270
		for (uint i = 0; i != lengthof(_terraform_keycodes); i++) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   271
			if (keycode == _terraform_keycodes[i]) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   272
				_terraform_button_proc[i](this);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   273
				return ES_HANDLED;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   274
			}
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2615
diff changeset
   275
		}
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   276
		return ES_NOT_HANDLED;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   277
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   278
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   279
	virtual void OnPlaceObject(Point pt, TileIndex tile)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   280
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   281
		_place_proc(tile);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   282
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   284
	virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   285
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   286
		VpSelectTilesWithMethod(pt.x, pt.y, select_method);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   287
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   288
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   289
	virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   290
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   291
		if (pt.x != -1) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   292
			switch (select_proc) {
9293
96e818608056 (svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
rubidium
parents: 9273
diff changeset
   293
				default: NOT_REACHED();
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   294
				case DDSP_DEMOLISH_AREA:
8196
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   295
				case DDSP_RAISE_AND_LEVEL_AREA:
784ea9554da3 (svn r11759) -Feature: Add drag-n-drop support to the raise/lower land tools. Land is raised/lowered at the start and the rest of the area levelled to match. Patch by Roujin.
peter1138
parents: 8157
diff changeset
   296
				case DDSP_LOWER_AND_LEVEL_AREA:
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   297
				case DDSP_LEVEL_AREA:
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   298
					GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
6670
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   299
					break;
f0300bf50643 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents: 6669
diff changeset
   300
			}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   301
		}
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   302
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   303
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   304
	virtual void OnPlaceObjectAbort()
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   305
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   306
		this->RaiseButtons();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   307
	}
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   308
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   309
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   310
static const Widget _terraform_widgets[] = {
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   311
{ WWT_CLOSEBOX,   RESIZE_NONE,     7,   0,  10,   0,  13, STR_00C5,                STR_018B_CLOSE_WINDOW},             // TTW_CLOSEBOX
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   312
{  WWT_CAPTION,   RESIZE_NONE,     7,  11, 145,   0,  13, STR_LANDSCAPING_TOOLBAR, STR_018C_WINDOW_TITLE_DRAG_THIS},   // TTW_CAPTION
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   313
{WWT_STICKYBOX,   RESIZE_NONE,     7, 146, 157,   0,  13, STR_NULL,                STR_STICKY_BUTTON},                 // TTW_STICKY
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 756
diff changeset
   314
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   315
{    WWT_PANEL,   RESIZE_NONE,     7,  66,  69,  14,  35, 0x0,                    STR_NULL},                           // TTW_SEPERATOR
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   316
{   WWT_IMGBTN,   RESIZE_NONE,     7,   0,  21,  14,  35, SPR_IMG_TERRAFORM_DOWN,  STR_018E_LOWER_A_CORNER_OF_LAND},   // TTW_LOWER_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   317
{   WWT_IMGBTN,   RESIZE_NONE,     7,  22,  43,  14,  35, SPR_IMG_TERRAFORM_UP,    STR_018F_RAISE_A_CORNER_OF_LAND},   // TTW_RAISE_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   318
{   WWT_IMGBTN,   RESIZE_NONE,     7,  44,  65,  14,  35, SPR_IMG_LEVEL_LAND,      STR_LEVEL_LAND_TOOLTIP},            // TTW_LEVEL_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   319
{   WWT_IMGBTN,   RESIZE_NONE,     7,  70,  91,  14,  35, SPR_IMG_DYNAMITE,        STR_018D_DEMOLISH_BUILDINGS_ETC},   // TTW_DEMOLISH
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   320
{   WWT_IMGBTN,   RESIZE_NONE,     7,  92, 113,  14,  35, SPR_IMG_BUY_LAND,        STR_0329_PURCHASE_LAND_FOR_FUTURE}, // TTW_BUY_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   321
{   WWT_IMGBTN,   RESIZE_NONE,     7, 114, 135,  14,  35, SPR_IMG_PLANTTREES,      STR_0185_PLANT_TREES_PLACE_SIGNS},  // TTW_PLANT_TREES
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   322
{   WWT_IMGBTN,   RESIZE_NONE,     7, 136, 157,  14,  35, SPR_IMG_SIGN,            STR_0289_PLACE_SIGN},               // TTW_PLACE_SIGN
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   323
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 30
diff changeset
   324
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   325
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   326
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
static const WindowDesc _terraform_desc = {
7341
02515d0d4ced (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7322
diff changeset
   328
	WDP_ALIGN_TBR, 22 + 36, 158, 36, 158, 36,
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5860
diff changeset
   329
	WC_SCEN_LAND_GEN, WC_NONE,
756
b76998029c12 (svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents: 651
diff changeset
   330
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   331
	_terraform_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   332
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   333
5860
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   334
void ShowTerraformToolbar(Window *link)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   335
{
5005
f5086bd3945a (svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents: 4994
diff changeset
   336
	if (!IsValidPlayer(_current_player)) return;
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   337
	Window *w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
5860
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   338
	if (w != NULL && link != NULL) {
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   339
		/* Align the terraform toolbar under the main toolbar and put the linked
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   340
		 * toolbar to left of it
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   341
		 */
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   342
		w->top = 22;
9363
008c7f18f911 (svn r13260) -Fix: linked terraform toolbar wasn't marked dirty after moving
smatz
parents: 9358
diff changeset
   343
		w->SetDirty();
5860
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   344
		link->left = w->left - link->width;
9116
f2491d3c321b (svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents: 9111
diff changeset
   345
		link->SetDirty();
5860
3b26be021371 (svn r8436) -Fix
tron
parents: 5584
diff changeset
   346
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   347
}
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   348
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   349
static byte _terraform_size = 1;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   350
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   351
/**
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   352
 * Raise/Lower a bigger chunk of land at the same time in the editor. When
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   353
 * raising get the lowest point, when lowering the highest point, and set all
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   354
 * tiles in the selection to that height.
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   355
 * @todo : Incorporate into game itself to allow for ingame raising/lowering of
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   356
 *         larger chunks at the same time OR remove altogether, as we have 'level land' ?
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   357
 * @param tile The top-left tile where the terraforming will start
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   358
 * @param mode 1 for raising, 0 for lowering land
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   359
 */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   360
static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   361
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   362
	int sizex, sizey;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   363
	uint h;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   364
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   365
	if (_terraform_size == 1) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   366
		StringID msg =
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   367
			mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   368
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   369
		DoCommandP(tile, SLOPE_N, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_MSG(msg));
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   370
	} else {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   371
		assert(_terraform_size != 0);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   372
		/* check out for map overflows */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   373
		sizex = min(MapSizeX() - TileX(tile) - 1, _terraform_size);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   374
		sizey = min(MapSizeY() - TileY(tile) - 1, _terraform_size);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   375
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   376
		if (sizex == 0 || sizey == 0) return;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   377
9586
bd94ff37f38f (svn r13624) -Fix [FS#2106]: crash when one tries to raise the nothern corner of MP_VOID tiles (i.e. the southern corner of the tiles on the southern map edge) in the scenario editor.
rubidium
parents: 9517
diff changeset
   378
		SndPlayTileFx(SND_1F_SPLAT, tile);
bd94ff37f38f (svn r13624) -Fix [FS#2106]: crash when one tries to raise the nothern corner of MP_VOID tiles (i.e. the southern corner of the tiles on the southern map edge) in the scenario editor.
rubidium
parents: 9517
diff changeset
   379
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   380
		if (mode != 0) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   381
			/* Raise land */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   382
			h = 15; // XXX - max height
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   383
			BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   384
				h = min(h, TileHeight(tile2));
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   385
			} END_TILE_LOOP(tile2, sizex, sizey, tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   386
		} else {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   387
			/* Lower land */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   388
			h = 0;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   389
			BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   390
				h = max(h, TileHeight(tile2));
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   391
			} END_TILE_LOOP(tile2, sizex, sizey, tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   392
		}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   393
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   394
		BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   395
			if (TileHeight(tile2) == h) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   396
				DoCommandP(tile2, SLOPE_N, (uint32)mode, NULL, CMD_TERRAFORM_LAND);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   397
			}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   398
		} END_TILE_LOOP(tile2, sizex, sizey, tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   399
	}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   400
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   401
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   402
static void PlaceProc_RaiseBigLand(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   403
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   404
	CommonRaiseLowerBigLand(tile, 1);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   405
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   406
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   407
static void PlaceProc_LowerBigLand(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   408
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   409
	CommonRaiseLowerBigLand(tile, 0);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   410
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   411
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   412
static void PlaceProc_RockyArea(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   413
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   414
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   415
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   416
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   417
static void PlaceProc_LightHouse(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   418
{
8472
2a14ce1a7a43 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz
parents: 8459
diff changeset
   419
	/* not flat || not(trees || clear without bridge above) */
2a14ce1a7a43 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz
parents: 8459
diff changeset
   420
	if (GetTileSlope(tile, NULL) != SLOPE_FLAT || !(IsTileType(tile, MP_TREES) || (IsTileType(tile, MP_CLEAR) && !IsBridgeAbove(tile)))) {
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   421
		return;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   422
	}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   423
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   424
	MakeLighthouse(tile);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   425
	MarkTileDirtyByTile(tile);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   426
	SndPlayTileFx(SND_1F_SPLAT, tile);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   427
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   428
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   429
static void PlaceProc_Transmitter(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   430
{
8472
2a14ce1a7a43 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz
parents: 8459
diff changeset
   431
	/* not flat || not(trees || clear without bridge above) */
2a14ce1a7a43 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz
parents: 8459
diff changeset
   432
	if (GetTileSlope(tile, NULL) != SLOPE_FLAT || !(IsTileType(tile, MP_TREES) || (IsTileType(tile, MP_CLEAR) && !IsBridgeAbove(tile)))) {
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   433
		return;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   434
	}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   435
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   436
	MakeTransmitter(tile);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   437
	MarkTileDirtyByTile(tile);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   438
	SndPlayTileFx(SND_1F_SPLAT, tile);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   439
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   440
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   441
static void PlaceProc_DesertArea(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   442
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   443
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   444
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   445
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   446
static void PlaceProc_WaterArea(TileIndex tile)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   447
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   448
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_WATER);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   449
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   450
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   451
static void PlaceProc_RiverArea(TileIndex tile)
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   452
{
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   453
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_RIVER);
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   454
}
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   455
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   456
static const Widget _scen_edit_land_gen_widgets[] = {
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   457
{  WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                  STR_018B_CLOSE_WINDOW},                   // ETTW_CLOSEBOX
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   458
{   WWT_CAPTION,   RESIZE_NONE,     7,    11,   191,     0,    13, STR_0223_LAND_GENERATION,  STR_018C_WINDOW_TITLE_DRAG_THIS},         // ETTW_CAPTION
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   459
{ WWT_STICKYBOX,   RESIZE_NONE,     7,   192,   203,     0,    13, STR_NULL,                  STR_STICKY_BUTTON},                       // ETTW_STICKY
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   460
{     WWT_PANEL,   RESIZE_NONE,     7,     0,   203,    14,   102, 0x0,                       STR_NULL},                                // ETTW_BACKGROUND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   461
{    WWT_IMGBTN,   RESIZE_NONE,    14,     2,    23,    16,    37, SPR_IMG_DYNAMITE,          STR_018D_DEMOLISH_BUILDINGS_ETC},         // ETTW_DEMOLISH
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   462
{    WWT_IMGBTN,   RESIZE_NONE,    14,    24,    45,    16,    37, SPR_IMG_TERRAFORM_DOWN,    STR_018E_LOWER_A_CORNER_OF_LAND},         // ETTW_LOWER_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   463
{    WWT_IMGBTN,   RESIZE_NONE,    14,    46,    67,    16,    37, SPR_IMG_TERRAFORM_UP,      STR_018F_RAISE_A_CORNER_OF_LAND},         // ETTW_RAISE_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   464
{    WWT_IMGBTN,   RESIZE_NONE,    14,    68,    89,    16,    37, SPR_IMG_LEVEL_LAND,        STR_LEVEL_LAND_TOOLTIP},                  // ETTW_LEVEL_LAND
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   465
{    WWT_IMGBTN,   RESIZE_NONE,    14,    90,   111,    16,    37, SPR_IMG_BUILD_CANAL,       STR_CREATE_LAKE},                         // ETTW_BUILD_CANAL
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   466
{    WWT_IMGBTN,   RESIZE_NONE,    14,   112,   133,    16,    37, SPR_IMG_BUILD_RIVER,       STR_CREATE_RIVER},                        // ETTW_BUILD_RIVER
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   467
{    WWT_IMGBTN,   RESIZE_NONE,    14,   134,   156,    16,    37, SPR_IMG_ROCKS,             STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE}, // ETTW_PLACE_ROCKS
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   468
{    WWT_IMGBTN,   RESIZE_NONE,    14,   157,   179,    16,    37, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL},                                // ETTW_PLACE_DESERT_LIGHTHOUSE XXX - dynamic
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   469
{    WWT_IMGBTN,   RESIZE_NONE,    14,   180,   201,    16,    37, SPR_IMG_TRANSMITTER,       STR_028E_PLACE_TRANSMITTER},              // ETTW_PLACE_TRANSMITTER
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   470
{    WWT_IMGBTN,   RESIZE_NONE,    14,   150,   161,    45,    56, SPR_ARROW_UP,              STR_0228_INCREASE_SIZE_OF_LAND_AREA},     // ETTW_INCREASE_SIZE
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   471
{    WWT_IMGBTN,   RESIZE_NONE,    14,   150,   161,    58,    69, SPR_ARROW_DOWN,            STR_0229_DECREASE_SIZE_OF_LAND_AREA},     // ETTW_DECREASE_SIZE
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   472
{   WWT_TEXTBTN,   RESIZE_NONE,    14,    24,   179,    76,    87, STR_SE_NEW_WORLD,          STR_022A_GENERATE_RANDOM_LAND},           // ETTW_NEW_SCENARIO
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   473
{   WWT_TEXTBTN,   RESIZE_NONE,    14,    24,   179,    89,   100, STR_022B_RESET_LANDSCAPE,  STR_RESET_LANDSCAPE_TOOLTIP},             // ETTW_RESET_LANDSCAPE
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   474
{   WIDGETS_END},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   475
};
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   476
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   477
static const int8 _multi_terraform_coords[][2] = {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   478
	{  0, -2},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   479
	{  4,  0}, { -4,  0}, {  0,  2},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   480
	{ -8,  2}, { -4,  4}, {  0,  6}, {  4,  4}, {  8,  2},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   481
	{-12,  0}, { -8, -2}, { -4, -4}, {  0, -6}, {  4, -4}, {  8, -2}, { 12,  0},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   482
	{-16,  2}, {-12,  4}, { -8,  6}, { -4,  8}, {  0, 10}, {  4,  8}, {  8,  6}, { 12,  4}, { 16,  2},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   483
	{-20,  0}, {-16, -2}, {-12, -4}, { -8, -6}, { -4, -8}, {  0,-10}, {  4, -8}, {  8, -6}, { 12, -4}, { 16, -2}, { 20,  0},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   484
	{-24,  2}, {-20,  4}, {-16,  6}, {-12,  8}, { -8, 10}, { -4, 12}, {  0, 14}, {  4, 12}, {  8, 10}, { 12,  8}, { 16,  6}, { 20,  4}, { 24,  2},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   485
	{-28,  0}, {-24, -2}, {-20, -4}, {-16, -6}, {-12, -8}, { -8,-10}, { -4,-12}, {  0,-14}, {  4,-12}, {  8,-10}, { 12, -8}, { 16, -6}, { 20, -4}, { 24, -2}, { 28,  0},
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   486
};
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   487
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   488
/** Enum referring to the widgets of the editor terraform toolbar */
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   489
enum EditorTerraformToolbarWidgets {
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   490
	ETTW_START = 0,                        ///< Used for iterations
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   491
	ETTW_CLOSEBOX = ETTW_START,            ///< Close window button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   492
	ETTW_CAPTION,                          ///< Window caption
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   493
	ETTW_STICKY,                           ///< Sticky window button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   494
	ETTW_BACKGROUND,                       ///< Background of the lower part of the window
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   495
	ETTW_BUTTONS_START,                    ///< Start of pushable buttons
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   496
	ETTW_DEMOLISH = ETTW_BUTTONS_START,    ///< Demolish aka dynamite button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   497
	ETTW_LOWER_LAND,                       ///< Lower land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   498
	ETTW_RAISE_LAND,                       ///< Raise land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   499
	ETTW_LEVEL_LAND,                       ///< Level land button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   500
	ETTW_BUILD_CANAL,                      ///< Build canal button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   501
	ETTW_BUILD_RIVER,                      ///< Build river button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   502
	ETTW_PLACE_ROCKS,                      ///< Place rocks button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   503
	ETTW_PLACE_DESERT_LIGHTHOUSE,          ///< Place desert button (in tropical climate) / place lighthouse button (else)
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   504
	ETTW_PLACE_TRANSMITTER,                ///< Place transmitter button
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   505
	ETTW_BUTTONS_END,                      ///< End of pushable buttons
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   506
	ETTW_INCREASE_SIZE = ETTW_BUTTONS_END, ///< Upwards arrow button to increase terraforming size
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   507
	ETTW_DECREASE_SIZE,                    ///< Downwards arrow button to decrease terraforming size
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   508
	ETTW_NEW_SCENARIO,                     ///< Button for generating a new scenario
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   509
	ETTW_RESET_LANDSCAPE,                  ///< Button for removing all player-owned property
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   510
};
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   511
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   512
/**
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   513
 * @todo Merge with terraform_gui.cpp (move there) after I have cooled down at its braindeadness
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   514
 * and changed OnButtonClick to include the widget as well in the function declaration. Post 0.4.0 - Darkvater
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   515
 */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   516
static void EditorTerraformClick_Dynamite(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   517
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   518
	HandlePlacePushButton(w, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   519
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   520
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   521
static void EditorTerraformClick_LowerBigLand(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   522
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   523
	HandlePlacePushButton(w, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerBigLand);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   524
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   525
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   526
static void EditorTerraformClick_RaiseBigLand(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   527
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   528
	HandlePlacePushButton(w, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseBigLand);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   529
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   530
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   531
static void EditorTerraformClick_LevelLand(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   532
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   533
	HandlePlacePushButton(w, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   534
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   535
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   536
static void EditorTerraformClick_WaterArea(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   537
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   538
	HandlePlacePushButton(w, ETTW_BUILD_CANAL, SPR_CURSOR_CANAL, VHM_RECT, PlaceProc_WaterArea);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   539
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   540
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   541
static void EditorTerraformClick_RiverArea(Window *w)
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   542
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   543
	HandlePlacePushButton(w, ETTW_BUILD_RIVER, SPR_CURSOR_RIVER, VHM_RECT, PlaceProc_RiverArea);
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   544
}
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   545
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   546
static void EditorTerraformClick_RockyArea(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   547
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   548
	HandlePlacePushButton(w, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, VHM_RECT, PlaceProc_RockyArea);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   549
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   550
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   551
static void EditorTerraformClick_DesertLightHouse(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   552
{
9413
7042a8ec3fa8 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents: 9363
diff changeset
   553
	HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, VHM_RECT, (_settings_game.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   554
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   555
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   556
static void EditorTerraformClick_Transmitter(Window *w)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   557
{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   558
	HandlePlacePushButton(w, ETTW_PLACE_TRANSMITTER, SPR_CURSOR_TRANSMITTER, VHM_RECT, PlaceProc_Transmitter);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   559
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   560
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   561
static const uint16 _editor_terraform_keycodes[] = {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   562
	'D',
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   563
	'Q',
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   564
	'W',
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   565
	'E',
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   566
	'R',
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   567
	'T',
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   568
	'Y',
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   569
	'U',
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   570
	'I'
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   571
};
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   572
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   573
typedef void OnButtonClick(Window *w);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   574
static OnButtonClick * const _editor_terraform_button_proc[] = {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   575
	EditorTerraformClick_Dynamite,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   576
	EditorTerraformClick_LowerBigLand,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   577
	EditorTerraformClick_RaiseBigLand,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   578
	EditorTerraformClick_LevelLand,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   579
	EditorTerraformClick_WaterArea,
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   580
	EditorTerraformClick_RiverArea,
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   581
	EditorTerraformClick_RockyArea,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   582
	EditorTerraformClick_DesertLightHouse,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   583
	EditorTerraformClick_Transmitter
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   584
};
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   585
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   586
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   587
/** Callback function for the scenario editor 'reset landscape' confirmation window
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   588
 * @param w Window unused
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   589
 * @param confirmed boolean value, true when yes was clicked, false otherwise */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   590
static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   591
{
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   592
	if (confirmed) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   593
		Player *p;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   594
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   595
		/* Set generating_world to true to get instant-green grass after removing
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   596
		 * player property. */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   597
		_generating_world = true;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   598
		/* Delete all players */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   599
		FOR_ALL_PLAYERS(p) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   600
			if (p->is_active) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   601
				ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   602
				p->is_active = false;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   603
			}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   604
		}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   605
		_generating_world = false;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   606
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   607
		/* Delete all stations owned by a player */
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   608
		Station *st;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   609
		FOR_ALL_STATIONS(st) {
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   610
			if (IsValidPlayer(st->owner)) delete st;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   611
		}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   612
	}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   613
}
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   614
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   615
struct ScenarioEditorLandscapeGenerationWindow : Window {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   616
	ScenarioEditorLandscapeGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   617
	{
9413
7042a8ec3fa8 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents: 9363
diff changeset
   618
		this->widget[ETTW_PLACE_DESERT_LIGHTHOUSE].tooltips = (_settings_game.game_creation.landscape == LT_TROPIC) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   619
		this->FindWindowPlacementAndResize(desc);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   620
	}
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   621
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   622
	virtual void OnPaint() {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   623
		this->DrawWidgets();
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   624
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   625
		int n = _terraform_size * _terraform_size;
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   626
		const int8 *coords = &_multi_terraform_coords[0][0];
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   627
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   628
		assert(n != 0);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   629
		do {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   630
			DrawSprite(SPR_WHITE_POINT, PAL_NONE, 88 + coords[0], 55 + coords[1]);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   631
			coords += 2;
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   632
		} while (--n);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   633
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   634
		if (this->IsWidgetLowered(ETTW_LOWER_LAND) || this->IsWidgetLowered(ETTW_RAISE_LAND)) { // change area-size if raise/lower corner is selected
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   635
			SetTileSelectSize(_terraform_size, _terraform_size);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   636
		}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   637
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   638
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   639
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   640
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   641
		for (uint i = 0; i != lengthof(_editor_terraform_keycodes); i++) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   642
			if (keycode == _editor_terraform_keycodes[i]) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   643
				_editor_terraform_button_proc[i](this);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   644
				return ES_HANDLED;
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   645
			}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   646
		}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   647
		return ES_NOT_HANDLED;
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   648
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   649
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   650
	virtual void OnClick(Point pt, int widget)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   651
	{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   652
		if (IsInsideMM(widget, ETTW_BUTTONS_START, ETTW_BUTTONS_END)) {
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   653
			_editor_terraform_button_proc[widget - ETTW_BUTTONS_START](this);
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   654
		} else {
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   655
			switch (widget) {
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   656
				case ETTW_INCREASE_SIZE:
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   657
				case ETTW_DECREASE_SIZE: { // Increase/Decrease terraform size
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   658
					int size = (widget == ETTW_INCREASE_SIZE) ? 1 : -1;
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   659
					this->HandleButtonClick(widget);
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   660
					size += _terraform_size;
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   661
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   662
					if (!IsInsideMM(size, 1, 8 + 1)) return;
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   663
					_terraform_size = size;
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   664
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   665
					SndPlayFx(SND_15_BEEP);
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   666
					this->SetDirty();
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   667
				} break;
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   668
				case ETTW_NEW_SCENARIO: // gen random land
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   669
					this->HandleButtonClick(widget);
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   670
					ShowCreateScenario();
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   671
					break;
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   672
				case ETTW_RESET_LANDSCAPE: // Reset landscape
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   673
					ShowQuery(
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   674
						STR_022C_RESET_LANDSCAPE,
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   675
						STR_RESET_LANDSCAPE_CONFIRMATION_TEXT,
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   676
						NULL,
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   677
						ResetLandscapeConfirmationCallback);
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   678
					break;
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   679
			}
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   680
		}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   681
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   682
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   683
	virtual void OnTimeout()
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   684
	{
9328
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   685
		for (uint i = ETTW_START; i < this->widget_count; i++) {
bc872d85116e (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz
parents: 9317
diff changeset
   686
			if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   687
			if (this->IsWidgetLowered(i)) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   688
				this->RaiseWidget(i);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   689
				this->InvalidateWidget(i);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   690
			}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   691
		}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   692
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   693
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   694
	virtual void OnPlaceObject(Point pt, TileIndex tile)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   695
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   696
		_place_proc(tile);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   697
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   698
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   699
	virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   700
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   701
		VpSelectTilesWithMethod(pt.x, pt.y, select_method);
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   702
	}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   703
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   704
	virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   705
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   706
		if (pt.x != -1) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   707
			switch (select_proc) {
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   708
				default: NOT_REACHED();
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   709
				case DDSP_CREATE_ROCKS:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   710
				case DDSP_CREATE_DESERT:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   711
				case DDSP_CREATE_WATER:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   712
				case DDSP_CREATE_RIVER:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   713
				case DDSP_RAISE_AND_LEVEL_AREA:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   714
				case DDSP_LOWER_AND_LEVEL_AREA:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   715
				case DDSP_LEVEL_AREA:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   716
				case DDSP_DEMOLISH_AREA:
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   717
					GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   718
					break;
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   719
			}
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   720
		}
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   721
	}
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   722
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   723
	virtual void OnPlaceObjectAbort()
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   724
	{
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   725
		this->RaiseButtons();
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   726
		this->SetDirty();
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   727
	}
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   728
};
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   729
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   730
static const WindowDesc _scen_edit_land_gen_desc = {
8360
3021c928de6c (svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
peter1138
parents: 8270
diff changeset
   731
	WDP_AUTO, WDP_AUTO, 204, 103, 204, 103,
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   732
	WC_SCEN_LAND_GEN, WC_NONE,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   733
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   734
	_scen_edit_land_gen_widgets,
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   735
};
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   736
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   737
void ShowEditorTerraformToolbar()
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   738
{
9304
0942e5c1fa1a (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium
parents: 9293
diff changeset
   739
	AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(&_scen_edit_land_gen_desc, 0);
8205
2bde724f1b5d (svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents: 8204
diff changeset
   740
}