annotate src/terraform_gui.cpp @ 10480:649ba332458f draft

(svn r14735) -Codechange: remove a bit of bit-waste in the map array (without changing the map array) and make the CompanyIDs contiguous. -Note: 15 should be enough for now... making it any more means adding more bytes to the map array and thus wasting more bits instead of reducing the bit waste.
author rubidium <rubidium@openttd.org>
date Wed, 24 Dec 2008 09:53:15 +0000
parents 098888859ff0
children 45ca88a8de7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1 /* $Id$ */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2
9111
d48433370037 (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 <rubidium@openttd.org>
parents: 8790
diff changeset
3 /** @file terraform_gui.cpp GUI related to terraforming the map. */
6422
fb10eafe2a26 (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas <belugas@openttd.org>
parents: 6106
diff changeset
4
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
5 #include "stdafx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
6 #include "openttd.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
7 #include "bridge_map.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
8 #include "clear_map.h"
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
9 #include "company_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
10 #include "company_base.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
11 #include "gui.h"
8107
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
12 #include "window_gui.h"
8224
c45446125bf0 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents: 8210
diff changeset
13 #include "viewport_func.h"
c45446125bf0 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents: 8210
diff changeset
14 #include "gfx_func.h"
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents: 8108
diff changeset
15 #include "command_func.h"
8790
5ef0059ccfc0 (svn r12501) -Codechange: split signs.h.
rubidium <rubidium@openttd.org>
parents: 8786
diff changeset
16 #include "signs_func.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
17 #include "variables.h"
8131
e300ac8001ae (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 <rubidium@openttd.org>
parents: 8121
diff changeset
18 #include "functions.h"
8157
019833e42fda (svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium <rubidium@openttd.org>
parents: 8144
diff changeset
19 #include "sound_func.h"
8786
e2d4956b7251 (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 <rubidium@openttd.org>
parents: 8472
diff changeset
20 #include "station_base.h"
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
21 #include "unmovable_map.h"
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
22 #include "textbuf_gui.h"
8236
d1191295967a (svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium <rubidium@openttd.org>
parents: 8224
diff changeset
23 #include "genworld.h"
8270
5613b863190d (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium <rubidium@openttd.org>
parents: 8264
diff changeset
24 #include "settings_type.h"
8459
0daec7b61525 (svn r12029) -Feature: Allow trees on shore.
frosch <frosch@openttd.org>
parents: 8450
diff changeset
25 #include "tree_map.h"
9126
8c450e1754e2 (svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium <rubidium@openttd.org>
parents: 9116
diff changeset
26 #include "landscape_type.h"
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents: 9126
diff changeset
27 #include "tilehighlight_func.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
28
8264
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
29 #include "table/sprites.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
30 #include "table/strings.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
31
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
32 void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
33 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
34 if (success) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
35 SndPlayTileFx(SND_1F_SPLAT, tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
36 } else {
8210
2191f47ab047 (svn r11773) -Codechange: move some non-clear-land functions from clear_cmd.cpp to a more correct location.
rubidium <rubidium@openttd.org>
parents: 8205
diff changeset
37 extern TileIndex _terraform_err_tile;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
38 SetRedErrorSquare(_terraform_err_tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
39 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
40 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
41
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
42
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
43 /** Scenario editor command that generates desert areas */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
44 static void GenerateDesertArea(TileIndex end, TileIndex start)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
45 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
46 int size_x, size_y;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
47 int sx = TileX(start);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
48 int sy = TileY(start);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
49 int ex = TileX(end);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
50 int ey = TileY(end);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
51
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
52 if (_game_mode != GM_EDITOR) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
53
6106
230764f1a316 (svn r8841) -Fix
tron <tron@openttd.org>
parents: 5893
diff changeset
54 if (ex < sx) Swap(ex, sx);
230764f1a316 (svn r8841) -Fix
tron <tron@openttd.org>
parents: 5893
diff changeset
55 if (ey < sy) Swap(ey, sy);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
56 size_x = (ex - sx) + 1;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
57 size_y = (ey - sy) + 1;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
58
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
59 _generating_world = true;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
60 BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
61 if (GetTileType(tile) != MP_WATER) {
8450
4f8718f910d8 (svn r12020) -Documentation: Correct description of TropicZone.
frosch <frosch@openttd.org>
parents: 8444
diff changeset
62 SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
63 DoCommandP(tile, 0, 0, NULL, CMD_LANDSCAPE_CLEAR);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
64 MarkTileDirtyByTile(tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
65 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
66 } END_TILE_LOOP(tile, size_x, size_y, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
67 _generating_world = false;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
68 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
69
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
70 /** Scenario editor command that generates rocky areas */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
71 static void GenerateRockyArea(TileIndex end, TileIndex start)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
72 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
73 int size_x, size_y;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
74 bool success = false;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
75 int sx = TileX(start);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
76 int sy = TileY(start);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
77 int ex = TileX(end);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
78 int ey = TileY(end);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
79
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
80 if (_game_mode != GM_EDITOR) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
81
6106
230764f1a316 (svn r8841) -Fix
tron <tron@openttd.org>
parents: 5893
diff changeset
82 if (ex < sx) Swap(ex, sx);
230764f1a316 (svn r8841) -Fix
tron <tron@openttd.org>
parents: 5893
diff changeset
83 if (ey < sy) Swap(ey, sy);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
84 size_x = (ex - sx) + 1;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
85 size_y = (ey - sy) + 1;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
86
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
87 BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
88 switch (GetTileType(tile)) {
8459
0daec7b61525 (svn r12029) -Feature: Allow trees on shore.
frosch <frosch@openttd.org>
parents: 8450
diff changeset
89 case MP_TREES:
0daec7b61525 (svn r12029) -Feature: Allow trees on shore.
frosch <frosch@openttd.org>
parents: 8450
diff changeset
90 if (GetTreeGround(tile) == TREE_GROUND_SHORE) continue;
0daec7b61525 (svn r12029) -Feature: Allow trees on shore.
frosch <frosch@openttd.org>
parents: 8450
diff changeset
91 /* FALL THROUGH */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
92 case MP_CLEAR:
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
93 MakeClear(tile, CLEAR_ROCKS, 3);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
94 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
95
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
96 default: continue;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
97 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
98 MarkTileDirtyByTile(tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
99 success = true;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
100 } END_TILE_LOOP(tile, size_x, size_y, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
101
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
102 if (success) SndPlayTileFx(SND_1F_SPLAT, end);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
103 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
104
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
105 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
106 * A central place to handle all X_AND_Y dragged GUI functions.
6422
fb10eafe2a26 (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas <belugas@openttd.org>
parents: 6106
diff changeset
107 * @param e WindowEvent variable holding in its higher bits (excluding the lower
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
108 * 4, since that defined the X_Y drag) the type of action to be performed
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
109 * @return Returns true if the action was found and handled, and false otherwise. This
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
110 * allows for additional implements that are more local. For example X_Y drag
6422
fb10eafe2a26 (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas <belugas@openttd.org>
parents: 6106
diff changeset
111 * of convertrail which belongs in rail_gui.cpp and not terraform_gui.cpp
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
112 **/
9293
d14fbfc20940 (svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
113 bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
114 {
9293
d14fbfc20940 (svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
115 switch (proc) {
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
116 case DDSP_DEMOLISH_AREA:
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
117 DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
118 break;
8196
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
119 case DDSP_RAISE_AND_LEVEL_AREA:
8204
9c99122c73ad (svn r11767) -Fix: do not call rail specific functions when building road bridge
smatz <smatz@openttd.org>
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
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
121 break;
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
122 case DDSP_LOWER_AND_LEVEL_AREA:
8202
9688a4ecf78e (svn r11765) -Fix: compile warning (Roujin).
rubidium <rubidium@openttd.org>
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
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
124 break;
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
125 case DDSP_LEVEL_AREA:
10331
098888859ff0 (svn r14582) -Fix [FS#2392]: blank box on cost estimation of levelling a flat area.
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
126 DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_LEVEL_LAND | CMD_MSG(STR_CAN_T_LEVEL_LAND_HERE));
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
127 break;
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
128 case DDSP_CREATE_ROCKS:
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
129 GenerateRockyArea(end_tile, start_tile);
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
130 break;
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
131 case DDSP_CREATE_DESERT:
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
132 GenerateDesertArea(end_tile, start_tile);
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
133 break;
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
134 default:
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6600
diff changeset
135 return false;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
136 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
137
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
138 return true;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
139 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
140
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
141 typedef void OnButtonClick(Window *w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
142
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
143 static const uint16 _terraform_keycodes[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
144 'Q',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
145 'W',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
146 'E',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
147 'D',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
148 'U',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
149 'I',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
150 'O',
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
151 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
152
9150
c05caf850556 (svn r13012) -Fix (r13011): the PlaceProc that was moved depended on another function...
rubidium <rubidium@openttd.org>
parents: 9149
diff changeset
153 void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2);
c05caf850556 (svn r13012) -Fix (r13011): the PlaceProc that was moved depended on another function...
rubidium <rubidium@openttd.org>
parents: 9149
diff changeset
154
9149
856095066478 (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 <rubidium@openttd.org>
parents: 9143
diff changeset
155 static void PlaceProc_BuyLand(TileIndex tile)
856095066478 (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 <rubidium@openttd.org>
parents: 9143
diff changeset
156 {
856095066478 (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 <rubidium@openttd.org>
parents: 9143
diff changeset
157 DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND));
856095066478 (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 <rubidium@openttd.org>
parents: 9143
diff changeset
158 }
856095066478 (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 <rubidium@openttd.org>
parents: 9143
diff changeset
159
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
160 void PlaceProc_DemolishArea(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
161 {
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
162 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
163 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
164
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
165 static void PlaceProc_RaiseLand(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
166 {
8196
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
167 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_RAISE_AND_LEVEL_AREA);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
168 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
169
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
170 static void PlaceProc_LowerLand(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
171 {
8196
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
172 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LOWER_AND_LEVEL_AREA);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
173 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
174
9149
856095066478 (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 <rubidium@openttd.org>
parents: 9143
diff changeset
175 static void PlaceProc_LevelLand(TileIndex tile)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
176 {
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
177 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
178 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
179
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
180 /** Enum referring to the widgets of the terraform toolbar */
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
181 enum TerraformToolbarWidgets {
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
182 TTW_CLOSEBOX = 0, ///< Close window button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
183 TTW_CAPTION, ///< Window caption
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
184 TTW_STICKY, ///< Sticky window button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
185 TTW_SEPERATOR, ///< Thin seperator line between level land button and demolish button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
186 TTW_BUTTONS_START, ///< Start of pushable buttons
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
187 TTW_LOWER_LAND = TTW_BUTTONS_START, ///< Lower land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
188 TTW_RAISE_LAND, ///< Raise land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
189 TTW_LEVEL_LAND, ///< Level land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
190 TTW_DEMOLISH, ///< Demolish aka dynamite button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
191 TTW_BUY_LAND, ///< Buy land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
192 TTW_PLANT_TREES, ///< Plant trees button (note: opens seperate window, no place-push-button)
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
193 TTW_PLACE_SIGN, ///< Place sign button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
194 };
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
195
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
196 static void TerraformClick_Lower(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
197 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
198 HandlePlacePushButton(w, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerLand);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
199 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
200
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
201 static void TerraformClick_Raise(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
202 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
203 HandlePlacePushButton(w, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseLand);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
204 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
205
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
206 static void TerraformClick_Level(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
207 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
208 HandlePlacePushButton(w, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
209 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
210
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
211 static void TerraformClick_Dynamite(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
212 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
213 HandlePlacePushButton(w, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH , VHM_RECT, PlaceProc_DemolishArea);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
214 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
215
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
216 static void TerraformClick_BuyLand(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
217 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
218 HandlePlacePushButton(w, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, VHM_RECT, PlaceProc_BuyLand);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
219 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
220
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
221 static void TerraformClick_Trees(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
222 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
223 /* This button is NOT a place-push-button, so don't treat it as such */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
224 ShowBuildTreesToolbar();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
225 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
226
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
227 static void TerraformClick_PlaceSign(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
228 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
229 HandlePlacePushButton(w, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, VHM_RECT, PlaceProc_Sign);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
230 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
231
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
232 static OnButtonClick * const _terraform_button_proc[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
233 TerraformClick_Lower,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
234 TerraformClick_Raise,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
235 TerraformClick_Level,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
236 TerraformClick_Dynamite,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
237 TerraformClick_BuyLand,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
238 TerraformClick_Trees,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
239 TerraformClick_PlaceSign,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
240 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
241
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
242 struct TerraformToolbarWindow : Window {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
243 TerraformToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
244 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
245 this->FindWindowPlacementAndResize(desc);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
246 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
247
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
248 ~TerraformToolbarWindow()
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
249 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
250 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
251
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
252 virtual void OnPaint()
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
253 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
254 this->DrawWidgets();
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
255 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
256
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
257 virtual void OnClick(Point pt, int widget)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
258 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
259 if (widget >= TTW_BUTTONS_START) _terraform_button_proc[widget - TTW_BUTTONS_START](this);
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
260 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
261
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
262 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
263 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
264 for (uint i = 0; i != lengthof(_terraform_keycodes); i++) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
265 if (keycode == _terraform_keycodes[i]) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
266 _terraform_button_proc[i](this);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
267 return ES_HANDLED;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
268 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
269 }
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
270 return ES_NOT_HANDLED;
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
271 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
272
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
273 virtual void OnPlaceObject(Point pt, TileIndex tile)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
274 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
275 _place_proc(tile);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
276 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
277
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
278 virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
279 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
280 VpSelectTilesWithMethod(pt.x, pt.y, select_method);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
281 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
282
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
283 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
284 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
285 if (pt.x != -1) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
286 switch (select_proc) {
9293
d14fbfc20940 (svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
287 default: NOT_REACHED();
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
288 case DDSP_DEMOLISH_AREA:
8196
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
289 case DDSP_RAISE_AND_LEVEL_AREA:
de8100186000 (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 <peter1138@openttd.org>
parents: 8157
diff changeset
290 case DDSP_LOWER_AND_LEVEL_AREA:
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
291 case DDSP_LEVEL_AREA:
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
292 GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
293 break;
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
294 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
295 }
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
296 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
297
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
298 virtual void OnPlaceObjectAbort()
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
299 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
300 this->RaiseButtons();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
301 }
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
302 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
303
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
304 static const Widget _terraform_widgets[] = {
9778
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
305 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // TTW_CLOSEBOX
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
306 { WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 145, 0, 13, STR_LANDSCAPING_TOOLBAR, STR_018C_WINDOW_TITLE_DRAG_THIS}, // TTW_CAPTION
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
307 {WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 146, 157, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // TTW_STICKY
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
308
9778
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
309 { WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 66, 69, 14, 35, 0x0, STR_NULL}, // TTW_SEPERATOR
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
310 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 21, 14, 35, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND}, // TTW_LOWER_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
311 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 22, 43, 14, 35, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND}, // TTW_RAISE_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
312 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 44, 65, 14, 35, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, // TTW_LEVEL_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
313 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 70, 91, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // TTW_DEMOLISH
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
314 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 92, 113, 14, 35, SPR_IMG_BUY_LAND, STR_0329_PURCHASE_LAND_FOR_FUTURE}, // TTW_BUY_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
315 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 114, 135, 14, 35, SPR_IMG_PLANTTREES, STR_0185_PLANT_TREES_PLACE_SIGNS}, // TTW_PLANT_TREES
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
316 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 136, 157, 14, 35, SPR_IMG_SIGN, STR_0289_PLACE_SIGN}, // TTW_PLACE_SIGN
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
317
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
318 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
319 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
320
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
321 static const WindowDesc _terraform_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7322
diff changeset
322 WDP_ALIGN_TBR, 22 + 36, 158, 36, 158, 36,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5860
diff changeset
323 WC_SCEN_LAND_GEN, WC_NONE,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
324 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
325 _terraform_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
326 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
327
5860
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
328 void ShowTerraformToolbar(Window *link)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
329 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
330 if (!IsValidCompanyID(_current_company)) return;
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
331 Window *w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
5860
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
332 if (w != NULL && link != NULL) {
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
333 /* Align the terraform toolbar under the main toolbar and put the linked
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
334 * toolbar to left of it
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
335 */
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
336 w->top = 22;
9363
46cadba0a70e (svn r13260) -Fix: linked terraform toolbar wasn't marked dirty after moving
smatz <smatz@openttd.org>
parents: 9358
diff changeset
337 w->SetDirty();
5860
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
338 link->left = w->left - link->width;
9116
44beb31166aa (svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium <rubidium@openttd.org>
parents: 9111
diff changeset
339 link->SetDirty();
5860
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5584
diff changeset
340 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
341 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
342
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
343 static byte _terraform_size = 1;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
344
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
345 /**
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
346 * Raise/Lower a bigger chunk of land at the same time in the editor. When
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
347 * raising get the lowest point, when lowering the highest point, and set all
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
348 * tiles in the selection to that height.
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
349 * @todo : Incorporate into game itself to allow for ingame raising/lowering of
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
350 * larger chunks at the same time OR remove altogether, as we have 'level land' ?
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
351 * @param tile The top-left tile where the terraforming will start
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
352 * @param mode 1 for raising, 0 for lowering land
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
353 */
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
354 static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
355 {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
356 int sizex, sizey;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
357 uint h;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
358
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
359 if (_terraform_size == 1) {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
360 StringID msg =
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
361 mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
362
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
363 DoCommandP(tile, SLOPE_N, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_MSG(msg));
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
364 } else {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
365 assert(_terraform_size != 0);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
366 /* check out for map overflows */
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
367 sizex = min(MapSizeX() - TileX(tile) - 1, _terraform_size);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
368 sizey = min(MapSizeY() - TileY(tile) - 1, _terraform_size);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
369
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
370 if (sizex == 0 || sizey == 0) return;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
371
9586
77bb2e53ddc5 (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 <rubidium@openttd.org>
parents: 9517
diff changeset
372 SndPlayTileFx(SND_1F_SPLAT, tile);
77bb2e53ddc5 (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 <rubidium@openttd.org>
parents: 9517
diff changeset
373
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
374 if (mode != 0) {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
375 /* Raise land */
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
376 h = 15; // XXX - max height
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
377 BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
378 h = min(h, TileHeight(tile2));
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
379 } END_TILE_LOOP(tile2, sizex, sizey, tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
380 } else {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
381 /* Lower land */
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
382 h = 0;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
383 BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
384 h = max(h, TileHeight(tile2));
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
385 } END_TILE_LOOP(tile2, sizex, sizey, tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
386 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
387
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
388 BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
389 if (TileHeight(tile2) == h) {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
390 DoCommandP(tile2, SLOPE_N, (uint32)mode, NULL, CMD_TERRAFORM_LAND);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
391 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
392 } END_TILE_LOOP(tile2, sizex, sizey, tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
393 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
394 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
395
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
396 static void PlaceProc_RaiseBigLand(TileIndex tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
397 {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
398 CommonRaiseLowerBigLand(tile, 1);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
399 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
400
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
401 static void PlaceProc_LowerBigLand(TileIndex tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
402 {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
403 CommonRaiseLowerBigLand(tile, 0);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
404 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
405
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
406 static void PlaceProc_RockyArea(TileIndex tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
407 {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
408 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
409 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
410
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
411 static void PlaceProc_LightHouse(TileIndex tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
412 {
8472
99388386f8d8 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz <smatz@openttd.org>
parents: 8459
diff changeset
413 /* not flat || not(trees || clear without bridge above) */
99388386f8d8 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz <smatz@openttd.org>
parents: 8459
diff changeset
414 if (GetTileSlope(tile, NULL) != SLOPE_FLAT || !(IsTileType(tile, MP_TREES) || (IsTileType(tile, MP_CLEAR) && !IsBridgeAbove(tile)))) {
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
415 return;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
416 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
417
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
418 MakeLighthouse(tile);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
419 MarkTileDirtyByTile(tile);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
420 SndPlayTileFx(SND_1F_SPLAT, tile);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
421 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
422
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
423 static void PlaceProc_Transmitter(TileIndex tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
424 {
8472
99388386f8d8 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz <smatz@openttd.org>
parents: 8459
diff changeset
425 /* not flat || not(trees || clear without bridge above) */
99388386f8d8 (svn r12043) -Fix [FS#1736]: allow building transmitters and lighthouses on tree tiles
smatz <smatz@openttd.org>
parents: 8459
diff changeset
426 if (GetTileSlope(tile, NULL) != SLOPE_FLAT || !(IsTileType(tile, MP_TREES) || (IsTileType(tile, MP_CLEAR) && !IsBridgeAbove(tile)))) {
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
427 return;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
428 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
429
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
430 MakeTransmitter(tile);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
431 MarkTileDirtyByTile(tile);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
432 SndPlayTileFx(SND_1F_SPLAT, tile);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
433 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
434
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
435 static void PlaceProc_DesertArea(TileIndex tile)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
436 {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
437 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
438 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
439
8360
bf5f533a604f (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 <peter1138@openttd.org>
parents: 8270
diff changeset
440
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
441 static const Widget _scen_edit_land_gen_widgets[] = {
9778
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
442 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ETTW_CLOSEBOX
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
443 { WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 150, 0, 13, STR_0223_LAND_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ETTW_CAPTION
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
444 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 151, 162, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // ETTW_STICKY
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
445 { WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 162, 14, 102, 0x0, STR_NULL}, // ETTW_BACKGROUND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
446 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 2, 23, 16, 37, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // ETTW_DEMOLISH
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
447 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 24, 45, 16, 37, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND}, // ETTW_LOWER_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
448 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 46, 67, 16, 37, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND}, // ETTW_RAISE_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
449 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 68, 89, 16, 37, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, // ETTW_LEVEL_LAND
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
450 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 90, 111, 16, 37, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE}, // ETTW_PLACE_ROCKS
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
451 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 112, 133, 16, 37, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, // ETTW_PLACE_DESERT_LIGHTHOUSE XXX - dynamic
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
452 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 134, 156, 16, 37, SPR_IMG_TRANSMITTER, STR_028E_PLACE_TRANSMITTER}, // ETTW_PLACE_TRANSMITTER
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
453 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 150, 161, 45, 56, SPR_ARROW_UP, STR_0228_INCREASE_SIZE_OF_LAND_AREA}, // ETTW_INCREASE_SIZE
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
454 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 150, 161, 58, 69, SPR_ARROW_DOWN, STR_0229_DECREASE_SIZE_OF_LAND_AREA}, // ETTW_DECREASE_SIZE
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
455 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 161, 76, 87, STR_SE_NEW_WORLD, STR_022A_GENERATE_RANDOM_LAND}, // ETTW_NEW_SCENARIO
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
456 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 161, 89, 100, STR_022B_RESET_LANDSCAPE, STR_RESET_LANDSCAPE_TOOLTIP}, // ETTW_RESET_LANDSCAPE
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
457 { WIDGETS_END},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
458 };
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
459
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
460 static const int8 _multi_terraform_coords[][2] = {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
461 { 0, -2},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
462 { 4, 0}, { -4, 0}, { 0, 2},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
463 { -8, 2}, { -4, 4}, { 0, 6}, { 4, 4}, { 8, 2},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
464 {-12, 0}, { -8, -2}, { -4, -4}, { 0, -6}, { 4, -4}, { 8, -2}, { 12, 0},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
465 {-16, 2}, {-12, 4}, { -8, 6}, { -4, 8}, { 0, 10}, { 4, 8}, { 8, 6}, { 12, 4}, { 16, 2},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
466 {-20, 0}, {-16, -2}, {-12, -4}, { -8, -6}, { -4, -8}, { 0,-10}, { 4, -8}, { 8, -6}, { 12, -4}, { 16, -2}, { 20, 0},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
467 {-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},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
468 {-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},
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
469 };
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
470
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
471 /** Enum referring to the widgets of the editor terraform toolbar */
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
472 enum EditorTerraformToolbarWidgets {
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
473 ETTW_START = 0, ///< Used for iterations
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
474 ETTW_CLOSEBOX = ETTW_START, ///< Close window button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
475 ETTW_CAPTION, ///< Window caption
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
476 ETTW_STICKY, ///< Sticky window button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
477 ETTW_BACKGROUND, ///< Background of the lower part of the window
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
478 ETTW_BUTTONS_START, ///< Start of pushable buttons
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
479 ETTW_DEMOLISH = ETTW_BUTTONS_START, ///< Demolish aka dynamite button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
480 ETTW_LOWER_LAND, ///< Lower land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
481 ETTW_RAISE_LAND, ///< Raise land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
482 ETTW_LEVEL_LAND, ///< Level land button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
483 ETTW_PLACE_ROCKS, ///< Place rocks button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
484 ETTW_PLACE_DESERT_LIGHTHOUSE, ///< Place desert button (in tropical climate) / place lighthouse button (else)
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
485 ETTW_PLACE_TRANSMITTER, ///< Place transmitter button
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
486 ETTW_BUTTONS_END, ///< End of pushable buttons
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
487 ETTW_INCREASE_SIZE = ETTW_BUTTONS_END, ///< Upwards arrow button to increase terraforming size
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
488 ETTW_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
489 ETTW_NEW_SCENARIO, ///< Button for generating a new scenario
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
490 ETTW_RESET_LANDSCAPE, ///< Button for removing all company-owned property
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
491 };
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
492
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
493 /**
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
494 * @todo Merge with terraform_gui.cpp (move there) after I have cooled down at its braindeadness
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
495 * and changed OnButtonClick to include the widget as well in the function declaration. Post 0.4.0 - Darkvater
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
496 */
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
497 static void EditorTerraformClick_Dynamite(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
498 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
499 HandlePlacePushButton(w, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
500 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
501
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
502 static void EditorTerraformClick_LowerBigLand(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
503 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
504 HandlePlacePushButton(w, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerBigLand);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
505 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
506
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
507 static void EditorTerraformClick_RaiseBigLand(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
508 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
509 HandlePlacePushButton(w, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseBigLand);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
510 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
511
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
512 static void EditorTerraformClick_LevelLand(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
513 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
514 HandlePlacePushButton(w, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
515 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
516
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
517 static void EditorTerraformClick_RockyArea(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
518 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
519 HandlePlacePushButton(w, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, VHM_RECT, PlaceProc_RockyArea);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
520 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
521
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
522 static void EditorTerraformClick_DesertLightHouse(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
523 {
9413
512ea64da840 (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 <rubidium@openttd.org>
parents: 9363
diff changeset
524 HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, VHM_RECT, (_settings_game.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
525 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
526
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
527 static void EditorTerraformClick_Transmitter(Window *w)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
528 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
529 HandlePlacePushButton(w, ETTW_PLACE_TRANSMITTER, SPR_CURSOR_TRANSMITTER, VHM_RECT, PlaceProc_Transmitter);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
530 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
531
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
532 static const uint16 _editor_terraform_keycodes[] = {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
533 'D',
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
534 'Q',
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
535 'W',
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
536 'E',
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
537 'R',
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
538 'T',
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9586
diff changeset
539 'Y'
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
540 };
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
541
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
542 typedef void OnButtonClick(Window *w);
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
543 static OnButtonClick * const _editor_terraform_button_proc[] = {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
544 EditorTerraformClick_Dynamite,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
545 EditorTerraformClick_LowerBigLand,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
546 EditorTerraformClick_RaiseBigLand,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
547 EditorTerraformClick_LevelLand,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
548 EditorTerraformClick_RockyArea,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
549 EditorTerraformClick_DesertLightHouse,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
550 EditorTerraformClick_Transmitter
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
551 };
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
552
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
553
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
554 /** Callback function for the scenario editor 'reset landscape' confirmation window
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
555 * @param w Window unused
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
556 * @param confirmed boolean value, true when yes was clicked, false otherwise */
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
557 static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
558 {
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
559 if (confirmed) {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
560 Company *c;
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
561
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
562 /* Set generating_world to true to get instant-green grass after removing
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
563 * company property. */
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
564 _generating_world = true;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
565
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
566 /* Delete all stations owned by a company */
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
567 Station *st;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
568 FOR_ALL_STATIONS(st) {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
569 if (IsValidCompanyID(st->owner)) delete st;
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
570 }
9659
14e241fadc66 (svn r13731) -Codechange: make a pool of the array of players.
rubidium <rubidium@openttd.org>
parents: 9652
diff changeset
571
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
572 /* Delete all companies */
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
573 FOR_ALL_COMPANIES(c) {
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
574 ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER);
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 9778
diff changeset
575 delete c;
9659
14e241fadc66 (svn r13731) -Codechange: make a pool of the array of players.
rubidium <rubidium@openttd.org>
parents: 9652
diff changeset
576 }
14e241fadc66 (svn r13731) -Codechange: make a pool of the array of players.
rubidium <rubidium@openttd.org>
parents: 9652
diff changeset
577 _generating_world = false;
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
578 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
579 }
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
580
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
581 struct ScenarioEditorLandscapeGenerationWindow : Window {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
582 ScenarioEditorLandscapeGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
583 {
9413
512ea64da840 (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 <rubidium@openttd.org>
parents: 9363
diff changeset
584 this->widget[ETTW_PLACE_DESERT_LIGHTHOUSE].tooltips = (_settings_game.game_creation.landscape == LT_TROPIC) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
585 this->FindWindowPlacementAndResize(desc);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
586 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
587
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
588 virtual void OnPaint() {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
589 this->DrawWidgets();
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
590
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
591 int n = _terraform_size * _terraform_size;
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
592 const int8 *coords = &_multi_terraform_coords[0][0];
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
593
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
594 assert(n != 0);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
595 do {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
596 DrawSprite(SPR_WHITE_POINT, PAL_NONE, 88 + coords[0], 55 + coords[1]);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
597 coords += 2;
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
598 } while (--n);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
599
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
600 if (this->IsWidgetLowered(ETTW_LOWER_LAND) || this->IsWidgetLowered(ETTW_RAISE_LAND)) { // change area-size if raise/lower corner is selected
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
601 SetTileSelectSize(_terraform_size, _terraform_size);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
602 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
603 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
604
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
605 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
606 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
607 for (uint i = 0; i != lengthof(_editor_terraform_keycodes); i++) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
608 if (keycode == _editor_terraform_keycodes[i]) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
609 _editor_terraform_button_proc[i](this);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
610 return ES_HANDLED;
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
611 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
612 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
613 return ES_NOT_HANDLED;
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
614 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
615
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
616 virtual void OnClick(Point pt, int widget)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
617 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
618 if (IsInsideMM(widget, ETTW_BUTTONS_START, ETTW_BUTTONS_END)) {
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
619 _editor_terraform_button_proc[widget - ETTW_BUTTONS_START](this);
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
620 } else {
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
621 switch (widget) {
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
622 case ETTW_INCREASE_SIZE:
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
623 case ETTW_DECREASE_SIZE: { // Increase/Decrease terraform size
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
624 int size = (widget == ETTW_INCREASE_SIZE) ? 1 : -1;
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
625 this->HandleButtonClick(widget);
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
626 size += _terraform_size;
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
627
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
628 if (!IsInsideMM(size, 1, 8 + 1)) return;
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
629 _terraform_size = size;
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
630
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
631 SndPlayFx(SND_15_BEEP);
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
632 this->SetDirty();
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
633 } break;
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
634 case ETTW_NEW_SCENARIO: // gen random land
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
635 this->HandleButtonClick(widget);
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
636 ShowCreateScenario();
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
637 break;
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
638 case ETTW_RESET_LANDSCAPE: // Reset landscape
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
639 ShowQuery(
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
640 STR_022C_RESET_LANDSCAPE,
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
641 STR_RESET_LANDSCAPE_CONFIRMATION_TEXT,
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
642 NULL,
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
643 ResetLandscapeConfirmationCallback);
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
644 break;
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
645 }
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
646 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
647 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
648
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
649 virtual void OnTimeout()
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
650 {
9328
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
651 for (uint i = ETTW_START; i < this->widget_count; i++) {
61c9eca2b451 (svn r13216) -Codechange [FS#2026]: enumify and comment Editor Terraform Toolbar widgets (Roujin)
smatz <smatz@openttd.org>
parents: 9317
diff changeset
652 if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
653 if (this->IsWidgetLowered(i)) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
654 this->RaiseWidget(i);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
655 this->InvalidateWidget(i);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
656 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
657 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
658 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
659
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
660 virtual void OnPlaceObject(Point pt, TileIndex tile)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
661 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
662 _place_proc(tile);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
663 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
664
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
665 virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
666 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
667 VpSelectTilesWithMethod(pt.x, pt.y, select_method);
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
668 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
669
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
670 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
671 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
672 if (pt.x != -1) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
673 switch (select_proc) {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
674 default: NOT_REACHED();
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
675 case DDSP_CREATE_ROCKS:
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
676 case DDSP_CREATE_DESERT:
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
677 case DDSP_RAISE_AND_LEVEL_AREA:
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
678 case DDSP_LOWER_AND_LEVEL_AREA:
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
679 case DDSP_LEVEL_AREA:
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
680 case DDSP_DEMOLISH_AREA:
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
681 GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
682 break;
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
683 }
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
684 }
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
685 }
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
686
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
687 virtual void OnPlaceObjectAbort()
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
688 {
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
689 this->RaiseButtons();
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
690 this->SetDirty();
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
691 }
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
692 };
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
693
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
694 static const WindowDesc _scen_edit_land_gen_desc = {
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9586
diff changeset
695 WDP_AUTO, WDP_AUTO, 163, 103, 163, 103,
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
696 WC_SCEN_LAND_GEN, WC_NONE,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
697 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
698 _scen_edit_land_gen_widgets,
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
699 };
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
700
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
701 void ShowEditorTerraformToolbar()
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
702 {
9304
d645131abaad (svn r13172) -Codechange: make a window class of the terraform toolbars.
rubidium <rubidium@openttd.org>
parents: 9293
diff changeset
703 AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(&_scen_edit_land_gen_desc, 0);
8205
0d3299690c51 (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 <rubidium@openttd.org>
parents: 8204
diff changeset
704 }