src/tree_gui.cpp
author rubidium
Sun, 11 May 2008 14:09:38 +0000
changeset 10501 10f2642f41dc
parent 10467 a8de2b5759bd
child 10517 2e55d1418bd8
permissions -rw-r--r--
(svn r13044) -Fix: deleting an already deleted window.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2167
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2167
diff changeset
     2
10467
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
     3
/** @file tree_gui.cpp GUIs for building trees. */
6527
f584ab6d87f8 (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents: 6523
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
92a3b0aa0946 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1879
diff changeset
     6
#include "openttd.h"
8603
88c5ce6a5215 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8602
diff changeset
     7
#include "window_gui.h"
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8710
diff changeset
     8
#include "gfx_func.h"
10467
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
     9
#include "tilehighlight_func.h"
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8720
diff changeset
    10
#include "player_func.h"
10467
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
    11
#include "command_func.h"
8653
a83f7a536919 (svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents: 8648
diff changeset
    12
#include "sound_func.h"
8766
c86cfa3a7580 (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents: 8760
diff changeset
    13
#include "settings_type.h"
8615
6b91ca653bad (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8612
diff changeset
    14
8760
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    15
#include "table/sprites.h"
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    16
#include "table/strings.h"
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    17
#include "table/tree_land.h"
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    18
10467
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
    19
struct tree_d {
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
    20
	uint16 base;
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
    21
	uint16 count;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
};
10467
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
    23
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
static int _tree_to_plant;
10467
a8de2b5759bd (svn r13010) -Codechange: move the tree building GUI out of misc_gui.cpp.
rubidium
parents: 10462
diff changeset
    26
void PlaceTreesRandomly();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    28
static const PalSpriteID _tree_sprites[] = {
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    29
	{ 0x655, PAL_NONE }, { 0x663, PAL_NONE }, { 0x678, PAL_NONE }, { 0x62B, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    30
	{ 0x647, PAL_NONE }, { 0x639, PAL_NONE }, { 0x64E, PAL_NONE }, { 0x632, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    31
	{ 0x67F, PAL_NONE }, { 0x68D, PAL_NONE }, { 0x69B, PAL_NONE }, { 0x6A9, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    32
	{ 0x6AF, PAL_NONE }, { 0x6D2, PAL_NONE }, { 0x6D9, PAL_NONE }, { 0x6C4, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    33
	{ 0x6CB, PAL_NONE }, { 0x6B6, PAL_NONE }, { 0x6BD, PAL_NONE }, { 0x6E0, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    34
	{ 0x72E, PAL_NONE }, { 0x734, PAL_NONE }, { 0x74A, PAL_NONE }, { 0x74F, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    35
	{ 0x76B, PAL_NONE }, { 0x78F, PAL_NONE }, { 0x788, PAL_NONE }, { 0x77B, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    36
	{ 0x75F, PAL_NONE }, { 0x774, PAL_NONE }, { 0x720, PAL_NONE }, { 0x797, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    37
	{ 0x79E, PAL_NONE }, { 0x7A5, PALETTE_TO_GREEN }, { 0x7AC, PALETTE_TO_RED }, { 0x7B3, PAL_NONE },
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5890
diff changeset
    38
	{ 0x7BA, PAL_NONE }, { 0x7C1, PALETTE_TO_RED, }, { 0x7C8, PALETTE_TO_PALE_GREEN }, { 0x7CF, PALETTE_TO_YELLOW }, { 0x7D6, PALETTE_TO_RED }
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
static void BuildTreesWndProc(Window *w, WindowEvent *e)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
{
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2631
diff changeset
    43
	switch (e->event) {
9327
4520e2d84651 (svn r12579) -Change: reset cursor when the Plant trees GUI is opened
smatz
parents: 9315
diff changeset
    44
		case WE_CREATE:
4520e2d84651 (svn r12579) -Change: reset cursor when the Plant trees GUI is opened
smatz
parents: 9315
diff changeset
    45
			ResetObjectToPlace();
4520e2d84651 (svn r12579) -Change: reset cursor when the Plant trees GUI is opened
smatz
parents: 9315
diff changeset
    46
			break;
4520e2d84651 (svn r12579) -Change: reset cursor when the Plant trees GUI is opened
smatz
parents: 9315
diff changeset
    47
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    48
		case WE_PAINT: {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    49
			DrawWindowWidgets(w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
9315
336e6518acb3 (svn r12565) -Cleanup: variable scope in misc\*.cpp
smatz
parents: 9305
diff changeset
    51
			int i = WP(w, tree_d).base = _tree_base_by_landscape[_opt.landscape];
336e6518acb3 (svn r12565) -Cleanup: variable scope in misc\*.cpp
smatz
parents: 9305
diff changeset
    52
			int count = WP(w, tree_d).count = _tree_count_by_landscape[_opt.landscape];
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    53
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    54
			int x = 18;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    55
			int y = 54;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    56
			do {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    57
				DrawSprite(_tree_sprites[i].sprite, _tree_sprites[i].pal, x, y);
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    58
				x += 35;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    59
				if (!(++i & 3)) {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    60
					x -= 35 * 4;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    61
					y += 47;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    62
				}
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    63
			} while (--count);
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    64
		} break;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    65
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    66
		case WE_CLICK: {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    67
			int wid = e->we.click.widget;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    68
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    69
			switch (wid) {
9315
336e6518acb3 (svn r12565) -Cleanup: variable scope in misc\*.cpp
smatz
parents: 9305
diff changeset
    70
				case 0:
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    71
					ResetObjectToPlace();
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    72
					break;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    73
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    74
				case 3: case 4: case 5: case 6:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    75
				case 7: case 8: case 9: case 10:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    76
				case 11:case 12: case 13: case 14:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    77
					if (wid - 3 >= WP(w, tree_d).count) break;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    78
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    79
					if (HandlePlacePushButton(w, wid, SPR_CURSOR_TREE, VHM_RECT, NULL)) {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    80
						_tree_to_plant = WP(w, tree_d).base + wid - 3;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    81
					}
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    82
					break;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    83
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    84
				case 15: // tree of random type.
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    85
					if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, VHM_RECT, NULL)) {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    86
						_tree_to_plant = -1;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    87
					}
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    88
					break;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    89
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    90
				case 16: // place trees randomly over the landscape
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    91
					w->LowerWidget(16);
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    92
					w->flags4 |= 5 << WF_TIMEOUT_SHL;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    93
					SndPlayFx(SND_15_BEEP);
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    94
					PlaceTreesRandomly();
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    95
					MarkWholeScreenDirty();
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    96
					break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
			}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
    98
		} break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    99
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   100
		case WE_PLACE_OBJ:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   101
			VpStartPlaceSizing(e->we.place.tile, VPM_X_AND_Y_LIMITED, DDSP_PLANT_TREES);
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   102
			VpSetPlaceSizingLimit(20);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   103
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   104
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   105
		case WE_PLACE_DRAG:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   106
			VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   107
			return;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   108
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   109
		case WE_PLACE_MOUSEUP:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   110
			if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_PLANT_TREES) {
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   111
				DoCommandP(e->we.place.tile, _tree_to_plant, e->we.place.starttile, NULL,
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   112
					CMD_PLANT_TREE | CMD_MSG(STR_2805_CAN_T_PLANT_TREE_HERE));
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   113
			}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   115
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   116
		case WE_TIMEOUT:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   117
			w->RaiseWidget(16);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   120
		case WE_ABORT_PLACE_OBJ:
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   121
			w->RaiseButtons();
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   122
			break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   124
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   126
static const Widget _build_trees_widgets[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   127
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   128
{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   142,     0,    13, STR_2802_TREES,        STR_018C_WINDOW_TITLE_DRAG_THIS},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   129
{      WWT_PANEL,   RESIZE_NONE,     7,     0,   142,    14,   170, 0x0,                   STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   130
{      WWT_PANEL,   RESIZE_NONE,    14,     2,    35,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   131
{      WWT_PANEL,   RESIZE_NONE,    14,    37,    70,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   132
{      WWT_PANEL,   RESIZE_NONE,    14,    72,   105,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   133
{      WWT_PANEL,   RESIZE_NONE,    14,   107,   140,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   134
{      WWT_PANEL,   RESIZE_NONE,    14,     2,    35,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   135
{      WWT_PANEL,   RESIZE_NONE,    14,    37,    70,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   136
{      WWT_PANEL,   RESIZE_NONE,    14,    72,   105,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   137
{      WWT_PANEL,   RESIZE_NONE,    14,   107,   140,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   138
{      WWT_PANEL,   RESIZE_NONE,    14,     2,    35,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   139
{      WWT_PANEL,   RESIZE_NONE,    14,    37,    70,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   140
{      WWT_PANEL,   RESIZE_NONE,    14,    72,   105,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   141
{      WWT_PANEL,   RESIZE_NONE,    14,   107,   140,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   142
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   140,   157,   168, STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TIP},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 172
diff changeset
   143
{    WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
static const WindowDesc _build_trees_desc = {
7837
65d7362153a6 (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7817
diff changeset
   147
	497, 22, 143, 171, 143, 171,
606
0e507bb0f63a (svn r1030) Some toolbar icons are arranged differently:
dominik
parents: 598
diff changeset
   148
	WC_BUILD_TREES, WC_SCEN_LAND_GEN,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
	_build_trees_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
	BuildTreesWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   152
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
static const Widget _build_trees_scen_widgets[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   155
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   156
{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   142,     0,    13, STR_2802_TREES,        STR_018C_WINDOW_TITLE_DRAG_THIS},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   157
{      WWT_PANEL,   RESIZE_NONE,     7,     0,   142,    14,   183, 0x0,                   STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   158
{      WWT_PANEL,   RESIZE_NONE,    14,     2,    35,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   159
{      WWT_PANEL,   RESIZE_NONE,    14,    37,    70,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   160
{      WWT_PANEL,   RESIZE_NONE,    14,    72,   105,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   161
{      WWT_PANEL,   RESIZE_NONE,    14,   107,   140,    16,    61, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   162
{      WWT_PANEL,   RESIZE_NONE,    14,     2,    35,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   163
{      WWT_PANEL,   RESIZE_NONE,    14,    37,    70,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   164
{      WWT_PANEL,   RESIZE_NONE,    14,    72,   105,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   165
{      WWT_PANEL,   RESIZE_NONE,    14,   107,   140,    63,   108, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   166
{      WWT_PANEL,   RESIZE_NONE,    14,     2,    35,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   167
{      WWT_PANEL,   RESIZE_NONE,    14,    37,    70,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   168
{      WWT_PANEL,   RESIZE_NONE,    14,    72,   105,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   169
{      WWT_PANEL,   RESIZE_NONE,    14,   107,   140,   110,   155, 0x0,                   STR_280D_SELECT_TREE_TYPE_TO_PLANT},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   170
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   140,   157,   168, STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TIP},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4326
diff changeset
   171
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   140,   170,   181, STR_028A_RANDOM_TREES, STR_028B_PLANT_TREES_RANDOMLY_OVER},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 172
diff changeset
   172
{    WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
static const WindowDesc _build_trees_scen_desc = {
7837
65d7362153a6 (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7817
diff changeset
   176
	WDP_AUTO, WDP_AUTO, 143, 184, 143, 184,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 6001
diff changeset
   177
	WC_BUILD_TREES, WC_NONE,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
	_build_trees_scen_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
	BuildTreesWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 179
diff changeset
   183
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6565
diff changeset
   184
void ShowBuildTreesToolbar()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
{
5005
21e84e53c732 (svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents: 4994
diff changeset
   186
	if (!IsValidPlayer(_current_player)) return;
10462
416b62f5ee6f (svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents: 10461
diff changeset
   187
	AllocateWindowDescFront<Window>(&_build_trees_desc, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   188
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6565
diff changeset
   190
void ShowBuildTreesScenToolbar()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
{
10462
416b62f5ee6f (svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents: 10461
diff changeset
   192
	AllocateWindowDescFront<Window>(&_build_trees_scen_desc, 0);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
}