author | matthijs |
Wed, 22 Mar 2006 22:26:16 +0000 | |
branch | 0.4.5 |
changeset 9958 | bed516c67d61 |
parent 2934 | 3b7eef9871f8 |
child 2951 | 2db3adee7736 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1793
diff
changeset
|
4 |
#include "openttd.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
5 |
#include "functions.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
473
diff
changeset
|
6 |
#include "map.h" |
2154
63a6b880b4c0
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2150
diff
changeset
|
7 |
#include "player.h" |
1349
07514c2cc6d1
(svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
1335
diff
changeset
|
8 |
#include "spritecache.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1359
diff
changeset
|
9 |
#include "table/sprites.h" |
1209
a1ac96655b79
(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
tron
parents:
1202
diff
changeset
|
10 |
#include "tile.h" |
0 | 11 |
#include <stdarg.h> |
12 |
#include "viewport.h" |
|
13 |
#include "command.h" |
|
14 |
#include "vehicle.h" |
|
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2154
diff
changeset
|
15 |
#include "variables.h" |
0 | 16 |
|
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
17 |
extern const TileTypeProcs |
0 | 18 |
_tile_type_clear_procs, |
19 |
_tile_type_rail_procs, |
|
20 |
_tile_type_road_procs, |
|
21 |
_tile_type_town_procs, |
|
22 |
_tile_type_trees_procs, |
|
23 |
_tile_type_station_procs, |
|
24 |
_tile_type_water_procs, |
|
25 |
_tile_type_dummy_procs, |
|
26 |
_tile_type_industry_procs, |
|
27 |
_tile_type_tunnelbridge_procs, |
|
28 |
_tile_type_unmovable_procs; |
|
29 |
||
30 |
const TileTypeProcs * const _tile_type_procs[16] = { |
|
31 |
&_tile_type_clear_procs, |
|
32 |
&_tile_type_rail_procs, |
|
33 |
&_tile_type_road_procs, |
|
34 |
&_tile_type_town_procs, |
|
35 |
&_tile_type_trees_procs, |
|
36 |
&_tile_type_station_procs, |
|
37 |
&_tile_type_water_procs, |
|
38 |
&_tile_type_dummy_procs, |
|
39 |
&_tile_type_industry_procs, |
|
40 |
&_tile_type_tunnelbridge_procs, |
|
41 |
&_tile_type_unmovable_procs, |
|
42 |
}; |
|
43 |
||
44 |
/* landscape slope => sprite */ |
|
45 |
const byte _tileh_to_sprite[32] = { |
|
46 |
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,0, |
|
47 |
0,0,0,0,0,0,0,16,0,0,0,17,0,15,18,0, |
|
48 |
}; |
|
49 |
||
1958
625d71cd6898
(svn r2464) Move definition of _inclined_tileh out of variables.h
tron
parents:
1902
diff
changeset
|
50 |
const byte _inclined_tileh[] = { |
625d71cd6898
(svn r2464) Move definition of _inclined_tileh out of variables.h
tron
parents:
1902
diff
changeset
|
51 |
3, 9, 3, 6, 12, 6, 12, 9 |
625d71cd6898
(svn r2464) Move definition of _inclined_tileh out of variables.h
tron
parents:
1902
diff
changeset
|
52 |
}; |
625d71cd6898
(svn r2464) Move definition of _inclined_tileh out of variables.h
tron
parents:
1902
diff
changeset
|
53 |
|
0 | 54 |
|
1193
a4d5c64088f3
(svn r1697) Remove superflous special case for the VOID border tiles in FindLandscapeHeightByTile()
tron
parents:
1184
diff
changeset
|
55 |
void FindLandscapeHeightByTile(TileInfo *ti, TileIndex tile) |
0 | 56 |
{ |
1193
a4d5c64088f3
(svn r1697) Remove superflous special case for the VOID border tiles in FindLandscapeHeightByTile()
tron
parents:
1184
diff
changeset
|
57 |
assert(tile < MapSize()); |
0 | 58 |
|
59 |
ti->tile = tile; |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
60 |
ti->map5 = _m[tile].m5; |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
61 |
ti->type = GetTileType(tile); |
0 | 62 |
ti->tileh = GetTileSlope(tile, &ti->z); |
63 |
} |
|
64 |
||
65 |
/* find the landscape height for the coordinates x y */ |
|
66 |
void FindLandscapeHeight(TileInfo *ti, uint x, uint y) |
|
67 |
{ |
|
68 |
ti->x = x; |
|
69 |
ti->y = y; |
|
70 |
||
856
07dc27d0503e
(svn r1337) Use MapMax[XY]() (or MapSize[XY]() if appropriate) instead of TILE_MAX_[XY]
tron
parents:
851
diff
changeset
|
71 |
if (x >= MapMaxX() * 16 - 1 || y >= MapMaxY() * 16 - 1) { |
0 | 72 |
ti->tileh = 0; |
925
f5fb2d73ca12
(svn r1413) Fixed a serious memory leak problem. The invisible tiles on the southern border now have the correct tile type (MP_VOID) again. Please note that older maps might still have incorrect border tiles, thus still causing overflows.
dominik
parents:
909
diff
changeset
|
73 |
ti->type = MP_VOID; |
0 | 74 |
ti->tile = 0; |
75 |
ti->map5 = 0; |
|
76 |
ti->z = 0; |
|
77 |
return; |
|
78 |
} |
|
79 |
||
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1958
diff
changeset
|
80 |
FindLandscapeHeightByTile(ti, TileVirtXY(x, y)); |
0 | 81 |
} |
82 |
||
83 |
uint GetPartialZ(int x, int y, int corners) |
|
84 |
{ |
|
85 |
int z = 0; |
|
86 |
||
87 |
switch(corners) { |
|
88 |
case 1: |
|
89 |
if (x - y >= 0) |
|
90 |
z = (x - y) >> 1; |
|
91 |
break; |
|
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
92 |
|
0 | 93 |
case 2: |
94 |
y^=0xF; |
|
95 |
if ( (x - y) >= 0) |
|
96 |
z = (x - y) >> 1; |
|
97 |
break; |
|
98 |
||
99 |
case 3: |
|
100 |
z = (x>>1) + 1; |
|
101 |
break; |
|
102 |
||
103 |
case 4: |
|
104 |
if (y - x >= 0) |
|
105 |
z = (y - x) >> 1; |
|
106 |
break; |
|
107 |
||
108 |
case 5: |
|
109 |
case 10: |
|
110 |
case 15: |
|
111 |
z = 4; |
|
112 |
break; |
|
113 |
||
114 |
case 6: |
|
115 |
z = (y>>1) + 1; |
|
116 |
break; |
|
117 |
||
118 |
case 7: |
|
119 |
z = 8; |
|
120 |
y^=0xF; |
|
121 |
if (x - y < 0) |
|
122 |
z += (x - y) >> 1; |
|
123 |
break; |
|
124 |
||
125 |
case 8: |
|
126 |
y ^= 0xF; |
|
127 |
if (y - x >= 0) |
|
128 |
z = (y - x) >> 1; |
|
129 |
break; |
|
130 |
||
131 |
case 9: |
|
132 |
z = (y^0xF)>>1; |
|
133 |
break; |
|
134 |
||
135 |
case 11: |
|
136 |
z = 8; |
|
137 |
if (x - y < 0) |
|
138 |
z += (x - y) >> 1; |
|
139 |
break; |
|
140 |
||
141 |
case 12: |
|
142 |
z = (x^0xF)>>1; |
|
143 |
break; |
|
144 |
||
145 |
case 13: |
|
146 |
z = 8; |
|
147 |
y ^= 0xF; |
|
148 |
if (y - x < 0) |
|
149 |
z += (y - x) >> 1; |
|
150 |
break; |
|
151 |
||
152 |
case 14: |
|
153 |
z = 8; |
|
154 |
if (y - x < 0) |
|
155 |
z += (y - x) >> 1; |
|
156 |
break; |
|
157 |
||
158 |
case 23: |
|
159 |
z = 1 + ((x+y)>>1); |
|
160 |
break; |
|
161 |
||
162 |
case 27: |
|
163 |
z = 1 + ((x+(y^0xF))>>1); |
|
164 |
break; |
|
165 |
||
166 |
case 29: |
|
167 |
z = 1 + (((x^0xF)+(y^0xF))>>1); |
|
168 |
break; |
|
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
169 |
|
0 | 170 |
case 30: |
171 |
z = 1 + (((x^0xF)+(y^0xF))>>1); |
|
172 |
break; |
|
173 |
} |
|
174 |
||
175 |
return z; |
|
176 |
} |
|
177 |
||
178 |
uint GetSlopeZ(int x, int y) |
|
179 |
{ |
|
180 |
TileInfo ti; |
|
181 |
||
182 |
FindLandscapeHeight(&ti, x, y); |
|
183 |
||
184 |
return _tile_type_procs[ti.type]->get_slope_z_proc(&ti); |
|
185 |
} |
|
186 |
||
39 | 187 |
// direction=true: check for foundation in east and south corner |
188 |
// direction=false: check for foundation in west and south corner |
|
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2535
diff
changeset
|
189 |
static bool hasFoundation(const TileInfo* ti, bool direction) |
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
190 |
{ |
39 | 191 |
bool south, other; // southern corner and east/west corner |
192 |
uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti); |
|
50 | 193 |
uint tileh = ti->tileh; |
194 |
||
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2535
diff
changeset
|
195 |
if (slope == 0 && slope != tileh) tileh = 15; |
50 | 196 |
south = (tileh & 2) != (slope & 2); |
39 | 197 |
|
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2535
diff
changeset
|
198 |
if (direction) { |
50 | 199 |
other = (tileh & 4) != (slope & 4); |
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2535
diff
changeset
|
200 |
} else { |
50 | 201 |
other = (tileh & 1) != (slope & 1); |
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2535
diff
changeset
|
202 |
} |
50 | 203 |
return south || other; |
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
204 |
} |
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
205 |
|
0 | 206 |
void DrawFoundation(TileInfo *ti, uint f) |
207 |
{ |
|
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
208 |
uint32 sprite_base = SPR_SLOPES_BASE-14; |
39 | 209 |
|
210 |
TileInfo ti2; |
|
2639 | 211 |
FindLandscapeHeight(&ti2, ti->x, ti->y - 1); |
212 |
if (hasFoundation(&ti2, true)) sprite_base += 22; // foundation in NW direction |
|
213 |
FindLandscapeHeight(&ti2, ti->x - 1, ti->y); |
|
214 |
if (hasFoundation(&ti2, false)) sprite_base += 22 * 2; // foundation in NE direction |
|
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
215 |
|
0 | 216 |
if (f < 15) { |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
217 |
// leveled foundation |
2535 | 218 |
if (sprite_base < SPR_SLOPES_BASE) sprite_base = SPR_FOUNDATION_BASE + 1; // use original slope sprites |
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
219 |
|
2639 | 220 |
AddSortableSpriteToDraw(f - 1 + sprite_base, ti->x, ti->y, 16, 16, 7, ti->z); |
0 | 221 |
ti->z += 8; |
222 |
ti->tileh = 0; |
|
223 |
OffsetGroundSprite(31, 1); |
|
224 |
} else { |
|
225 |
// inclined foundation |
|
37
61bf1df68d82
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
dominik
parents:
0
diff
changeset
|
226 |
sprite_base += 14; |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
227 |
|
0 | 228 |
AddSortableSpriteToDraw( |
2535 | 229 |
HASBIT((1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : SPR_FOUNDATION_BASE + ti->tileh, |
0 | 230 |
ti->x, ti->y, 1, 1, 1, ti->z |
231 |
); |
|
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
232 |
|
0 | 233 |
ti->tileh = _inclined_tileh[f - 15]; |
234 |
OffsetGroundSprite(31, 9); |
|
235 |
} |
|
236 |
} |
|
237 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
238 |
void DoClearSquare(TileIndex tile) |
0 | 239 |
{ |
240 |
ModifyTile(tile, |
|
241 |
MP_SETTYPE(MP_CLEAR) | |
|
242 |
MP_MAP2_CLEAR | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR | MP_MAPOWNER | MP_MAP5, |
|
243 |
OWNER_NONE, /* map_owner */ |
|
244 |
_generating_world ? 3 : 0 /* map5 */ |
|
245 |
); |
|
246 |
} |
|
247 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
248 |
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode) |
0 | 249 |
{ |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
250 |
return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode); |
0 | 251 |
} |
252 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
253 |
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player) |
0 | 254 |
{ |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
255 |
_tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_player, new_player); |
0 | 256 |
} |
257 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
258 |
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac) |
0 | 259 |
{ |
260 |
memset(ac, 0, sizeof(AcceptedCargo)); |
|
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
261 |
_tile_type_procs[GetTileType(tile)]->get_accepted_cargo_proc(tile, ac); |
0 | 262 |
} |
263 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
264 |
void AnimateTile(TileIndex tile) |
0 | 265 |
{ |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
266 |
_tile_type_procs[GetTileType(tile)]->animate_tile_proc(tile); |
0 | 267 |
} |
268 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
269 |
void ClickTile(TileIndex tile) |
0 | 270 |
{ |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
271 |
_tile_type_procs[GetTileType(tile)]->click_tile_proc(tile); |
0 | 272 |
} |
273 |
||
274 |
void DrawTile(TileInfo *ti) |
|
275 |
{ |
|
276 |
_tile_type_procs[ti->type]->draw_tile_proc(ti); |
|
277 |
} |
|
278 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
279 |
void GetTileDesc(TileIndex tile, TileDesc *td) |
0 | 280 |
{ |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
281 |
_tile_type_procs[GetTileType(tile)]->get_tile_desc_proc(tile, td); |
0 | 282 |
} |
283 |
||
1775
08ff0f12ccdc
(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:
1589
diff
changeset
|
284 |
/** Clear a piece of landscape |
08ff0f12ccdc
(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:
1589
diff
changeset
|
285 |
* @param x,y coordinates of clearance |
08ff0f12ccdc
(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:
1589
diff
changeset
|
286 |
* @param p1 unused |
08ff0f12ccdc
(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:
1589
diff
changeset
|
287 |
* @param p2 unused |
0 | 288 |
*/ |
289 |
int32 CmdLandscapeClear(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
290 |
{ |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1958
diff
changeset
|
291 |
TileIndex tile = TileVirtXY(x, y); |
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
292 |
|
0 | 293 |
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
294 |
||
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
295 |
return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags); |
0 | 296 |
} |
297 |
||
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
298 |
/** Clear a big piece of landscape |
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
299 |
* @param x,y end coordinates of area dragging |
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
300 |
* @param p1 start tile of area dragging |
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
301 |
* @param p2 unused |
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
302 |
*/ |
0 | 303 |
int32 CmdClearArea(int ex, int ey, uint32 flags, uint32 p1, uint32 p2) |
304 |
{ |
|
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
305 |
int32 cost, ret, money; |
0 | 306 |
int sx,sy; |
307 |
int x,y; |
|
308 |
bool success = false; |
|
309 |
||
2934
3b7eef9871f8
(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:
2639
diff
changeset
|
310 |
if (p1 >= MapSize()) return CMD_ERROR; |
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
311 |
|
889
7f8630bfea41
(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
|
312 |
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
7f8630bfea41
(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
|
313 |
|
0 | 314 |
// make sure sx,sy are smaller than ex,ey |
926
bd4312619522
(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:
925
diff
changeset
|
315 |
sx = TileX(p1) * 16; |
bd4312619522
(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:
925
diff
changeset
|
316 |
sy = TileY(p1) * 16; |
0 | 317 |
if (ex < sx) intswap(ex, sx); |
318 |
if (ey < sy) intswap(ey, sy); |
|
319 |
||
320 |
money = GetAvailableMoneyForCommand(); |
|
321 |
cost = 0; |
|
322 |
||
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
323 |
for (x = sx; x <= ex; x += 16) { |
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
324 |
for (y = sy; y <= ey; y += 16) { |
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1958
diff
changeset
|
325 |
ret = DoCommandByTile(TileVirtXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR); |
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
326 |
if (CmdFailed(ret)) continue; |
0 | 327 |
cost += ret; |
328 |
success = true; |
|
329 |
||
330 |
if (flags & DC_EXEC) { |
|
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
331 |
if (ret > 0 && (money -= ret) < 0) { |
0 | 332 |
_additional_cash_required = ret; |
333 |
return cost - ret; |
|
334 |
} |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1958
diff
changeset
|
335 |
DoCommandByTile(TileVirtXY(x, y), 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
0 | 336 |
|
337 |
// draw explosion animation... |
|
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
338 |
if ((x == sx || x == ex) && (y == sy || y == ey)) { |
0 | 339 |
// big explosion in each corner, or small explosion for single tiles |
1359
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1350
diff
changeset
|
340 |
CreateEffectVehicleAbove(x + 8, y + 8, 2, |
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1350
diff
changeset
|
341 |
sy == ey && sx == ex ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE |
8ba976aed634
(svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
tron
parents:
1350
diff
changeset
|
342 |
); |
0 | 343 |
} |
344 |
} |
|
345 |
} |
|
346 |
} |
|
347 |
||
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1775
diff
changeset
|
348 |
return (success) ? cost : CMD_ERROR; |
0 | 349 |
} |
350 |
||
351 |
||
352 |
/* utility function used to modify a tile */ |
|
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
353 |
void CDECL ModifyTile(TileIndex tile, uint flags, ...) |
0 | 354 |
{ |
355 |
va_list va; |
|
356 |
int i; |
|
357 |
||
358 |
va_start(va, flags); |
|
359 |
||
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2055
diff
changeset
|
360 |
if ((i = GB(flags, 8, 4)) != 0) { |
1059
c28c6be74291
(svn r1560) Introduce SetTileType() and SetTileHeight()
tron
parents:
1044
diff
changeset
|
361 |
SetTileType(tile, i - 1); |
0 | 362 |
} |
363 |
||
364 |
if (flags & (MP_MAP2_CLEAR | MP_MAP2)) { |
|
365 |
int x = 0; |
|
366 |
if (flags & MP_MAP2) x = va_arg(va, int); |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
367 |
_m[tile].m2 = x; |
0 | 368 |
} |
369 |
||
370 |
if (flags & (MP_MAP3LO_CLEAR | MP_MAP3LO)) { |
|
371 |
int x = 0; |
|
372 |
if (flags & MP_MAP3LO) x = va_arg(va, int); |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
373 |
_m[tile].m3 = x; |
0 | 374 |
} |
375 |
||
376 |
if (flags & (MP_MAP3HI_CLEAR | MP_MAP3HI)) { |
|
377 |
int x = 0; |
|
378 |
if (flags & MP_MAP3HI) x = va_arg(va, int); |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
379 |
_m[tile].m4 = x; |
0 | 380 |
} |
381 |
||
382 |
if (flags & (MP_MAPOWNER|MP_MAPOWNER_CURRENT)) { |
|
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2360
diff
changeset
|
383 |
PlayerID x = _current_player; |
0 | 384 |
if (flags & MP_MAPOWNER) x = va_arg(va, int); |
2360
09e42e4ee139
(svn r2886) Rename the "owner" attribute to "m1", because when it stores an owner it is accessed by [GS]etOwner anyway and when it doesn't store an owner, but arbitrary data, accessing a field called "owner" is confusing.
tron
parents:
2186
diff
changeset
|
385 |
_m[tile].m1 = x; |
0 | 386 |
} |
387 |
||
388 |
if (flags & MP_MAP5) { |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
389 |
_m[tile].m5 = va_arg(va, int); |
0 | 390 |
} |
391 |
||
392 |
va_end(va); |
|
393 |
||
394 |
if (!(flags & MP_NODIRTY)) |
|
395 |
MarkTileDirtyByTile(tile); |
|
396 |
} |
|
397 |
||
398 |
||
399 |
#define TILELOOP_BITS 4 |
|
400 |
#define TILELOOP_SIZE (1 << TILELOOP_BITS) |
|
927
28f45a22a564
(svn r1415) Move TILE_FROM_XY and TILE_XY to map.h and push TILE_[XY] bits from map.h into map.c.
tron
parents:
926
diff
changeset
|
401 |
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX())) |
28f45a22a564
(svn r1415) Move TILE_FROM_XY and TILE_XY to map.h and push TILE_[XY] bits from map.h into map.c.
tron
parents:
926
diff
changeset
|
402 |
#define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS) |
0 | 403 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
404 |
void RunTileLoop(void) |
0 | 405 |
{ |
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
406 |
TileIndex tile; |
0 | 407 |
uint count; |
408 |
||
409 |
tile = _cur_tileloop_tile; |
|
410 |
||
411 |
assert( (tile & ~TILELOOP_ASSERTMASK) == 0); |
|
863
8d09f9331a80
(svn r1344) Use MapSize[XY]() (or MapSize()/MapMax[XY]() where appropriate) instead of TILES_[XY]
tron
parents:
857
diff
changeset
|
412 |
count = (MapSizeX() / TILELOOP_SIZE) * (MapSizeY() / TILELOOP_SIZE); |
0 | 413 |
do { |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1211
diff
changeset
|
414 |
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile); |
0 | 415 |
|
926
bd4312619522
(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:
925
diff
changeset
|
416 |
if (TileX(tile) < MapSizeX() - TILELOOP_SIZE) { |
0 | 417 |
tile += TILELOOP_SIZE; /* no overflow */ |
418 |
} else { |
|
1981 | 419 |
tile = TILE_MASK(tile - TILELOOP_SIZE * (MapSizeX() / TILELOOP_SIZE - 1) + TileDiffXY(0, TILELOOP_SIZE)); /* x would overflow, also increase y */ |
0 | 420 |
} |
421 |
} while (--count); |
|
422 |
assert( (tile & ~TILELOOP_ASSERTMASK) == 0); |
|
423 |
||
424 |
tile += 9; |
|
425 |
if (tile & TILELOOP_CHKMASK) |
|
863
8d09f9331a80
(svn r1344) Use MapSize[XY]() (or MapSize()/MapMax[XY]() where appropriate) instead of TILES_[XY]
tron
parents:
857
diff
changeset
|
426 |
tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK; |
0 | 427 |
_cur_tileloop_tile = tile; |
428 |
} |
|
429 |
||
2055
9361b56db8ba
(svn r2564) Fix: Fixed conceptual issue in network_gui.c. AllocateName is not meant to be used by GUI-code, because it modifies the "game-state".
ludde
parents:
2051
diff
changeset
|
430 |
void InitializeLandscape(void) |
0 | 431 |
{ |
1218 | 432 |
uint map_size; |
959
b031d88c76f3
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
927
diff
changeset
|
433 |
uint i; |
0 | 434 |
|
1218 | 435 |
|
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
436 |
map_size = MapSize(); |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
437 |
for (i = 0; i < map_size; i++) { |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
438 |
_m[i].type_height = MP_CLEAR << 4; |
2360
09e42e4ee139
(svn r2886) Rename the "owner" attribute to "m1", because when it stores an owner it is accessed by [GS]etOwner anyway and when it doesn't store an owner, but arbitrary data, accessing a field called "owner" is confusing.
tron
parents:
2186
diff
changeset
|
439 |
_m[i].m1 = OWNER_NONE; |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
440 |
_m[i].m2 = 0; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
441 |
_m[i].m3 = 0; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
442 |
_m[i].m4 = 0; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
443 |
_m[i].m5 = 3; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
444 |
_m[i].extra = 0; |
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
445 |
} |
0 | 446 |
|
1181
6231b823d796
(svn r1683) Fix placement of MP_VOID tiles. On square maps it accidently works, but on non-square maps the wrong tiles would get marked as MP_VOID
tron
parents:
1174
diff
changeset
|
447 |
// create void tiles at the border |
6231b823d796
(svn r1683) Fix placement of MP_VOID tiles. On square maps it accidently works, but on non-square maps the wrong tiles would get marked as MP_VOID
tron
parents:
1174
diff
changeset
|
448 |
for (i = 0; i < MapMaxY(); ++i) |
6231b823d796
(svn r1683) Fix placement of MP_VOID tiles. On square maps it accidently works, but on non-square maps the wrong tiles would get marked as MP_VOID
tron
parents:
1174
diff
changeset
|
449 |
SetTileType(i * MapSizeX() + MapMaxX(), MP_VOID); |
6231b823d796
(svn r1683) Fix placement of MP_VOID tiles. On square maps it accidently works, but on non-square maps the wrong tiles would get marked as MP_VOID
tron
parents:
1174
diff
changeset
|
450 |
for (i = 0; i < MapSizeX(); ++i) |
6231b823d796
(svn r1683) Fix placement of MP_VOID tiles. On square maps it accidently works, but on non-square maps the wrong tiles would get marked as MP_VOID
tron
parents:
1174
diff
changeset
|
451 |
SetTileType(MapSizeX() * MapMaxY() + i, MP_VOID); |
0 | 452 |
} |
453 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
454 |
void ConvertGroundTilesIntoWaterTiles(void) |
0 | 455 |
{ |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
456 |
TileIndex tile = 0; |
1335
a635854c23b6
(svn r1839) Move GetTileSlope() and GetTileZ() into tile.[ch] and use more explicit types as parameters
tron
parents:
1278
diff
changeset
|
457 |
uint h; |
0 | 458 |
|
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
459 |
for (tile = 0; tile < MapSize(); ++tile) { |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
959
diff
changeset
|
460 |
if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == 0 && h == 0) { |
1059
c28c6be74291
(svn r1560) Introduce SetTileType() and SetTileHeight()
tron
parents:
1044
diff
changeset
|
461 |
SetTileType(tile, MP_WATER); |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
462 |
_m[tile].m5 = 0; |
1902 | 463 |
SetTileOwner(tile, OWNER_WATER); |
0 | 464 |
} |
465 |
} |
|
466 |
} |
|
467 |
||
468 |
static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 }; |
|
469 |
static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 }; |
|
470 |
||
471 |
static void GenerateTerrain(int type, int flag) |
|
472 |
{ |
|
473 |
uint32 r; |
|
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
474 |
uint x; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
475 |
uint y; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
476 |
uint w; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
477 |
uint h; |
1384
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
478 |
const Sprite* template; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
479 |
const byte *p; |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
480 |
Tile* tile; |
0 | 481 |
byte direction; |
482 |
||
483 |
r = Random(); |
|
1384
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
484 |
template = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845); |
0 | 485 |
|
856
07dc27d0503e
(svn r1337) Use MapMax[XY]() (or MapSize[XY]() if appropriate) instead of TILE_MAX_[XY]
tron
parents:
851
diff
changeset
|
486 |
x = r & MapMaxX(); |
927
28f45a22a564
(svn r1415) Move TILE_FROM_XY and TILE_XY to map.h and push TILE_[XY] bits from map.h into map.c.
tron
parents:
926
diff
changeset
|
487 |
y = (r >> MapLogX()) & MapMaxY(); |
0 | 488 |
|
489 |
||
490 |
if (x < 2 || y < 2) |
|
491 |
return; |
|
492 |
||
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2055
diff
changeset
|
493 |
direction = GB(r, 22, 2); |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
494 |
if (direction & 1) { |
1384
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
495 |
w = template->height; |
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
496 |
h = template->width; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
497 |
} else { |
1384
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
498 |
w = template->width; |
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
499 |
h = template->height; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
500 |
} |
1384
06ef4fb5bb1a
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
tron
parents:
1363
diff
changeset
|
501 |
p = template->data; |
0 | 502 |
|
503 |
if (flag & 4) { |
|
1273
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
504 |
uint xw = x * MapSizeY(); |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
505 |
uint yw = y * MapSizeX(); |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
506 |
uint bias = (MapSizeX() + MapSizeY()) * 16; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
507 |
|
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
508 |
switch (flag & 3) { |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
509 |
case 0: |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
510 |
if (xw + yw > MapSize() - bias) return; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
511 |
break; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
512 |
|
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
513 |
case 1: |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
514 |
if (yw < xw + bias) return; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
515 |
break; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
516 |
|
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
517 |
case 2: |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
518 |
if (xw + yw < MapSize() + bias) return; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
519 |
break; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
520 |
|
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
521 |
case 3: |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
522 |
if (xw < yw + bias) return; |
240fa6848fbc
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
tron
parents:
1247
diff
changeset
|
523 |
break; |
0 | 524 |
} |
525 |
} |
|
526 |
||
856
07dc27d0503e
(svn r1337) Use MapMax[XY]() (or MapSize[XY]() if appropriate) instead of TILE_MAX_[XY]
tron
parents:
851
diff
changeset
|
527 |
if (x + w >= MapMaxX() - 1) |
0 | 528 |
return; |
529 |
||
856
07dc27d0503e
(svn r1337) Use MapMax[XY]() (or MapSize[XY]() if appropriate) instead of TILE_MAX_[XY]
tron
parents:
851
diff
changeset
|
530 |
if (y + h >= MapMaxY() - 1) |
0 | 531 |
return; |
532 |
||
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
533 |
tile = &_m[TileXY(x, y)]; |
0 | 534 |
|
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
535 |
switch (direction) { |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
536 |
case 0: |
0 | 537 |
do { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
538 |
Tile* tile_cur = tile; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
539 |
uint w_cur; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
540 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
541 |
for (w_cur = w; w_cur != 0; --w_cur) { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
542 |
if (*p >= tile_cur->type_height) tile_cur->type_height = *p; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
543 |
p++; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
544 |
tile_cur++; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
545 |
} |
1981 | 546 |
tile += TileDiffXY(0, 1); |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
547 |
} while (--h != 0); |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
548 |
break; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
549 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
550 |
case 1: |
0 | 551 |
do { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
552 |
Tile* tile_cur = tile; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
553 |
uint h_cur; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
554 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
555 |
for (h_cur = h; h_cur != 0; --h_cur) { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
556 |
if (*p >= tile_cur->type_height) tile_cur->type_height = *p; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
557 |
p++; |
1981 | 558 |
tile_cur += TileDiffXY(0, 1); |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
559 |
} |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
560 |
tile++; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
561 |
} while (--w != 0); |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
562 |
break; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
563 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
564 |
case 2: |
1981 | 565 |
tile += TileDiffXY(w - 1, 0); |
0 | 566 |
do { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
567 |
Tile* tile_cur = tile; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
568 |
uint w_cur; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
569 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
570 |
for (w_cur = w; w_cur != 0; --w_cur) { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
571 |
if (*p >= tile_cur->type_height) tile_cur->type_height = *p; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
572 |
p++; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
573 |
tile_cur--; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
574 |
} |
1981 | 575 |
tile += TileDiffXY(0, 1); |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
576 |
} while (--h != 0); |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
577 |
break; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
578 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
579 |
case 3: |
1981 | 580 |
tile += TileDiffXY(0, h - 1); |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
581 |
do { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
582 |
Tile* tile_cur = tile; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
583 |
uint h_cur; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
584 |
|
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
585 |
for (h_cur = h; h_cur != 0; --h_cur) { |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
586 |
if (*p >= tile_cur->type_height) tile_cur->type_height = *p; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
587 |
p++; |
1981 | 588 |
tile_cur -= TileDiffXY(0, 1); |
1278
1fbb6cf8d3f1
(svn r1782) Remove line which should've been removed in r1779 and caused map generation to hang infinitely
tron
parents:
1275
diff
changeset
|
589 |
} |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
590 |
tile++; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
591 |
} while (--w != 0); |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
592 |
break; |
0 | 593 |
} |
594 |
} |
|
595 |
||
596 |
||
597 |
#include "table/genland.h" |
|
598 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
599 |
static void CreateDesertOrRainForest(void) |
0 | 600 |
{ |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
601 |
TileIndex tile; |
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
602 |
const TileIndexDiffC *data; |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
603 |
uint i; |
0 | 604 |
|
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
605 |
for (tile = 0; tile != MapSize(); ++tile) { |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
606 |
for (data = _make_desert_or_rainforest_data; |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
607 |
data != endof(_make_desert_or_rainforest_data); ++data) { |
1184
7f0ac9482dad
(svn r1686) Fix (Work around?) crash when generating tropical maps
tron
parents:
1181
diff
changeset
|
608 |
TileIndex t = TILE_MASK(tile + ToTileIndexDiff(*data)); |
1044
9b73df700a7c
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
609 |
if (TileHeight(t) >= 4 || IsTileType(t, MP_WATER)) break; |
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
610 |
} |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
611 |
if (data == endof(_make_desert_or_rainforest_data)) |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
612 |
SetMapExtraBits(tile, 1); |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
613 |
} |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
614 |
|
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
615 |
for (i = 0; i != 256; i++) |
0 | 616 |
RunTileLoop(); |
617 |
||
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
618 |
for (tile = 0; tile != MapSize(); ++tile) { |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
619 |
for (data = _make_desert_or_rainforest_data; |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
620 |
data != endof(_make_desert_or_rainforest_data); ++data) { |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
621 |
TileIndex t = TILE_MASK(tile + ToTileIndexDiff(*data)); |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
622 |
if (IsTileType(t, MP_CLEAR) && (_m[t].m5 & 0x1c) == 0x14) break; |
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
623 |
} |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
624 |
if (data == endof(_make_desert_or_rainforest_data)) |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
625 |
SetMapExtraBits(tile, 2); |
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
889
diff
changeset
|
626 |
} |
0 | 627 |
} |
628 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
629 |
void GenerateLandscape(void) |
0 | 630 |
{ |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
631 |
uint i; |
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
632 |
uint flag; |
0 | 633 |
uint32 r; |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
634 |
|
0 | 635 |
if (_opt.landscape == LT_HILLY) { |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
636 |
for (i = ScaleByMapSize((Random() & 0x7F) + 950); i != 0; --i) |
0 | 637 |
GenerateTerrain(2, 0); |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
638 |
|
0 | 639 |
r = Random(); |
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2055
diff
changeset
|
640 |
flag = GB(r, 0, 2) | 4; |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2055
diff
changeset
|
641 |
for (i = ScaleByMapSize(GB(r, 16, 7) + 450); i != 0; --i) |
0 | 642 |
GenerateTerrain(4, flag); |
643 |
} else if (_opt.landscape == LT_DESERT) { |
|
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
644 |
for (i = ScaleByMapSize((Random()&0x7F) + 170); i != 0; --i) |
0 | 645 |
GenerateTerrain(0, 0); |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
646 |
|
0 | 647 |
r = Random(); |
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2055
diff
changeset
|
648 |
flag = GB(r, 0, 2) | 4; |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2055
diff
changeset
|
649 |
for (i = ScaleByMapSize(GB(r, 16, 8) + 1700); i != 0; --i) |
0 | 650 |
GenerateTerrain(0, flag); |
651 |
||
652 |
flag ^= 2; |
|
653 |
||
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
654 |
for (i = ScaleByMapSize((Random() & 0x7F) + 410); i != 0; --i) |
183
ec2b02ea4c88
(svn r184) -Fix: starting a new game in DesertLandscape crashed the game
truelight
parents:
159
diff
changeset
|
655 |
GenerateTerrain(3, flag); |
0 | 656 |
} else { |
1202
7d8b86bd8ba2
(svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
tron
parents:
1193
diff
changeset
|
657 |
i = ScaleByMapSize((Random() & 0x7F) + (3 - _opt.diff.quantity_sea_lakes) * 256 + 100); |
1275
10f4edfafb5a
(svn r1779) Make the map generation code slightly more readable
tron
parents:
1273
diff
changeset
|
658 |
for (; i != 0; --i) |
0 | 659 |
GenerateTerrain(_opt.diff.terrain_type, 0); |
660 |
} |
|
661 |
||
662 |
ConvertGroundTilesIntoWaterTiles(); |
|
663 |
||
664 |
if (_opt.landscape == LT_DESERT) |
|
665 |
CreateDesertOrRainForest(); |
|
666 |
} |
|
667 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
668 |
void OnTick_Town(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
669 |
void OnTick_Trees(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
670 |
void OnTick_Station(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
671 |
void OnTick_Industry(void); |
0 | 672 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
673 |
void OnTick_Players(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
674 |
void OnTick_Train(void); |
0 | 675 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1059
diff
changeset
|
676 |
void CallLandscapeTick(void) |
0 | 677 |
{ |
678 |
OnTick_Town(); |
|
679 |
OnTick_Trees(); |
|
680 |
OnTick_Station(); |
|
681 |
OnTick_Industry(); |
|
682 |
||
683 |
OnTick_Players(); |
|
684 |
OnTick_Train(); |
|
685 |
} |
|
686 |
||
687 |
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng) |
|
688 |
{ |
|
689 |
int rn = rng; |
|
690 |
uint32 r = Random(); |
|
691 |
||
1981 | 692 |
return TILE_MASK(TileXY( |
2150
010d923a81a9
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2140
diff
changeset
|
693 |
TileX(a) + (GB(r, 0, 8) * rn * 2 >> 8) - rn, |
010d923a81a9
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2140
diff
changeset
|
694 |
TileY(a) + (GB(r, 8, 8) * rn * 2 >> 8) - rn |
1174
27e386195965
(svn r1676) Increase the size of TileIndex and TileIndexDiff to 32bits and adapt the save/load data and some other parts of the code to that change
tron
parents:
1140
diff
changeset
|
695 |
)); |
0 | 696 |
} |
697 |
||
1589
58d173b56509
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents:
1384
diff
changeset
|
698 |
bool IsValidTile(TileIndex tile) |
0 | 699 |
{ |
926
bd4312619522
(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:
925
diff
changeset
|
700 |
return (tile < MapSizeX() * MapMaxY() && TileX(tile) != MapMaxX()); |
0 | 701 |
} |