author | tron |
Wed, 01 Feb 2006 19:53:17 +0000 | |
changeset 2957 | 2bbb4add3410 |
parent 2955 | 27221592ebbc |
child 2958 | 3f8946daf55f |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1784
diff
changeset
|
4 |
#include "openttd.h" |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
5 |
#include "clear.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
497
diff
changeset
|
6 |
#include "table/strings.h" |
2148
47ba4a1b1c3b
(svn r2658) -Codechange: Use MAKE_TRANSPARENT to display a transparented sprite
celestar
parents:
2118
diff
changeset
|
7 |
#include "table/sprites.h" |
1784
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
8 |
#include "table/tree_land.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2153
diff
changeset
|
9 |
#include "functions.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
541
diff
changeset
|
10 |
#include "map.h" |
1209
a1ac96655b79
(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
tron
parents:
1202
diff
changeset
|
11 |
#include "tile.h" |
0 | 12 |
#include "viewport.h" |
13 |
#include "command.h" |
|
14 |
#include "town.h" |
|
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
15 |
#include "sound.h" |
2153
91e89aa8c299
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2148
diff
changeset
|
16 |
#include "variables.h" |
0 | 17 |
|
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
18 |
static int GetRandomTreeType(TileIndex tile, uint seed) |
0 | 19 |
{ |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
20 |
switch (_opt.landscape) { |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
21 |
case LT_NORMAL: |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
22 |
return seed * 12 >> 8; |
0 | 23 |
|
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
24 |
case LT_HILLY: |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
25 |
return (seed >> 5) + 12; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
26 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
27 |
case LT_DESERT: |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
28 |
switch (GetMapExtraBits(tile)) { |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
29 |
case 0: return (seed >> 6) + 28; |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
30 |
case 1: return (seed > 12) ? -1 : 27; |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
31 |
default: return (seed * 7 >> 8) + 20; |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
32 |
} |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
33 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
34 |
default: |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
35 |
return (seed * 9 >> 8) + 32; |
0 | 36 |
} |
37 |
} |
|
38 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
39 |
static void PlaceTree(TileIndex tile, uint32 r, byte m5_or) |
0 | 40 |
{ |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
41 |
int tree = GetRandomTreeType(tile, GB(r, 24, 8)); |
0 | 42 |
byte m5; |
43 |
||
44 |
if (tree >= 0) { |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
45 |
SetTileType(tile, MP_TREES); |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
46 |
|
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
47 |
m5 = GB(r, 16, 8); |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
48 |
if (GB(m5, 0, 3) == 7) m5--; // there is no growth state 7 |
0 | 49 |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
50 |
_m[tile].m5 = m5 & 0x07; // growth state; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
51 |
_m[tile].m5 |= m5 & 0xC0; // amount of trees |
0 | 52 |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
53 |
_m[tile].m3 = tree; // set type of tree |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
54 |
_m[tile].m4 = 0; // no hedge |
0 | 55 |
|
56 |
// above snowline? |
|
1370
5818d387fa69
(svn r1874) Fix bug introduced in r1839 which placed snow covered trees below the snow line ([1121680])
tron
parents:
1286
diff
changeset
|
57 |
if (_opt.landscape == LT_HILLY && GetTileZ(tile) > _opt.snow_line) { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
58 |
_m[tile].m2 = 0xE0; // set land type to snow |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
59 |
_m[tile].m2 |= GB(r, 24, 3); // randomize counter |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
60 |
} else { |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
61 |
_m[tile].m2 = GB(r, 24, 5); // randomize counter and ground |
0 | 62 |
} |
63 |
} |
|
64 |
} |
|
65 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
66 |
static void DoPlaceMoreTrees(TileIndex tile) |
0 | 67 |
{ |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
68 |
uint i; |
0 | 69 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
70 |
for (i = 0; i < 1000; i++) { |
0 | 71 |
uint32 r = Random(); |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
72 |
int x = GB(r, 0, 5) - 16; |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
73 |
int y = GB(r, 8, 5) - 16; |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
74 |
uint dist = myabs(x) + myabs(y); |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
75 |
TileIndex cur_tile = TILE_MASK(tile + TileDiffXY(x, y)); |
0 | 76 |
|
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
77 |
if (dist <= 13 && |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
78 |
IsTileType(cur_tile, MP_CLEAR) && |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
79 |
!IsClearGround(cur_tile, CL_FIELDS) && |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
80 |
!IsClearGround(cur_tile, CL_ROCKS)) { |
0 | 81 |
PlaceTree(cur_tile, r, dist <= 6 ? 0xC0 : 0); |
82 |
} |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
83 |
} |
0 | 84 |
} |
85 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
86 |
static void PlaceMoreTrees(void) |
0 | 87 |
{ |
2243 | 88 |
uint i = ScaleByMapSize(GB(Random(), 0, 5) + 25); |
0 | 89 |
do { |
2051 | 90 |
DoPlaceMoreTrees(RandomTile()); |
0 | 91 |
} while (--i); |
92 |
} |
|
93 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
94 |
void PlaceTreesRandomly(void) |
0 | 95 |
{ |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
96 |
uint i; |
0 | 97 |
|
1202
7d8b86bd8ba2
(svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
tron
parents:
1093
diff
changeset
|
98 |
i = ScaleByMapSize(1000); |
0 | 99 |
do { |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
100 |
uint32 r = Random(); |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
101 |
TileIndex tile = RandomTileSeed(r); |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
102 |
if (IsTileType(tile, MP_CLEAR) && |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
103 |
!IsClearGround(tile, CL_FIELDS) && |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
104 |
!IsClearGround(tile, CL_ROCKS)) { |
0 | 105 |
PlaceTree(tile, r, 0); |
106 |
} |
|
107 |
} while (--i); |
|
108 |
||
109 |
/* place extra trees at rainforest area */ |
|
110 |
if (_opt.landscape == LT_DESERT) { |
|
1202
7d8b86bd8ba2
(svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
tron
parents:
1093
diff
changeset
|
111 |
i = ScaleByMapSize(15000); |
0 | 112 |
|
113 |
do { |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
114 |
uint32 r = Random(); |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
115 |
TileIndex tile = RandomTileSeed(r); |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
1005
diff
changeset
|
116 |
if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) { |
0 | 117 |
PlaceTree(tile, r, 0); |
118 |
} |
|
119 |
} while (--i); |
|
120 |
} |
|
121 |
} |
|
122 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
123 |
void GenerateTrees(void) |
0 | 124 |
{ |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
125 |
uint i; |
0 | 126 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
127 |
if (_opt.landscape != LT_CANDY) PlaceMoreTrees(); |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
128 |
|
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
129 |
for (i = _opt.landscape == LT_HILLY ? 15 : 6; i != 0; i--) { |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
130 |
PlaceTreesRandomly(); |
0 | 131 |
} |
132 |
} |
|
133 |
||
1784
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
134 |
/** Plant a tree. |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
135 |
* @param x,y start tile of area-drag of tree plantation |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
136 |
* @param p1 tree type, -1 means random. |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
137 |
* @param p2 end tile of area-drag |
0 | 138 |
*/ |
139 |
int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2) |
|
140 |
{ |
|
141 |
int32 cost; |
|
2118
c73d32cc0b5e
(svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents:
2088
diff
changeset
|
142 |
int sx, sy, x, y; |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
143 |
|
2892
390125af7685
(svn r3446) - Fix: incorrect validating of tree-planting command which can allow a buffer-overflow (Tron)
Darkvater
parents:
2654
diff
changeset
|
144 |
if (p2 >= MapSize()) return CMD_ERROR; |
1784
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
145 |
/* Check the tree type. It can be random or some valid value within the current climate */ |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
146 |
if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_opt.landscape] >= _tree_count_by_landscape[_opt.landscape]) return CMD_ERROR; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
147 |
|
0 | 148 |
SET_EXPENSES_TYPE(EXPENSES_OTHER); |
149 |
||
150 |
// make sure sx,sy are smaller than ex,ey |
|
2118
c73d32cc0b5e
(svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents:
2088
diff
changeset
|
151 |
sx = TileX(p2); |
c73d32cc0b5e
(svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents:
2088
diff
changeset
|
152 |
sy = TileY(p2); |
c73d32cc0b5e
(svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents:
2088
diff
changeset
|
153 |
ex /= 16; ey /= 16; |
0 | 154 |
if (ex < sx) intswap(ex, sx); |
155 |
if (ey < sy) intswap(ey, sy); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
156 |
|
0 | 157 |
cost = 0; // total cost |
158 |
||
2118
c73d32cc0b5e
(svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents:
2088
diff
changeset
|
159 |
for (x = sx; x <= ex; x++) { |
c73d32cc0b5e
(svn r2628) - Fix: Planting trees does not result in a MapSize() assertion anymore; introduced in r2598
Darkvater
parents:
2088
diff
changeset
|
160 |
for (y = sy; y <= ey; y++) { |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
161 |
TileIndex tile = TileXY(x, y); |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
162 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
163 |
if (!EnsureNoVehicle(tile)) continue; |
0 | 164 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
165 |
switch (GetTileType(tile)) { |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
166 |
case MP_TREES: |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
167 |
// no more space for trees? |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
168 |
if (_game_mode != GM_EDITOR && (_m[tile].m5 & 0xC0) == 0xC0) { |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
169 |
_error_message = STR_2803_TREE_ALREADY_HERE; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
170 |
continue; |
0 | 171 |
} |
172 |
||
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
173 |
if (flags & DC_EXEC) { |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
174 |
_m[tile].m5 += 0x40; |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
175 |
MarkTileDirtyByTile(tile); |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
176 |
} |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
177 |
// 2x as expensive to add more trees to an existing tile |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
178 |
cost += _price.build_trees * 2; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
179 |
break; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
180 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
181 |
case MP_CLEAR: |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
182 |
if (!IsTileOwner(tile, OWNER_NONE)) { |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
183 |
_error_message = STR_2804_SITE_UNSUITABLE; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
184 |
continue; |
0 | 185 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
186 |
|
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
187 |
switch (GetClearGround(tile)) { |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
188 |
case CL_FIELDS: cost += _price.clear_3; break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
189 |
case CL_ROCKS: cost += _price.clear_2; break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
190 |
default: break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
191 |
} |
0 | 192 |
|
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
193 |
if (flags & DC_EXEC) { |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
194 |
int treetype; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
195 |
int m2; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
196 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
197 |
if (_game_mode != GM_EDITOR && _current_player < MAX_PLAYERS) { |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
198 |
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
199 |
if (t != NULL) |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
200 |
ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM); |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
201 |
} |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
202 |
|
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
203 |
switch (GetClearGround(tile)) { |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
204 |
case CL_ROUGH: m2 = 16; break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
205 |
case CL_SNOW: m2 = GetClearDensity(tile) << 6 | 0x20; break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
206 |
default: m2 = 0; break; |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
207 |
} |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
208 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
209 |
treetype = p1; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
210 |
if (treetype == -1) { |
2635 | 211 |
treetype = GetRandomTreeType(tile, GB(Random(), 24, 8)); |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
212 |
if (treetype == -1) treetype = 27; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
213 |
} |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
214 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
215 |
ModifyTile(tile, |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
216 |
MP_SETTYPE(MP_TREES) | |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
217 |
MP_MAP2 | MP_MAP3LO | MP_MAP3HI_CLEAR | MP_MAP5, |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
218 |
m2, /* map2 */ |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
219 |
treetype, /* map3lo */ |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
220 |
_game_mode == GM_EDITOR ? 3 : 0 /* map5 */ |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
221 |
); |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
222 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
223 |
if (_game_mode == GM_EDITOR && IS_BYTE_INSIDE(treetype, 0x14, 0x1B)) |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
224 |
SetMapExtraBits(tile, 2); |
0 | 225 |
} |
1286
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
226 |
cost += _price.build_trees; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
227 |
break; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
228 |
|
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
229 |
default: |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
230 |
_error_message = STR_2804_SITE_UNSUITABLE; |
da05e4dc75b5
(svn r1790) Make CmdPlantTree() and related functions more safe and (hopefully) more readable:
tron
parents:
1209
diff
changeset
|
231 |
break; |
0 | 232 |
} |
233 |
} |
|
234 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
235 |
|
1784
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1370
diff
changeset
|
236 |
return (cost == 0) ? CMD_ERROR : cost; |
0 | 237 |
} |
238 |
||
239 |
typedef struct TreeListEnt { |
|
240 |
uint32 image; |
|
241 |
byte x,y; |
|
242 |
} TreeListEnt; |
|
243 |
||
244 |
static void DrawTile_Trees(TileInfo *ti) |
|
245 |
{ |
|
817
4f9377b7fd2b
(svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents:
679
diff
changeset
|
246 |
uint16 m2; |
0 | 247 |
const uint32 *s; |
2654
df351c3ddd59
(svn r3196) Use structs instead of magic offsets into arrays
tron
parents:
2644
diff
changeset
|
248 |
const TreePos* d; |
0 | 249 |
byte z; |
250 |
||
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
251 |
m2 = _m[ti->tile].m2; |
0 | 252 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
253 |
if ((m2 & 0x30) == 0) { |
0 | 254 |
DrawClearLandTile(ti, 3); |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
255 |
} else if ((m2 & 0x30) == 0x20) { |
0 | 256 |
DrawGroundSprite(_tree_sprites_1[m2 >> 6] + _tileh_to_sprite[ti->tileh]); |
257 |
} else { |
|
258 |
DrawHillyLandTile(ti); |
|
259 |
} |
|
260 |
||
2220 | 261 |
DrawClearLandFence(ti); |
0 | 262 |
|
263 |
z = ti->z; |
|
264 |
if (ti->tileh != 0) { |
|
265 |
z += 4; |
|
2085
ae9e92ffe168
(svn r2595) -Codechange: Introduced "IsSteepTileh" to find whether a tile is steep
celestar
parents:
2051
diff
changeset
|
266 |
if (IsSteepTileh(ti->tileh)) |
0 | 267 |
z += 4; |
268 |
} |
|
269 |
||
270 |
{ |
|
271 |
uint16 tmp = ti->x; |
|
959
b031d88c76f3
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
926
diff
changeset
|
272 |
uint index; |
0 | 273 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
274 |
tmp = ROR(tmp, 2); |
0 | 275 |
tmp -= ti->y; |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
276 |
tmp = ROR(tmp, 3); |
0 | 277 |
tmp -= ti->x; |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
278 |
tmp = ROR(tmp, 1); |
0 | 279 |
tmp += ti->y; |
280 |
||
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
281 |
d = _tree_layout_xy[GB(tmp, 4, 2)]; |
0 | 282 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
283 |
index = GB(tmp, 6, 2) + (_m[ti->tile].m3 << 2); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
284 |
|
0 | 285 |
/* different tree styles above one of the grounds */ |
286 |
if ((m2 & 0xB0) == 0xA0 && index >= 48 && index < 80) |
|
287 |
index += 164 - 48; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
288 |
|
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
289 |
assert(index < lengthof(_tree_layout_sprite)); |
0 | 290 |
s = _tree_layout_sprite[index]; |
291 |
} |
|
292 |
||
293 |
StartSpriteCombine(); |
|
294 |
||
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
295 |
if (!(_display_opt & DO_TRANS_BUILDINGS) || !_patches.invisible_trees) { |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
296 |
TreeListEnt te[4]; |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
297 |
uint i; |
0 | 298 |
|
299 |
/* put the trees to draw in a list */ |
|
300 |
i = (ti->map5 >> 6) + 1; |
|
301 |
do { |
|
2243 | 302 |
uint32 image = s[0] + (--i == 0 ? GB(ti->map5, 0, 3) : 3); |
2639 | 303 |
if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); |
0 | 304 |
te[i].image = image; |
2654
df351c3ddd59
(svn r3196) Use structs instead of magic offsets into arrays
tron
parents:
2644
diff
changeset
|
305 |
te[i].x = d->x; |
df351c3ddd59
(svn r3196) Use structs instead of magic offsets into arrays
tron
parents:
2644
diff
changeset
|
306 |
te[i].y = d->y; |
0 | 307 |
s++; |
2654
df351c3ddd59
(svn r3196) Use structs instead of magic offsets into arrays
tron
parents:
2644
diff
changeset
|
308 |
d++; |
0 | 309 |
} while (i); |
310 |
||
311 |
/* draw them in a sorted way */ |
|
2952 | 312 |
for (;;) { |
0 | 313 |
byte min = 0xFF; |
314 |
TreeListEnt *tep = NULL; |
|
315 |
||
316 |
i = (ti->map5 >> 6) + 1; |
|
317 |
do { |
|
2644 | 318 |
if (te[--i].image != 0 && te[i].x + te[i].y < min) { |
0 | 319 |
min = te[i].x + te[i].y; |
320 |
tep = &te[i]; |
|
321 |
} |
|
322 |
} while (i); |
|
323 |
||
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
324 |
if (tep == NULL) break; |
0 | 325 |
|
326 |
AddSortableSpriteToDraw(tep->image, ti->x + tep->x, ti->y + tep->y, 5, 5, 0x10, z); |
|
327 |
tep->image = 0; |
|
328 |
} |
|
329 |
} |
|
330 |
||
331 |
EndSpriteCombine(); |
|
332 |
} |
|
333 |
||
334 |
||
2537 | 335 |
static uint GetSlopeZ_Trees(const TileInfo* ti) |
336 |
{ |
|
2243 | 337 |
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; |
0 | 338 |
} |
339 |
||
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2537
diff
changeset
|
340 |
static uint GetSlopeTileh_Trees(const TileInfo* ti) |
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2537
diff
changeset
|
341 |
{ |
39 | 342 |
return ti->tileh; |
343 |
} |
|
344 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
345 |
static int32 ClearTile_Trees(TileIndex tile, byte flags) |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
346 |
{ |
2243 | 347 |
uint num; |
0 | 348 |
|
349 |
if (flags & DC_EXEC && _current_player < MAX_PLAYERS) { |
|
350 |
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
351 |
if (t != NULL) |
1005 | 352 |
ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM); |
0 | 353 |
} |
354 |
||
2243 | 355 |
num = GB(_m[tile].m5, 6, 2) + 1; |
356 |
if (IS_INT_INSIDE(_m[tile].m3, 20, 26 + 1)) num *= 4; |
|
0 | 357 |
|
2243 | 358 |
if (flags & DC_EXEC) DoClearSquare(tile); |
0 | 359 |
|
360 |
return num * _price.remove_trees; |
|
361 |
} |
|
362 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
363 |
static void GetAcceptedCargo_Trees(TileIndex tile, AcceptedCargo ac) |
0 | 364 |
{ |
365 |
/* not used */ |
|
366 |
} |
|
367 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
368 |
static void GetTileDesc_Trees(TileIndex tile, TileDesc *td) |
0 | 369 |
{ |
370 |
byte b; |
|
371 |
StringID str; |
|
372 |
||
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
373 |
td->owner = GetTileOwner(tile); |
0 | 374 |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
375 |
b = _m[tile].m3; |
0 | 376 |
(str=STR_2810_CACTUS_PLANTS, b==0x1B) || |
377 |
(str=STR_280F_RAINFOREST, IS_BYTE_INSIDE(b, 0x14, 0x1A+1)) || |
|
378 |
(str=STR_280E_TREES, true); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
379 |
td->str = str; |
0 | 380 |
} |
381 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
382 |
static void AnimateTile_Trees(TileIndex tile) |
0 | 383 |
{ |
384 |
/* not used */ |
|
385 |
} |
|
386 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
387 |
static void TileLoopTreesDesert(TileIndex tile) |
0 | 388 |
{ |
2243 | 389 |
static const SoundFx forest_sounds[] = { |
390 |
SND_42_LOON_BIRD, |
|
391 |
SND_43_LION, |
|
392 |
SND_44_MONKEYS, |
|
393 |
SND_48_DISTANT_BIRD |
|
394 |
}; |
|
0 | 395 |
|
2243 | 396 |
byte b = GetMapExtraBits(tile); |
397 |
||
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
398 |
if (b == 2) { |
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
399 |
uint32 r = Random(); |
0 | 400 |
|
2243 | 401 |
if (CHANCE16I(1, 200, r)) SndPlayTileFx(forest_sounds[GB(r, 16, 2)], tile); |
0 | 402 |
} else if (b == 1) { |
2243 | 403 |
if (GB(_m[tile].m2, 4, 2) != 2) { |
404 |
SB(_m[tile].m2, 4, 2, 2); |
|
405 |
SB(_m[tile].m2, 6, 2, 3); |
|
0 | 406 |
MarkTileDirtyByTile(tile); |
407 |
} |
|
408 |
} |
|
409 |
} |
|
410 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
411 |
static void TileLoopTreesAlps(TileIndex tile) |
0 | 412 |
{ |
413 |
byte tmp, m2; |
|
414 |
int k; |
|
415 |
||
416 |
/* distance from snow line, in steps of 8 */ |
|
417 |
k = GetTileZ(tile) - _opt.snow_line; |
|
418 |
||
2230
fc2cbf1b5b41
(svn r2750) -Fix: Tree tiles above the snow line got redrawn disproportionately often
tron
parents:
2220
diff
changeset
|
419 |
tmp = _m[tile].m2 & 0xF0; |
0 | 420 |
|
421 |
if (k < -8) { |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
422 |
if ((tmp & 0x30) != 0x20) return; |
2243 | 423 |
m2 = 0; // no snow |
0 | 424 |
} else if (k == -8) { |
2243 | 425 |
m2 = 0x20; // 1/4 snow |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
426 |
if (tmp == m2) return; |
2243 | 427 |
} else if (k == 0) { |
428 |
m2 = 0x60;// 1/2 snow |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
429 |
if (tmp == m2) return; |
0 | 430 |
} else if (k == 8) { |
2243 | 431 |
m2 = 0xA0; // 3/4 snow |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
432 |
if (tmp == m2) return; |
0 | 433 |
} else { |
2230
fc2cbf1b5b41
(svn r2750) -Fix: Tree tiles above the snow line got redrawn disproportionately often
tron
parents:
2220
diff
changeset
|
434 |
if (tmp == 0xE0) { |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
435 |
uint32 r = Random(); |
2243 | 436 |
if (CHANCE16I(1, 200, r)) { |
541 | 437 |
SndPlayTileFx((r & 0x80000000) ? SND_39_HEAVY_WIND : SND_34_WIND, tile); |
0 | 438 |
} |
439 |
return; |
|
440 |
} else { |
|
2243 | 441 |
m2 = 0xE0; // full snow |
0 | 442 |
} |
443 |
} |
|
444 |
||
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
445 |
_m[tile].m2 &= 0xF; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
446 |
_m[tile].m2 |= m2; |
0 | 447 |
MarkTileDirtyByTile(tile); |
448 |
} |
|
449 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
450 |
static void TileLoop_Trees(TileIndex tile) |
0 | 451 |
{ |
817
4f9377b7fd2b
(svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents:
679
diff
changeset
|
452 |
byte m5; |
0 | 453 |
|
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
454 |
static const TileIndexDiffC _tileloop_trees_dir[] = { |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
455 |
{-1, -1}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
456 |
{ 0, -1}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
457 |
{ 1, -1}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
458 |
{-1, 0}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
459 |
{ 1, 0}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
460 |
{-1, 1}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
461 |
{ 0, 1}, |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
462 |
{ 1, 1} |
0 | 463 |
}; |
464 |
||
465 |
if (_opt.landscape == LT_DESERT) { |
|
466 |
TileLoopTreesDesert(tile); |
|
467 |
} else if (_opt.landscape == LT_HILLY) { |
|
468 |
TileLoopTreesAlps(tile); |
|
469 |
} |
|
470 |
||
471 |
TileLoopClearHelper(tile); |
|
472 |
||
473 |
/* increase counter */ |
|
2238
14ec09c1a272
(svn r2758) Add the AB() macro to add a value to a bit range and use it in a few places, also make use of GB and SB nearby
tron
parents:
2230
diff
changeset
|
474 |
AB(_m[tile].m2, 0, 4, 1); |
14ec09c1a272
(svn r2758) Add the AB() macro to add a value to a bit range and use it in a few places, also make use of GB and SB nearby
tron
parents:
2230
diff
changeset
|
475 |
if (GB(_m[tile].m2, 0, 4) != 0) return; |
0 | 476 |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
477 |
m5 = _m[tile].m5; |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
478 |
if (GB(m5, 0, 3) == 3) { |
0 | 479 |
/* regular sized tree */ |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
480 |
if (_opt.landscape == LT_DESERT && _m[tile].m3 != 0x1B && GetMapExtraBits(tile) == 1) { |
0 | 481 |
m5++; /* start destructing */ |
482 |
} else { |
|
2635 | 483 |
switch (GB(Random(), 0, 3)) { |
0 | 484 |
case 0: /* start destructing */ |
485 |
m5++; |
|
486 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
487 |
|
0 | 488 |
case 1: /* add a tree */ |
489 |
if (m5 < 0xC0) { |
|
490 |
m5 = (m5 + 0x40) & ~7; |
|
491 |
break; |
|
492 |
} |
|
493 |
/* fall through */ |
|
494 |
||
495 |
case 2: { /* add a neighbouring tree */ |
|
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
881
diff
changeset
|
496 |
tile += ToTileIndexDiff(_tileloop_trees_dir[Random() & 7]); |
0 | 497 |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
498 |
if (!IsTileType(tile, MP_CLEAR)) return; |
0 | 499 |
|
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
500 |
switch (GetClearGround(tile)) { |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
501 |
case CL_GRASS: |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
502 |
if (GetClearDensity(tile) != 3) return; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
503 |
_m[tile].m2 = 0; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
504 |
break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
505 |
|
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
506 |
case CL_ROUGH: _m[tile].m2 = 0x10; break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
507 |
case CL_SNOW: _m[tile].m2 = GetClearDensity(tile) << 6 | 0x20; break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
508 |
default: return; |
0 | 509 |
} |
510 |
||
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
511 |
_m[tile].m4 = 0; |
1059
c28c6be74291
(svn r1560) Introduce SetTileType() and SetTileHeight()
tron
parents:
1035
diff
changeset
|
512 |
SetTileType(tile, MP_TREES); |
0 | 513 |
|
514 |
m5 = 0; |
|
515 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
516 |
} |
0 | 517 |
|
518 |
default: |
|
519 |
return; |
|
520 |
} |
|
521 |
} |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
522 |
} else if (GB(m5, 0, 3) == 6) { |
0 | 523 |
/* final stage of tree destruction */ |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
524 |
if (GB(m5, 6, 2) != 0) { |
0 | 525 |
/* more than one tree, delete it? */ |
526 |
m5 = ((m5 - 6) - 0x40) + 3; |
|
527 |
} else { |
|
528 |
/* just one tree, change type into MP_CLEAR */ |
|
1059
c28c6be74291
(svn r1560) Introduce SetTileType() and SetTileHeight()
tron
parents:
1035
diff
changeset
|
529 |
SetTileType(tile, MP_CLEAR); |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
530 |
SetTileOwner(tile, OWNER_NONE); |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
531 |
switch (_m[tile].m2 & 0x30) { |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
532 |
case 0x00: SetClearGroundDensity(tile, CL_GRASS, 3); break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
533 |
case 0x10: SetClearGroundDensity(tile, CL_ROUGH, 3); break; |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
534 |
default: SetClearGroundDensity(tile, CL_SNOW, GB(_m[tile].m2, 6, 2)); break; |
0 | 535 |
} |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
536 |
MarkTileDirtyByTile(tile); |
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
537 |
return; |
0 | 538 |
} |
539 |
} else { |
|
540 |
/* in the middle of a transition, change to next */ |
|
541 |
m5++; |
|
542 |
} |
|
543 |
||
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
544 |
_m[tile].m5 = m5; |
0 | 545 |
MarkTileDirtyByTile(tile); |
546 |
} |
|
547 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
548 |
void OnTick_Trees(void) |
0 | 549 |
{ |
550 |
uint32 r; |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
551 |
TileIndex tile; |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
552 |
ClearGround ct; |
0 | 553 |
int tree; |
554 |
||
555 |
/* place a tree at a random rainforest spot */ |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
556 |
if (_opt.landscape == LT_DESERT && |
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
557 |
(r = Random(), tile = RandomTileSeed(r), GetMapExtraBits(tile) == 2) && |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
1005
diff
changeset
|
558 |
IsTileType(tile, MP_CLEAR) && |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
559 |
(ct = GetClearGround(tile), ct == CL_GRASS || ct == CL_ROUGH) && |
2635 | 560 |
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) >= 0) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
561 |
|
0 | 562 |
ModifyTile(tile, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
563 |
MP_SETTYPE(MP_TREES) | |
0 | 564 |
MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5, |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
565 |
(ct == CL_ROUGH ? 0x10 : 0), |
0 | 566 |
tree, |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
567 |
_m[tile].m4 & ~3, |
0 | 568 |
0 |
569 |
); |
|
570 |
} |
|
571 |
||
572 |
// byte underflow |
|
2088
f290b54c97cb
(svn r2598) Small cleanup, especially get rid of a FindLandscapeHeight(), because it was overkill
tron
parents:
2085
diff
changeset
|
573 |
if (--_trees_tick_ctr != 0) return; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
574 |
|
0 | 575 |
/* place a tree at a random spot */ |
576 |
r = Random(); |
|
577 |
tile = TILE_MASK(r); |
|
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
1005
diff
changeset
|
578 |
if (IsTileType(tile, MP_CLEAR) && |
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
579 |
(ct = GetClearGround(tile), ct == CL_GRASS || ct == CL_ROUGH || ct == CL_SNOW) && |
2635 | 580 |
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) >= 0) { |
0 | 581 |
int m2; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
582 |
|
2955
27221592ebbc
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
583 |
switch (ct) { |
2957 | 584 |
case CL_GRASS: m2 = 0; break; |
585 |
case CL_ROUGH: m2 = 0x10; break; |
|
586 |
default: m2 = (GetClearDensity(tile) << 6) | 0x20; break; |
|
0 | 587 |
} |
588 |
||
589 |
ModifyTile(tile, |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
160
diff
changeset
|
590 |
MP_SETTYPE(MP_TREES) | |
0 | 591 |
MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5, |
592 |
m2, |
|
593 |
tree, |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
594 |
_m[tile].m4 & ~3, |
0 | 595 |
0 |
596 |
); |
|
597 |
} |
|
598 |
} |
|
599 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
600 |
static void ClickTile_Trees(TileIndex tile) |
0 | 601 |
{ |
602 |
/* not used */ |
|
603 |
} |
|
604 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1902
diff
changeset
|
605 |
static uint32 GetTileTrackStatus_Trees(TileIndex tile, TransportType mode) |
0 | 606 |
{ |
607 |
return 0; |
|
608 |
} |
|
609 |
||
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2243
diff
changeset
|
610 |
static void ChangeTileOwner_Trees(TileIndex tile, PlayerID old_player, PlayerID new_player) |
0 | 611 |
{ |
612 |
/* not used */ |
|
613 |
} |
|
614 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
615 |
void InitializeTrees(void) |
0 | 616 |
{ |
617 |
_trees_tick_ctr = 0; |
|
618 |
} |
|
619 |
||
620 |
||
621 |
const TileTypeProcs _tile_type_trees_procs = { |
|
622 |
DrawTile_Trees, /* draw_tile_proc */ |
|
623 |
GetSlopeZ_Trees, /* get_slope_z_proc */ |
|
624 |
ClearTile_Trees, /* clear_tile_proc */ |
|
625 |
GetAcceptedCargo_Trees, /* get_accepted_cargo_proc */ |
|
626 |
GetTileDesc_Trees, /* get_tile_desc_proc */ |
|
627 |
GetTileTrackStatus_Trees, /* get_tile_track_status_proc */ |
|
628 |
ClickTile_Trees, /* click_tile_proc */ |
|
629 |
AnimateTile_Trees, /* animate_tile_proc */ |
|
630 |
TileLoop_Trees, /* tile_loop_clear */ |
|
631 |
ChangeTileOwner_Trees, /* change_tile_owner_clear */ |
|
632 |
NULL, /* get_produced_cargo_proc */ |
|
633 |
NULL, /* vehicle_enter_tile_proc */ |
|
634 |
NULL, /* vehicle_leave_tile_proc */ |
|
39 | 635 |
GetSlopeTileh_Trees, /* get_slope_tileh_proc */ |
0 | 636 |
}; |