author | rubidium |
Thu, 01 Feb 2007 15:49:12 +0000 | |
changeset 5893 | 7e431a4abebb |
parent 5668 | 36b39f4a9032 |
child 6106 | 2898cd9417fd |
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:
1878
diff
changeset
|
4 |
#include "openttd.h" |
3144
33e42feae531
(svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents:
2989
diff
changeset
|
5 |
#include "clear_map.h" |
4041
72276cd8ee2b
(svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents:
4031
diff
changeset
|
6 |
#include "rail_map.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
473
diff
changeset
|
7 |
#include "table/strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2154
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:
507
diff
changeset
|
9 |
#include "map.h" |
2154
f86c59e73a16
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2153
diff
changeset
|
10 |
#include "player.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
|
11 |
#include "tile.h" |
0 | 12 |
#include "viewport.h" |
13 |
#include "command.h" |
|
3156
f4caf4197189
(svn r3779) Move CheckTunnelInWay() to a more appropriate place, invert its result and give it a less ambiguous name (IsTunnelInWay)
tron
parents:
3144
diff
changeset
|
14 |
#include "tunnel_map.h" |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
15 |
#include "bridge_map.h" |
2153
ecfc674410b4
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2150
diff
changeset
|
16 |
#include "variables.h" |
2517
6e3832ddd0f6
(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list
tron
parents:
2436
diff
changeset
|
17 |
#include "table/sprites.h" |
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3279
diff
changeset
|
18 |
#include "unmovable_map.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
19 |
#include "genworld.h" |
4328
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
20 |
#include "industry.h" |
0 | 21 |
|
22 |
typedef struct TerraformerHeightMod { |
|
23 |
TileIndex tile; |
|
24 |
byte height; |
|
25 |
} TerraformerHeightMod; |
|
26 |
||
27 |
typedef struct TerraformerState { |
|
28 |
int height[4]; |
|
29 |
uint32 flags; |
|
30 |
||
31 |
int direction; |
|
32 |
int modheight_count; |
|
33 |
int tile_table_count; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
34 |
|
0 | 35 |
int32 cost; |
36 |
||
37 |
TileIndex *tile_table; |
|
38 |
TerraformerHeightMod *modheight; |
|
39 |
||
40 |
} TerraformerState; |
|
41 |
||
42 |
static int TerraformAllowTileProcess(TerraformerState *ts, TileIndex tile) |
|
43 |
{ |
|
44 |
TileIndex *t; |
|
45 |
int count; |
|
46 |
||
2639 | 47 |
if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return -1; |
0 | 48 |
|
49 |
t = ts->tile_table; |
|
2639 | 50 |
for (count = ts->tile_table_count; count != 0; count--, t++) { |
51 |
if (*t == tile) return 0; |
|
0 | 52 |
} |
53 |
||
54 |
return 1; |
|
55 |
} |
|
56 |
||
57 |
static int TerraformGetHeightOfTile(TerraformerState *ts, TileIndex tile) |
|
58 |
{ |
|
59 |
TerraformerHeightMod *mod = ts->modheight; |
|
60 |
int count; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
61 |
|
2639 | 62 |
for (count = ts->modheight_count; count != 0; count--, mod++) { |
63 |
if (mod->tile == tile) return mod->height; |
|
0 | 64 |
} |
65 |
||
1044
63e0601a43cc
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
66 |
return TileHeight(tile); |
0 | 67 |
} |
68 |
||
69 |
static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile) |
|
70 |
{ |
|
71 |
int count; |
|
72 |
TileIndex *t; |
|
73 |
||
74 |
count = ts->tile_table_count; |
|
75 |
||
2639 | 76 |
if (count >= 625) return; |
0 | 77 |
|
2952 | 78 |
for (t = ts->tile_table; count != 0; count--,t++) { |
2639 | 79 |
if (*t == tile) return; |
0 | 80 |
} |
81 |
||
82 |
ts->tile_table[ts->tile_table_count++] = tile; |
|
83 |
} |
|
84 |
||
85 |
static void TerraformAddDirtyTileAround(TerraformerState *ts, TileIndex tile) |
|
86 |
{ |
|
1981 | 87 |
TerraformAddDirtyTile(ts, tile + TileDiffXY( 0, -1)); |
88 |
TerraformAddDirtyTile(ts, tile + TileDiffXY(-1, -1)); |
|
89 |
TerraformAddDirtyTile(ts, tile + TileDiffXY(-1, 0)); |
|
0 | 90 |
TerraformAddDirtyTile(ts, tile); |
91 |
} |
|
92 |
||
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
93 |
static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode) |
0 | 94 |
{ |
95 |
int r; |
|
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
96 |
int32 ret; |
0 | 97 |
|
863
6a1444534f62
(svn r1344) Use MapSize[XY]() (or MapSize()/MapMax[XY]() where appropriate) instead of TILES_[XY]
tron
parents:
856
diff
changeset
|
98 |
assert(tile < MapSize()); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
99 |
|
4068 | 100 |
r = TerraformAllowTileProcess(ts, tile); |
101 |
if (r <= 0) return r; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
102 |
|
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
103 |
if (IsTileType(tile, MP_RAILWAY)) { |
4068 | 104 |
static const TrackBits safe_track[] = { TRACK_BIT_LOWER, TRACK_BIT_LEFT, TRACK_BIT_UPPER, TRACK_BIT_RIGHT }; |
105 |
static const Slope unsafe_slope[] = { SLOPE_S, SLOPE_W, SLOPE_N, SLOPE_E }; |
|
0 | 106 |
|
4069
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
107 |
Slope tileh; |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
108 |
uint z; |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
109 |
|
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
110 |
// Nothing could be built at the steep slope - this avoids a bug |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
111 |
// when you have a single diagonal track in one corner on a |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
112 |
// basement and then you raise/lower the other corner. |
4069
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
113 |
tileh = GetTileSlope(tile, &z); |
4068 | 114 |
if (tileh == unsafe_slope[mode] || |
115 |
tileh == ComplementSlope(unsafe_slope[mode])) { |
|
2686
609f3b4d2fd4
(svn r3228) - Fix: [ 1327011 ] Fix: don't lower land on tunnel, even with diag tracks on it (based on patch by glx)
peter1138
parents:
2639
diff
changeset
|
116 |
_terraform_err_tile = tile; |
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
117 |
_error_message = STR_1008_MUST_REMOVE_RAILROAD_TRACK; |
2686
609f3b4d2fd4
(svn r3228) - Fix: [ 1327011 ] Fix: don't lower land on tunnel, even with diag tracks on it (based on patch by glx)
peter1138
parents:
2639
diff
changeset
|
118 |
return -1; |
609f3b4d2fd4
(svn r3228) - Fix: [ 1327011 ] Fix: don't lower land on tunnel, even with diag tracks on it (based on patch by glx)
peter1138
parents:
2639
diff
changeset
|
119 |
} |
609f3b4d2fd4
(svn r3228) - Fix: [ 1327011 ] Fix: don't lower land on tunnel, even with diag tracks on it (based on patch by glx)
peter1138
parents:
2639
diff
changeset
|
120 |
|
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
121 |
// If we have a single diagonal track there, the other side of |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
122 |
// tile can be terraformed. |
4068 | 123 |
if (IsPlainRailTile(tile) && GetTrackBits(tile) == safe_track[mode]) { |
4069
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
124 |
/* If terraforming downwards prevent damaging a potential tunnel below. |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
125 |
* This check is only necessary for flat tiles, because if the tile is |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
126 |
* non-flat, then the corner opposing the rail is raised. Only this corner |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
127 |
* can be lowered and this is a safe action |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
128 |
*/ |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
129 |
if (tileh == SLOPE_FLAT && |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
130 |
ts->direction == -1 && |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
131 |
IsTunnelInWay(tile, z - TILE_HEIGHT)) { |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
132 |
_terraform_err_tile = tile; |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
133 |
_error_message = STR_1002_EXCAVATION_WOULD_DAMAGE; |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
134 |
return -1; |
d713eee28ef1
(svn r5365) -Fix: It was possible to dig into a tunnel if certain rail combinations were ontop of it
tron
parents:
4068
diff
changeset
|
135 |
} |
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
136 |
return 0; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
137 |
} |
0 | 138 |
} |
139 |
||
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
140 |
ret = DoCommand(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR); |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
141 |
|
4560
434cb4b568d4
(svn r6407) -Fix: Check return values of DoCommand() with CmdFailed and that of DoCommandP
Darkvater
parents:
4559
diff
changeset
|
142 |
if (CmdFailed(ret)) { |
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
143 |
_terraform_err_tile = tile; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
144 |
return -1; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
145 |
} |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
146 |
|
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
147 |
ts->cost += ret; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
148 |
|
2639 | 149 |
if (ts->tile_table_count >= 625) return -1; |
0 | 150 |
ts->tile_table[ts->tile_table_count++] = tile; |
151 |
||
152 |
return 0; |
|
153 |
} |
|
154 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
155 |
static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height) |
0 | 156 |
{ |
157 |
int nh; |
|
158 |
TerraformerHeightMod *mod; |
|
159 |
int count; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
160 |
|
863
6a1444534f62
(svn r1344) Use MapSize[XY]() (or MapSize()/MapMax[XY]() where appropriate) instead of TILES_[XY]
tron
parents:
856
diff
changeset
|
161 |
assert(tile < MapSize()); |
0 | 162 |
|
163 |
if (height < 0) { |
|
164 |
_error_message = STR_1003_ALREADY_AT_SEA_LEVEL; |
|
165 |
return false; |
|
166 |
} |
|
167 |
||
168 |
_error_message = STR_1004_TOO_HIGH; |
|
169 |
||
2639 | 170 |
if (height > 15) return false; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
171 |
|
0 | 172 |
nh = TerraformGetHeightOfTile(ts, tile); |
2639 | 173 |
if (nh < 0 || height == nh) return false; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
174 |
|
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
175 |
if (TerraformProc(ts, tile, 0) < 0) return false; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
176 |
if (TerraformProc(ts, tile + TileDiffXY( 0, -1), 1) < 0) return false; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
177 |
if (TerraformProc(ts, tile + TileDiffXY(-1, -1), 2) < 0) return false; |
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
178 |
if (TerraformProc(ts, tile + TileDiffXY(-1, 0), 3) < 0) return false; |
0 | 179 |
|
180 |
mod = ts->modheight; |
|
181 |
count = ts->modheight_count; |
|
182 |
||
2639 | 183 |
for (;;) { |
0 | 184 |
if (count == 0) { |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
185 |
if (ts->modheight_count >= 576) return false; |
0 | 186 |
ts->modheight_count++; |
187 |
break; |
|
188 |
} |
|
1986
fcc849a38ae6
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1981
diff
changeset
|
189 |
if (mod->tile == tile) break; |
0 | 190 |
mod++; |
191 |
count--; |
|
192 |
} |
|
193 |
||
1986
fcc849a38ae6
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1981
diff
changeset
|
194 |
mod->tile = tile; |
0 | 195 |
mod->height = (byte)height; |
196 |
||
197 |
ts->cost += _price.terraform; |
|
198 |
||
199 |
{ |
|
200 |
int direction = ts->direction, r; |
|
909
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
201 |
const TileIndexDiffC *ttm; |
0 | 202 |
|
909
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
203 |
static const TileIndexDiffC _terraform_tilepos[] = { |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
204 |
{ 1, 0}, |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
205 |
{-2, 0}, |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
206 |
{ 1, 1}, |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
207 |
{ 0, -2} |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
208 |
}; |
0 | 209 |
|
2952 | 210 |
for (ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) { |
909
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
211 |
tile += ToTileIndexDiff(*ttm); |
0 | 212 |
|
213 |
r = TerraformGetHeightOfTile(ts, tile); |
|
214 |
if (r != height && r-direction != height && r+direction != height) { |
|
215 |
if (!TerraformTileHeight(ts, tile, r+direction)) |
|
216 |
return false; |
|
217 |
} |
|
218 |
} |
|
219 |
} |
|
220 |
||
221 |
return true; |
|
222 |
} |
|
223 |
||
1775
548dc04d50e2
(svn r2279) - Fix: Check the parameters of the first 10 Commands. While there also add proper comments for the functions and fix up CmdFailed()
Darkvater
parents:
1571
diff
changeset
|
224 |
/** Terraform land |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
225 |
* @param tile tile to terraform |
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
226 |
* @param p1 corners to terraform. |
1775
548dc04d50e2
(svn r2279) - Fix: Check the parameters of the first 10 Commands. While there also add proper comments for the functions and fix up CmdFailed()
Darkvater
parents:
1571
diff
changeset
|
227 |
* @param p2 direction; eg up or down |
0 | 228 |
*/ |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
229 |
int32 CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
0 | 230 |
{ |
231 |
TerraformerState ts; |
|
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
232 |
TileIndex t; |
0 | 233 |
int direction; |
234 |
||
235 |
TerraformerHeightMod modheight_data[576]; |
|
236 |
TileIndex tile_table_data[625]; |
|
237 |
||
238 |
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
|
239 |
||
240 |
_terraform_err_tile = 0; |
|
241 |
||
242 |
ts.direction = direction = p2 ? 1 : -1; |
|
243 |
ts.flags = flags; |
|
244 |
ts.modheight_count = ts.tile_table_count = 0; |
|
245 |
ts.cost = 0; |
|
246 |
ts.modheight = modheight_data; |
|
247 |
ts.tile_table = tile_table_data; |
|
248 |
||
1878
980fabc7d8a5
(svn r2384) - Fix: Check selling land and setting player colour. Also an extra map-bounds check for terraforming; inspired by the monkey (and Tron :) )
Darkvater
parents:
1796
diff
changeset
|
249 |
/* Make an extra check for map-bounds cause we add tiles to the originating tile */ |
2934
3f29a7212713
(svn r3490) -Fix: A bunch (10) of off-by-one errors when checking if a TileIndex points to a tile on the map
tron
parents:
2705
diff
changeset
|
250 |
if (tile + TileDiffXY(1, 1) >= MapSize()) return CMD_ERROR; |
1878
980fabc7d8a5
(svn r2384) - Fix: Check selling land and setting player colour. Also an extra map-bounds check for terraforming; inspired by the monkey (and Tron :) )
Darkvater
parents:
1796
diff
changeset
|
251 |
|
0 | 252 |
if (p1 & 1) { |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
253 |
t = tile + TileDiffXY(1, 0); |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
254 |
if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
255 |
return CMD_ERROR; |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
256 |
} |
0 | 257 |
} |
258 |
||
259 |
if (p1 & 2) { |
|
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
260 |
t = tile + TileDiffXY(1, 1); |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
261 |
if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
262 |
return CMD_ERROR; |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
263 |
} |
0 | 264 |
} |
265 |
||
266 |
if (p1 & 4) { |
|
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
267 |
t = tile + TileDiffXY(0, 1); |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
268 |
if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
269 |
return CMD_ERROR; |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
270 |
} |
0 | 271 |
} |
272 |
||
273 |
if (p1 & 8) { |
|
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
274 |
t = tile + TileDiffXY(0, 0); |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
275 |
if (!TerraformTileHeight(&ts, t, TileHeight(t) + direction)) { |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
276 |
return CMD_ERROR; |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
277 |
} |
0 | 278 |
} |
279 |
||
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
280 |
{ |
4067
5ef297943eff
(svn r5363) Revert 5312, 5288, 5248, 3992, 3249, 3228
tron
parents:
4043
diff
changeset
|
281 |
/* Check if tunnel would take damage */ |
0 | 282 |
int count; |
283 |
TileIndex *ti = ts.tile_table; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
284 |
|
1775
548dc04d50e2
(svn r2279) - Fix: Check the parameters of the first 10 Commands. While there also add proper comments for the functions and fix up CmdFailed()
Darkvater
parents:
1571
diff
changeset
|
285 |
for (count = ts.tile_table_count; count != 0; count--, ti++) { |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
286 |
TileIndex tile = *ti; |
0 | 287 |
|
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
288 |
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) { |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
289 |
return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
290 |
} |
3279
3f3b6ce1f427
(svn r3992) -Fix: Rewrote the code to determine whether a rail-tile can be terraformed.
celestar
parents:
3267
diff
changeset
|
291 |
|
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
292 |
if (direction == -1) { |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
293 |
uint z, t; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
294 |
|
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
295 |
z = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 0)); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
296 |
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 0)); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
297 |
if (t <= z) z = t; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
298 |
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 1)); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
299 |
if (t <= z) z = t; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
300 |
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 1)); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
301 |
if (t <= z) z = t; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
302 |
|
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
303 |
if (IsTunnelInWay(tile, z * TILE_HEIGHT)) { |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
304 |
return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE); |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
305 |
} |
2639 | 306 |
} |
0 | 307 |
} |
308 |
} |
|
309 |
||
310 |
if (flags & DC_EXEC) { |
|
311 |
/* Clear the landscape at the tiles */ |
|
312 |
{ |
|
313 |
int count; |
|
314 |
TileIndex *ti = ts.tile_table; |
|
1775
548dc04d50e2
(svn r2279) - Fix: Check the parameters of the first 10 Commands. While there also add proper comments for the functions and fix up CmdFailed()
Darkvater
parents:
1571
diff
changeset
|
315 |
for (count = ts.tile_table_count; count != 0; count--, ti++) { |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
316 |
DoCommand(*ti, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
0 | 317 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
318 |
} |
0 | 319 |
|
320 |
/* change the height */ |
|
321 |
{ |
|
322 |
int count; |
|
323 |
TerraformerHeightMod *mod; |
|
324 |
||
325 |
mod = ts.modheight; |
|
1775
548dc04d50e2
(svn r2279) - Fix: Check the parameters of the first 10 Commands. While there also add proper comments for the functions and fix up CmdFailed()
Darkvater
parents:
1571
diff
changeset
|
326 |
for (count = ts.modheight_count; count != 0; count--, mod++) { |
1979
82d8bcc16ce2
(svn r2485) Missed two uint -> TileIndex, thanks _Luca_
tron
parents:
1977
diff
changeset
|
327 |
TileIndex til = mod->tile; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
328 |
|
1059
fe97d81a1b4f
(svn r1560) Introduce SetTileType() and SetTileHeight()
tron
parents:
1044
diff
changeset
|
329 |
SetTileHeight(til, mod->height); |
0 | 330 |
TerraformAddDirtyTileAround(&ts, til); |
331 |
} |
|
332 |
} |
|
333 |
||
334 |
/* finally mark the dirty tiles dirty */ |
|
335 |
{ |
|
336 |
int count; |
|
337 |
TileIndex *ti = ts.tile_table; |
|
1775
548dc04d50e2
(svn r2279) - Fix: Check the parameters of the first 10 Commands. While there also add proper comments for the functions and fix up CmdFailed()
Darkvater
parents:
1571
diff
changeset
|
338 |
for (count = ts.tile_table_count; count != 0; count--, ti++) { |
0 | 339 |
MarkTileDirtyByTile(*ti); |
340 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
341 |
} |
0 | 342 |
} |
343 |
return ts.cost; |
|
344 |
} |
|
345 |
||
346 |
||
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
347 |
/** Levels a selected (rectangle) area of land |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
348 |
* @param tile end tile of area-drag |
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
349 |
* @param p1 start tile of area drag |
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
350 |
* @param p2 unused |
0 | 351 |
*/ |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
352 |
int32 CmdLevelLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
0 | 353 |
{ |
354 |
int size_x, size_y; |
|
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
355 |
int ex; |
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
356 |
int ey; |
0 | 357 |
int sx, sy; |
358 |
uint h, curh; |
|
359 |
int32 ret, cost, money; |
|
360 |
||
2934
3f29a7212713
(svn r3490) -Fix: A bunch (10) of off-by-one errors when checking if a TileIndex points to a tile on the map
tron
parents:
2705
diff
changeset
|
361 |
if (p1 >= MapSize()) return CMD_ERROR; |
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
362 |
|
889
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
863
diff
changeset
|
363 |
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
863
diff
changeset
|
364 |
|
0 | 365 |
// remember level height |
1044
63e0601a43cc
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
366 |
h = TileHeight(p1); |
0 | 367 |
|
368 |
// make sure sx,sy are smaller than ex,ey |
|
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
369 |
ex = TileX(tile); |
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
370 |
ey = TileY(tile); |
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
371 |
sx = TileX(p1); |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
372 |
sy = TileY(p1); |
0 | 373 |
if (ex < sx) intswap(ex, sx); |
374 |
if (ey < sy) intswap(ey, sy); |
|
1981 | 375 |
tile = TileXY(sx, sy); |
0 | 376 |
|
377 |
size_x = ex-sx+1; |
|
378 |
size_y = ey-sy+1; |
|
379 |
||
380 |
money = GetAvailableMoneyForCommand(); |
|
381 |
cost = 0; |
|
382 |
||
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
383 |
BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) { |
1044
63e0601a43cc
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
384 |
curh = TileHeight(tile2); |
0 | 385 |
while (curh != h) { |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
386 |
ret = DoCommand(tile2, 8, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND); |
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
387 |
if (CmdFailed(ret)) break; |
0 | 388 |
cost += ret; |
389 |
||
390 |
if (flags & DC_EXEC) { |
|
391 |
if ((money -= ret) < 0) { |
|
392 |
_additional_cash_required = ret; |
|
393 |
return cost - ret; |
|
394 |
} |
|
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
395 |
DoCommand(tile2, 8, (curh > h) ? 0 : 1, flags, CMD_TERRAFORM_LAND); |
0 | 396 |
} |
397 |
||
398 |
curh += (curh > h) ? -1 : 1; |
|
399 |
} |
|
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
400 |
} END_TILE_LOOP(tile2, size_x, size_y, tile) |
0 | 401 |
|
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1782
diff
changeset
|
402 |
return (cost == 0) ? CMD_ERROR : cost; |
0 | 403 |
} |
404 |
||
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
405 |
/** Purchase a land area. Actually you only purchase one tile, so |
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
406 |
* the name is a bit confusing ;p |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
407 |
* @param tile the tile the player is purchasing |
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
408 |
* @param p1 unused |
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
409 |
* @param p2 unused |
0 | 410 |
*/ |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
411 |
int32 CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
0 | 412 |
{ |
413 |
int32 cost; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
414 |
|
0 | 415 |
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
416 |
|
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
417 |
if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
0 | 418 |
|
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3279
diff
changeset
|
419 |
if (IsOwnedLandTile(tile) && IsTileOwner(tile, _current_player)) { |
0 | 420 |
return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT); |
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3279
diff
changeset
|
421 |
} |
0 | 422 |
|
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
423 |
cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
424 |
if (CmdFailed(cost)) return CMD_ERROR; |
0 | 425 |
|
426 |
if (flags & DC_EXEC) { |
|
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3279
diff
changeset
|
427 |
MakeOwnedLand(tile, _current_player); |
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3279
diff
changeset
|
428 |
MarkTileDirtyByTile(tile); |
0 | 429 |
} |
430 |
||
431 |
return cost + _price.purchase_land * 10; |
|
432 |
} |
|
433 |
||
434 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
435 |
static int32 ClearTile_Clear(TileIndex tile, byte flags) |
1095 | 436 |
{ |
2220 | 437 |
static const int32* clear_price_table[] = { |
438 |
&_price.clear_1, |
|
439 |
&_price.purchase_land, |
|
440 |
&_price.clear_2, |
|
441 |
&_price.clear_3, |
|
442 |
&_price.purchase_land, |
|
443 |
&_price.purchase_land, |
|
2955
24de69e236d2
(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
|
444 |
&_price.clear_2, // XXX unused? |
0 | 445 |
}; |
2955
24de69e236d2
(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
|
446 |
int32 price; |
24de69e236d2
(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
|
447 |
|
3447 | 448 |
if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) == 0) { |
2955
24de69e236d2
(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
|
449 |
price = 0; |
24de69e236d2
(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
|
450 |
} else { |
24de69e236d2
(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
|
451 |
price = *clear_price_table[GetClearGround(tile)]; |
24de69e236d2
(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
|
452 |
} |
0 | 453 |
|
2220 | 454 |
if (flags & DC_EXEC) DoClearSquare(tile); |
0 | 455 |
|
2955
24de69e236d2
(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
|
456 |
return price; |
0 | 457 |
} |
458 |
||
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
459 |
/** Sell a land area. Actually you only sell one tile, so |
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
460 |
* the name is a bit confusing ;p |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
461 |
* @param tile the tile the player is selling |
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
462 |
* @param p1 unused |
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
463 |
* @param p2 unused |
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
464 |
*/ |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3447
diff
changeset
|
465 |
int32 CmdSellLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
0 | 466 |
{ |
467 |
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
|
468 |
||
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3279
diff
changeset
|
469 |
if (!IsOwnedLandTile(tile)) return CMD_ERROR; |
1878
980fabc7d8a5
(svn r2384) - Fix: Check selling land and setting player colour. Also an extra map-bounds check for terraforming; inspired by the monkey (and Tron :) )
Darkvater
parents:
1796
diff
changeset
|
470 |
if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR; |
980fabc7d8a5
(svn r2384) - Fix: Check selling land and setting player colour. Also an extra map-bounds check for terraforming; inspired by the monkey (and Tron :) )
Darkvater
parents:
1796
diff
changeset
|
471 |
|
0 | 472 |
|
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
473 |
if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
0 | 474 |
|
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3977
diff
changeset
|
475 |
if (flags & DC_EXEC) DoClearSquare(tile); |
0 | 476 |
|
1782
48749e4c2dc6
(svn r2286) - CodeChange: paramcheck the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
477 |
return - _price.purchase_land * 2; |
0 | 478 |
} |
479 |
||
480 |
||
481 |
#include "table/clear_land.h" |
|
482 |
||
483 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2221
diff
changeset
|
484 |
void DrawClearLandTile(const TileInfo *ti, byte set) |
0 | 485 |
{ |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
486 |
DrawGroundSprite(SPR_FLAT_BARE_LAND + _tileh_to_sprite[ti->tileh] + set * 19, PAL_NONE); |
0 | 487 |
} |
488 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2221
diff
changeset
|
489 |
void DrawHillyLandTile(const TileInfo *ti) |
0 | 490 |
{ |
3636
a36cc46e754d
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
3491
diff
changeset
|
491 |
if (ti->tileh != SLOPE_FLAT) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
492 |
DrawGroundSprite(SPR_FLAT_ROUGH_LAND + _tileh_to_sprite[ti->tileh], PAL_NONE); |
0 | 493 |
} else { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
494 |
DrawGroundSprite(_landscape_clear_sprites[GB(ti->x ^ ti->y, 4, 3)], PAL_NONE); |
0 | 495 |
} |
496 |
} |
|
497 |
||
2220 | 498 |
void DrawClearLandFence(const TileInfo *ti) |
0 | 499 |
{ |
500 |
byte z = ti->z; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
501 |
|
3636
a36cc46e754d
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
3491
diff
changeset
|
502 |
if (ti->tileh & SLOPE_S) { |
3645
7f950533d510
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3636
diff
changeset
|
503 |
z += TILE_HEIGHT; |
7f950533d510
(svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE}
tron
parents:
3636
diff
changeset
|
504 |
if (ti->tileh == SLOPE_STEEP_S) z += TILE_HEIGHT; |
0 | 505 |
} |
506 |
||
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
507 |
if (GetFenceSW(ti->tile) != 0) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
508 |
DrawGroundSpriteAt(_clear_land_fence_sprites_1[GetFenceSW(ti->tile) - 1] + _fence_mod_by_tileh[ti->tileh], PAL_NONE, ti->x, ti->y, z); |
0 | 509 |
} |
510 |
||
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
511 |
if (GetFenceSE(ti->tile) != 0) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
512 |
DrawGroundSpriteAt(_clear_land_fence_sprites_1[GetFenceSE(ti->tile) - 1] + _fence_mod_by_tileh_2[ti->tileh], PAL_NONE, ti->x, ti->y, z); |
0 | 513 |
} |
514 |
} |
|
515 |
||
516 |
static void DrawTile_Clear(TileInfo *ti) |
|
517 |
{ |
|
3166
91e9fc028c95
(svn r3794) Use already available accessor functions instead of GB()
tron
parents:
3156
diff
changeset
|
518 |
switch (GetClearGround(ti->tile)) { |
3447 | 519 |
case CLEAR_GRASS: |
3166
91e9fc028c95
(svn r3794) Use already available accessor functions instead of GB()
tron
parents:
3156
diff
changeset
|
520 |
DrawClearLandTile(ti, GetClearDensity(ti->tile)); |
2955
24de69e236d2
(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
|
521 |
break; |
0 | 522 |
|
3447 | 523 |
case CLEAR_ROUGH: |
2955
24de69e236d2
(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
|
524 |
DrawHillyLandTile(ti); |
24de69e236d2
(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
|
525 |
break; |
0 | 526 |
|
3447 | 527 |
case CLEAR_ROCKS: |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
528 |
DrawGroundSprite(SPR_FLAT_ROCKY_LAND_1 + _tileh_to_sprite[ti->tileh], PAL_NONE); |
2955
24de69e236d2
(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
|
529 |
break; |
0 | 530 |
|
3447 | 531 |
case CLEAR_FIELDS: |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
532 |
DrawGroundSprite(_clear_land_sprites_1[GetFieldType(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE); |
2955
24de69e236d2
(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 |
break; |
0 | 534 |
|
3447 | 535 |
case CLEAR_SNOW: |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
536 |
DrawGroundSprite(_clear_land_sprites_2[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE); |
2955
24de69e236d2
(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 |
break; |
24de69e236d2
(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
|
538 |
|
3447 | 539 |
case CLEAR_DESERT: |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
540 |
DrawGroundSprite(_clear_land_sprites_3[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh], PAL_NONE); |
2955
24de69e236d2
(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
|
541 |
break; |
0 | 542 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
543 |
|
2220 | 544 |
DrawClearLandFence(ti); |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4815
diff
changeset
|
545 |
DrawBridgeMiddle(ti); |
0 | 546 |
} |
547 |
||
4231
2823b3643862
(svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents:
4157
diff
changeset
|
548 |
static uint GetSlopeZ_Clear(TileIndex tile, uint x, uint y) |
1095 | 549 |
{ |
4231
2823b3643862
(svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents:
4157
diff
changeset
|
550 |
uint z; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
551 |
Slope tileh = GetTileSlope(tile, &z); |
4231
2823b3643862
(svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents:
4157
diff
changeset
|
552 |
|
2823b3643862
(svn r5794) Pass the TileIndex plus x and y coordinates into GetSlopeZ_* instead of a TileInfo
tron
parents:
4157
diff
changeset
|
553 |
return z + GetPartialZ(x & 0xF, y & 0xF, tileh); |
1095 | 554 |
} |
0 | 555 |
|
3636
a36cc46e754d
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
3491
diff
changeset
|
556 |
static Slope GetSlopeTileh_Clear(TileIndex tile, Slope tileh) |
39 | 557 |
{ |
3418
ec9003ebf933
(svn r4242) Pass TileIndex and slope to GetSlopeTileh_*() instead of TileInfo
tron
parents:
3379
diff
changeset
|
558 |
return tileh; |
39 | 559 |
} |
560 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
561 |
static void GetAcceptedCargo_Clear(TileIndex tile, AcceptedCargo ac) |
0 | 562 |
{ |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
563 |
/* unused */ |
0 | 564 |
} |
565 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
566 |
static void AnimateTile_Clear(TileIndex tile) |
0 | 567 |
{ |
568 |
/* unused */ |
|
569 |
} |
|
570 |
||
1293 | 571 |
void TileLoopClearHelper(TileIndex tile) |
0 | 572 |
{ |
2221
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
573 |
byte self; |
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
574 |
byte neighbour; |
1293 | 575 |
TileIndex dirty = INVALID_TILE; |
0 | 576 |
|
3447 | 577 |
self = (IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS)); |
0 | 578 |
|
3447 | 579 |
neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS)); |
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
580 |
if (GetFenceSW(tile) == 0) { |
2221
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
581 |
if (self != neighbour) { |
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
582 |
SetFenceSW(tile, 3); |
0 | 583 |
dirty = tile; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
584 |
} |
0 | 585 |
} else { |
2221
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
586 |
if (self == 0 && neighbour == 0) { |
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
587 |
SetFenceSW(tile, 0); |
0 | 588 |
dirty = tile; |
589 |
} |
|
590 |
} |
|
591 |
||
3447 | 592 |
neighbour = (IsTileType(TILE_ADDXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, 1), CLEAR_FIELDS)); |
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
593 |
if (GetFenceSE(tile) == 0) { |
2221
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
594 |
if (self != neighbour) { |
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
595 |
SetFenceSE(tile, 3); |
0 | 596 |
dirty = tile; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
597 |
} |
0 | 598 |
} else { |
2221
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
599 |
if (self == 0 && neighbour == 0) { |
2979
3ddf7c78d469
(svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents:
2956
diff
changeset
|
600 |
SetFenceSE(tile, 0); |
0 | 601 |
dirty = tile; |
602 |
} |
|
603 |
} |
|
604 |
||
2221
de4a862fa8e2
(svn r2739) -Fix(?): Change the fence algorithm so it removes fences when no farm tile is adjacent
tron
parents:
2220
diff
changeset
|
605 |
if (dirty != INVALID_TILE) MarkTileDirtyByTile(dirty); |
0 | 606 |
} |
607 |
||
608 |
||
609 |
/* convert into snowy tiles */ |
|
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
610 |
static void TileLoopClearAlps(TileIndex tile) |
0 | 611 |
{ |
4157
8d0051fdde68
(svn r5581) Slightly alter some snow line related calculations to make them a bit clearer
tron
parents:
4069
diff
changeset
|
612 |
int k = GetTileZ(tile) - _opt.snow_line + TILE_HEIGHT; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
613 |
|
4157
8d0051fdde68
(svn r5581) Slightly alter some snow line related calculations to make them a bit clearer
tron
parents:
4069
diff
changeset
|
614 |
if (k < 0) { // well below the snow line |
3447 | 615 |
if (!IsClearGround(tile, CLEAR_SNOW)) return; |
616 |
if (GetClearDensity(tile) == 0) SetClearGroundDensity(tile, CLEAR_GRASS, 3); |
|
0 | 617 |
} else { |
3447 | 618 |
if (!IsClearGround(tile, CLEAR_SNOW)) { |
619 |
SetClearGroundDensity(tile, CLEAR_SNOW, 0); |
|
2955
24de69e236d2
(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
|
620 |
} else { |
4157
8d0051fdde68
(svn r5581) Slightly alter some snow line related calculations to make them a bit clearer
tron
parents:
4069
diff
changeset
|
621 |
uint density = min((uint)k / TILE_HEIGHT, 3); |
2955
24de69e236d2
(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
|
622 |
|
24de69e236d2
(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
|
623 |
if (GetClearDensity(tile) < density) { |
24de69e236d2
(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
|
624 |
AddClearDensity(tile, 1); |
24de69e236d2
(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
|
625 |
} else if (GetClearDensity(tile) > density) { |
24de69e236d2
(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
|
626 |
AddClearDensity(tile, -1); |
24de69e236d2
(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
|
627 |
} else { |
24de69e236d2
(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
|
628 |
return; |
24de69e236d2
(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
|
629 |
} |
24de69e236d2
(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
|
630 |
} |
0 | 631 |
} |
632 |
||
633 |
MarkTileDirtyByTile(tile); |
|
634 |
} |
|
635 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
636 |
static void TileLoopClearDesert(TileIndex tile) |
0 | 637 |
{ |
3447 | 638 |
if (IsClearGround(tile, CLEAR_DESERT)) return; |
0 | 639 |
|
3379
50b253bb9819
(svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear.
belugas
parents:
3310
diff
changeset
|
640 |
if (GetTropicZone(tile) == TROPICZONE_DESERT) { |
3447 | 641 |
SetClearGroundDensity(tile, CLEAR_DESERT, 3); |
0 | 642 |
} else { |
3379
50b253bb9819
(svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear.
belugas
parents:
3310
diff
changeset
|
643 |
if (GetTropicZone(tile + TileDiffXY( 1, 0)) != TROPICZONE_DESERT && |
50b253bb9819
(svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear.
belugas
parents:
3310
diff
changeset
|
644 |
GetTropicZone(tile + TileDiffXY(-1, 0)) != TROPICZONE_DESERT && |
50b253bb9819
(svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear.
belugas
parents:
3310
diff
changeset
|
645 |
GetTropicZone(tile + TileDiffXY( 0, 1)) != TROPICZONE_DESERT && |
50b253bb9819
(svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear.
belugas
parents:
3310
diff
changeset
|
646 |
GetTropicZone(tile + TileDiffXY( 0, -1)) != TROPICZONE_DESERT) |
1981 | 647 |
return; |
3447 | 648 |
SetClearGroundDensity(tile, CLEAR_DESERT, 1); |
0 | 649 |
} |
650 |
||
651 |
MarkTileDirtyByTile(tile); |
|
652 |
} |
|
653 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
654 |
static void TileLoop_Clear(TileIndex tile) |
0 | 655 |
{ |
656 |
TileLoopClearHelper(tile); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
657 |
|
2989 | 658 |
switch (_opt.landscape) { |
659 |
case LT_DESERT: TileLoopClearDesert(tile); break; |
|
660 |
case LT_HILLY: TileLoopClearAlps(tile); break; |
|
0 | 661 |
} |
662 |
||
2955
24de69e236d2
(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
|
663 |
switch (GetClearGround(tile)) { |
3447 | 664 |
case CLEAR_GRASS: |
2955
24de69e236d2
(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
|
665 |
if (GetClearDensity(tile) == 3) return; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
159
diff
changeset
|
666 |
|
2955
24de69e236d2
(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
|
667 |
if (_game_mode != GM_EDITOR) { |
24de69e236d2
(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
|
668 |
if (GetClearCounter(tile) < 7) { |
24de69e236d2
(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
|
669 |
AddClearCounter(tile, 1); |
24de69e236d2
(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
|
670 |
return; |
24de69e236d2
(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
|
671 |
} else { |
24de69e236d2
(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
|
672 |
SetClearCounter(tile, 0); |
24de69e236d2
(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
|
673 |
AddClearDensity(tile, 1); |
24de69e236d2
(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
|
674 |
} |
24de69e236d2
(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
|
675 |
} else { |
3447 | 676 |
SetClearGroundDensity(tile, GB(Random(), 0, 8) > 21 ? CLEAR_GRASS : CLEAR_ROUGH, 3); |
0 | 677 |
} |
2955
24de69e236d2
(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
|
678 |
break; |
24de69e236d2
(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
|
679 |
|
3447 | 680 |
case CLEAR_FIELDS: { |
2955
24de69e236d2
(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
|
681 |
uint field_type; |
24de69e236d2
(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
|
682 |
|
24de69e236d2
(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
|
683 |
if (_game_mode == GM_EDITOR) return; |
24de69e236d2
(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
|
684 |
|
24de69e236d2
(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
|
685 |
if (GetClearCounter(tile) < 7) { |
24de69e236d2
(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
|
686 |
AddClearCounter(tile, 1); |
24de69e236d2
(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
|
687 |
return; |
24de69e236d2
(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
|
688 |
} else { |
24de69e236d2
(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
|
689 |
SetClearCounter(tile, 0); |
24de69e236d2
(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
|
690 |
} |
24de69e236d2
(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
|
691 |
|
4333
050e8ea8f3bb
(svn r6032) -Fix: when a farm is gone, remove the fields when it is full grown and should be harvest (not before that)
truelight
parents:
4328
diff
changeset
|
692 |
if (GetIndustryIndexOfField(tile) == INVALID_INDUSTRY && GetFieldType(tile) >= 7) { |
4328
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
693 |
/* This farmfield is no longer farmfield, so make it grass again */ |
4815
d702c4027451
(svn r6739) -Fix (r6001): Crash on removing farmland belonging to a farm. The search would loop
Darkvater
parents:
4560
diff
changeset
|
694 |
MakeClear(tile, CLEAR_GRASS, 2); |
4328
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
695 |
} else { |
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
696 |
field_type = GetFieldType(tile); |
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
697 |
field_type = (field_type < 8) ? field_type + 1 : 0; |
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
698 |
SetFieldType(tile, field_type); |
1b3940c35724
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents:
4300
diff
changeset
|
699 |
} |
2955
24de69e236d2
(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
|
700 |
break; |
0 | 701 |
} |
2955
24de69e236d2
(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
|
702 |
|
24de69e236d2
(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
|
703 |
default: |
0 | 704 |
return; |
705 |
} |
|
706 |
||
707 |
MarkTileDirtyByTile(tile); |
|
708 |
} |
|
709 |
||
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
|
710 |
void GenerateClearTile(void) |
0 | 711 |
{ |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
712 |
uint i, gi; |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
713 |
TileIndex tile; |
0 | 714 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
715 |
/* add rough tiles */ |
2635 | 716 |
i = ScaleByMapSize(GB(Random(), 0, 10) + 0x400); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
717 |
gi = ScaleByMapSize(GB(Random(), 0, 7) + 0x80); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
718 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
719 |
SetGeneratingWorldProgress(GWP_ROUGH_ROCKY, gi + i); |
0 | 720 |
do { |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
721 |
IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY); |
2051 | 722 |
tile = RandomTile(); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
723 |
if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) SetClearGroundDensity(tile, CLEAR_ROUGH, 3); |
0 | 724 |
} while (--i); |
725 |
||
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
726 |
/* add rocky tiles */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
727 |
i = gi; |
0 | 728 |
do { |
2150
f710b959b1c4
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2140
diff
changeset
|
729 |
uint32 r = Random(); |
2051 | 730 |
tile = RandomTileSeed(r); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
731 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
732 |
IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
733 |
if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) { |
2150
f710b959b1c4
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2140
diff
changeset
|
734 |
uint j = GB(r, 16, 4) + 5; |
2951 | 735 |
for (;;) { |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
736 |
TileIndex tile_new; |
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
737 |
|
3447 | 738 |
SetClearGroundDensity(tile, CLEAR_ROCKS, 3); |
0 | 739 |
do { |
740 |
if (--j == 0) goto get_out; |
|
4559
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4344
diff
changeset
|
741 |
tile_new = tile + TileOffsByDiagDir(GB(Random(), 0, 2)); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4231
diff
changeset
|
742 |
} while (!IsTileType(tile_new, MP_CLEAR) || IsClearGround(tile_new, CLEAR_DESERT)); |
0 | 743 |
tile = tile_new; |
744 |
} |
|
745 |
get_out:; |
|
746 |
} |
|
747 |
} while (--i); |
|
748 |
} |
|
749 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
750 |
static void ClickTile_Clear(TileIndex tile) |
0 | 751 |
{ |
752 |
/* not used */ |
|
753 |
} |
|
754 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
755 |
static uint32 GetTileTrackStatus_Clear(TileIndex tile, TransportType mode) |
0 | 756 |
{ |
757 |
return 0; |
|
758 |
} |
|
759 |
||
2220 | 760 |
static const StringID _clear_land_str[] = { |
2955
24de69e236d2
(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
|
761 |
STR_080D_GRASS, |
0 | 762 |
STR_080B_ROUGH_LAND, |
763 |
STR_080A_ROCKS, |
|
764 |
STR_080E_FIELDS, |
|
765 |
STR_080F_SNOW_COVERED_LAND, |
|
2955
24de69e236d2
(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
|
766 |
STR_0810_DESERT |
0 | 767 |
}; |
768 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1901
diff
changeset
|
769 |
static void GetTileDesc_Clear(TileIndex tile, TileDesc *td) |
0 | 770 |
{ |
3447 | 771 |
if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) == 0) { |
2955
24de69e236d2
(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
|
772 |
td->str = STR_080C_BARE_LAND; |
24de69e236d2
(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
|
773 |
} else { |
24de69e236d2
(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
|
774 |
td->str = _clear_land_str[GetClearGround(tile)]; |
24de69e236d2
(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
|
775 |
} |
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
|
776 |
td->owner = GetTileOwner(tile); |
0 | 777 |
} |
778 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2221
diff
changeset
|
779 |
static void ChangeTileOwner_Clear(TileIndex tile, PlayerID old_player, PlayerID new_player) |
0 | 780 |
{ |
781 |
return; |
|
782 |
} |
|
783 |
||
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
|
784 |
void InitializeClearLand(void) |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
785 |
{ |
3422
a6eba3443452
(svn r4249) -Codechange: Replace more occurences of 16 by TILE_SIZE and of 8 by TILE_HEIGHT. Reverted one change from the previous commit because it was faulty
celestar
parents:
3418
diff
changeset
|
786 |
_opt.snow_line = _patches.snow_line_height * TILE_HEIGHT; |
0 | 787 |
} |
788 |
||
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
789 |
extern const TileTypeProcs _tile_type_clear_procs = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
790 |
DrawTile_Clear, /* draw_tile_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
791 |
GetSlopeZ_Clear, /* get_slope_z_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
792 |
ClearTile_Clear, /* clear_tile_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
793 |
GetAcceptedCargo_Clear, /* get_accepted_cargo_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
794 |
GetTileDesc_Clear, /* get_tile_desc_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
795 |
GetTileTrackStatus_Clear, /* get_tile_track_status_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
796 |
ClickTile_Clear, /* click_tile_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
797 |
AnimateTile_Clear, /* animate_tile_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
798 |
TileLoop_Clear, /* tile_loop_clear */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
799 |
ChangeTileOwner_Clear, /* change_tile_owner_clear */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
800 |
NULL, /* get_produced_cargo_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
801 |
NULL, /* vehicle_enter_tile_proc */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4333
diff
changeset
|
802 |
GetSlopeTileh_Clear, /* get_slope_tileh_proc */ |
0 | 803 |
}; |