equal
deleted
inserted
replaced
251 ROAD_SE = 4, // SE road track |
251 ROAD_SE = 4, // SE road track |
252 ROAD_NE = 8, // NE road track |
252 ROAD_NE = 8, // NE road track |
253 ROAD_ALL = (ROAD_NW | ROAD_SW | ROAD_SE | ROAD_NE) |
253 ROAD_ALL = (ROAD_NW | ROAD_SW | ROAD_SE | ROAD_NE) |
254 }; |
254 }; |
255 |
255 |
256 static const byte _valid_tileh_slopes_road[2][15] = { |
256 static const byte _valid_tileh_slopes_road[3][15] = { |
257 // set of normal ones |
257 // set of normal ones |
258 { |
258 { |
259 ROAD_ALL, 0, 0, |
259 ROAD_ALL, 0, 0, |
260 ROAD_SW | ROAD_NE, 0, 0, // 3, 4, 5 |
260 ROAD_SW | ROAD_NE, 0, 0, // 3, 4, 5 |
261 ROAD_NW | ROAD_SE, 0, 0, |
261 ROAD_NW | ROAD_SE, 0, 0, |
280 ROAD_ALL, |
280 ROAD_ALL, |
281 |
281 |
282 ROAD_NW | ROAD_SE | ROAD_NE, // 12 |
282 ROAD_NW | ROAD_SE | ROAD_NE, // 12 |
283 ROAD_ALL, |
283 ROAD_ALL, |
284 ROAD_ALL |
284 ROAD_ALL |
|
285 }, |
|
286 // valid railway crossings on slopes |
|
287 { |
|
288 1, 0, 0, // 0, 1, 2 |
|
289 0, 0, 1, // 3, 4, 5 |
|
290 0, 1, 0, // 6, 7, 8 |
|
291 0, 1, 1, // 9, 10, 11 |
|
292 0, 1, 1, // 12, 13, 14 |
285 } |
293 } |
286 }; |
294 }; |
287 |
295 |
288 |
296 |
289 static uint32 CheckRoadSlope(int tileh, byte *pieces, byte existing) |
297 static uint32 CheckRoadSlope(int tileh, byte *pieces, byte existing) |
345 goto do_clear; |
353 goto do_clear; |
346 } |
354 } |
347 } else if (ti.type == MP_RAILWAY) { |
355 } else if (ti.type == MP_RAILWAY) { |
348 byte m5; |
356 byte m5; |
349 |
357 |
350 if (ti.tileh != 0) goto do_clear; |
358 if (ti.tileh & 0x10) // very steep tile |
351 |
359 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
|
360 |
|
361 if(!_valid_tileh_slopes_road[2][ti.tileh]) // prevent certain slopes |
|
362 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
|
363 |
352 if (ti.map5 == 2) { |
364 if (ti.map5 == 2) { |
353 if (pieces & 5) goto do_clear; |
365 if (pieces & 5) goto do_clear; |
354 m5 = 0x10; |
366 m5 = 0x10; |
355 } else if (ti.map5 == 1) { |
367 } else if (ti.map5 == 1) { |
356 if (pieces & 10) goto do_clear; |
368 if (pieces & 10) goto do_clear; |
369 } |
381 } |
370 return _price.build_road * 2; |
382 return _price.build_road * 2; |
371 } else if (ti.type == MP_TUNNELBRIDGE) { |
383 } else if (ti.type == MP_TUNNELBRIDGE) { |
372 |
384 |
373 /* check for flat land */ |
385 /* check for flat land */ |
374 if (ti.tileh & 0x10) //goto do_clear; // very steep tile |
386 if (ti.tileh & 0x10) // very steep tile |
375 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
387 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
376 |
388 |
377 /* is this middle part of a bridge? */ |
389 /* is this middle part of a bridge? */ |
378 if ((ti.map5 & 0xC0) != 0xC0) |
390 if ((ti.map5 & 0xC0) != 0xC0) |
379 goto do_clear; |
391 goto do_clear; |
689 // inclined sloped building |
701 // inclined sloped building |
690 if ( ((i=0, tileh == 1) || (i+=2, tileh == 2) || (i+=2, tileh == 4) || (i+=2, tileh == 8)) && |
702 if ( ((i=0, tileh == 1) || (i+=2, tileh == 2) || (i+=2, tileh == 4) || (i+=2, tileh == 8)) && |
691 ((bits == (ROAD_SW | ROAD_NE)) || (i++, bits == (ROAD_NW | ROAD_SE)))) |
703 ((bits == (ROAD_SW | ROAD_NE)) || (i++, bits == (ROAD_NW | ROAD_SE)))) |
692 return i + 15; |
704 return i + 15; |
693 |
705 |
|
706 // rail crossing |
|
707 if ((bits & 0x10) && _valid_tileh_slopes_road[2][tileh]) |
|
708 return tileh; |
|
709 |
694 return 0; |
710 return 0; |
695 } |
711 } |
696 |
712 |
697 const byte _road_sloped_sprites[14] = { |
713 const byte _road_sloped_sprites[14] = { |
698 0, 0, 2, 0, |
714 0, 0, 2, 0, |
753 byte z = ti->z; |
769 byte z = ti->z; |
754 if (ti->tileh != 0) z = GetSlopeZ(x, y); |
770 if (ti->tileh != 0) z = GetSlopeZ(x, y); |
755 AddSortableSpriteToDraw(image, x, y, 2, 2, 0x10, z); |
771 AddSortableSpriteToDraw(image, x, y, 2, 2, 0x10, z); |
756 drts++; |
772 drts++; |
757 } |
773 } |
758 } else if ( (ti->map5 & 0xE0) == 0) { |
774 } else if ( (ti->map5 & 0xE0) == 0) { // railroad crossing |
|
775 int f = GetRoadFoundation(ti->tileh, ti->map5 & 0xF); |
|
776 if (f) DrawFoundation(ti, f); |
|
777 |
759 image = 0x55B; |
778 image = 0x55B; |
760 |
779 |
761 if ( (ti->map5 & 8) != 0) |
780 if ( (ti->map5 & 8) != 0) |
762 image--; |
781 image--; |
763 |
782 |
834 uint z = ti->z; |
853 uint z = ti->z; |
835 int th = ti->tileh; |
854 int th = ti->tileh; |
836 |
855 |
837 // check if it's a foundation |
856 // check if it's a foundation |
838 if (ti->tileh != 0) { |
857 if (ti->tileh != 0) { |
839 if ((ti->map5 & 0xF0) == 0) { |
858 if ((ti->map5 & 0xE0) == 0) { /* road or crossing */ |
840 uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F); |
859 uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F); |
841 if (f != 0) { |
860 if (f != 0) { |
842 if (f < 15) { |
861 if (f < 15) { |
843 // leveled foundation |
862 // leveled foundation |
844 return z + 8; |
863 return z + 8; |