equal
deleted
inserted
replaced
259 return_cmd_error(INVALID_STRING_ID); |
259 return_cmd_error(INVALID_STRING_ID); |
260 } |
260 } |
261 } |
261 } |
262 |
262 |
263 |
263 |
264 static const RoadBits _valid_tileh_slopes_road[3][15] = { |
264 static const RoadBits _valid_tileh_slopes_road[][15] = { |
265 // set of normal ones |
265 // set of normal ones |
266 { |
266 { |
267 ROAD_ALL, 0, 0, |
267 ROAD_ALL, 0, 0, |
268 ROAD_X, 0, 0, // 3, 4, 5 |
268 ROAD_X, 0, 0, // 3, 4, 5 |
269 ROAD_Y, 0, 0, |
269 ROAD_Y, 0, 0, |
289 |
289 |
290 ROAD_Y | ROAD_NE, // 12 |
290 ROAD_Y | ROAD_NE, // 12 |
291 ROAD_ALL, |
291 ROAD_ALL, |
292 ROAD_ALL |
292 ROAD_ALL |
293 }, |
293 }, |
294 // valid railway crossings on slopes |
|
295 { |
|
296 1, 0, 0, // 0, 1, 2 |
|
297 0, 0, 1, // 3, 4, 5 |
|
298 0, 1, 0, // 6, 7, 8 |
|
299 0, 1, 1, // 9, 10, 11 |
|
300 0, 1, 1, // 12, 13, 14 |
|
301 } |
|
302 }; |
294 }; |
303 |
295 |
304 |
296 |
305 static uint32 CheckRoadSlope(int tileh, byte *pieces, byte existing) |
297 static uint32 CheckRoadSlope(int tileh, byte *pieces, byte existing) |
306 { |
298 { |
381 |
373 |
382 if (IsSteepTileh(ti.tileh)) { // very steep tile |
374 if (IsSteepTileh(ti.tileh)) { // very steep tile |
383 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
375 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
384 } |
376 } |
385 |
377 |
386 if (!_valid_tileh_slopes_road[2][ti.tileh]) { // prevent certain slopes |
378 #define M(x) (1 << (x)) |
|
379 /* Level crossings may only be built on these slopes */ |
|
380 if (!HASBIT(M(14) | M(13) | M(11) | M(10) | M(7) | M(5) | M(0), ti.tileh)) { |
387 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
381 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
388 } |
382 } |
|
383 #undef M |
389 |
384 |
390 if (ti.map5 == 2) { |
385 if (ti.map5 == 2) { |
391 if (pieces & ROAD_Y) goto do_clear; |
386 if (pieces & ROAD_Y) goto do_clear; |
392 roaddir = AXIS_X; |
387 roaddir = AXIS_X; |
393 } else if (ti.map5 == 1) { |
388 } else if (ti.map5 == 1) { |