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