24 #include "depot.h" |
24 #include "depot.h" |
25 #include "vehicle_gui.h" |
25 #include "vehicle_gui.h" |
26 #include "train.h" |
26 #include "train.h" |
27 #include "roadveh.h" |
27 #include "roadveh.h" |
28 #include "water_map.h" |
28 #include "water_map.h" |
|
29 #include "industry_map.h" |
29 #include "newgrf.h" |
30 #include "newgrf.h" |
30 #include "newgrf_canal.h" |
31 #include "newgrf_canal.h" |
31 #include "misc/autoptr.hpp" |
32 #include "misc/autoptr.hpp" |
32 |
33 |
33 static const SpriteID _water_shore_sprites[] = { |
34 static const SpriteID _water_shore_sprites[] = { |
360 |
361 |
361 default: |
362 default: |
362 return false; |
363 return false; |
363 } |
364 } |
364 |
365 |
365 case MP_STATION: return IsOilRig(tile) || IsDock(tile) || IsBuoy(tile); |
366 case MP_STATION: return IsOilRig(tile) || IsDock(tile) || IsBuoy(tile); |
366 default: return false; |
367 case MP_INDUSTRY: return (GetIndustrySpec(GetIndustryType(tile))->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0; |
|
368 default: return false; |
367 } |
369 } |
368 } |
370 } |
369 |
371 |
370 /** draw a canal styled water tile with dikes around */ |
372 /** draw a canal styled water tile with dikes around */ |
371 void DrawCanalWater(TileIndex tile) |
373 void DrawCanalWater(TileIndex tile) |
375 /* Test for custom graphics, else use the default */ |
377 /* Test for custom graphics, else use the default */ |
376 SpriteID dikes_base = GetCanalSprite(CF_DIKES, tile); |
378 SpriteID dikes_base = GetCanalSprite(CF_DIKES, tile); |
377 if (dikes_base == 0) dikes_base = SPR_CANALS_BASE + 57; |
379 if (dikes_base == 0) dikes_base = SPR_CANALS_BASE + 57; |
378 |
380 |
379 /* determine the edges around with water. */ |
381 /* determine the edges around with water. */ |
380 wa = IsWateredTile(TILE_ADDXY(tile, -1, 0)) << 0; |
382 wa = IsWateredTile(TILE_ADDXY(tile, -1, 0)) << 0; |
381 wa += IsWateredTile(TILE_ADDXY(tile, 0, 1)) << 1; |
383 wa += IsWateredTile(TILE_ADDXY(tile, 0, 1)) << 1; |
382 wa += IsWateredTile(TILE_ADDXY(tile, 1, 0)) << 2; |
384 wa += IsWateredTile(TILE_ADDXY(tile, 1, 0)) << 2; |
383 wa += IsWateredTile(TILE_ADDXY(tile, 0, -1)) << 3; |
385 wa += IsWateredTile(TILE_ADDXY(tile, 0, -1)) << 3; |
384 |
386 |
385 if (!(wa & 1)) DrawGroundSprite(dikes_base, PAL_NONE); |
387 if (!(wa & 1)) DrawGroundSprite(dikes_base, PAL_NONE); |
386 if (!(wa & 2)) DrawGroundSprite(dikes_base + 1, PAL_NONE); |
388 if (!(wa & 2)) DrawGroundSprite(dikes_base + 1, PAL_NONE); |
387 if (!(wa & 4)) DrawGroundSprite(dikes_base + 2, PAL_NONE); |
389 if (!(wa & 4)) DrawGroundSprite(dikes_base + 2, PAL_NONE); |
388 if (!(wa & 8)) DrawGroundSprite(dikes_base + 3, PAL_NONE); |
390 if (!(wa & 8)) DrawGroundSprite(dikes_base + 3, PAL_NONE); |