diff options
author | tron <tron@openttd.org> | 2006-03-15 17:27:15 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-15 17:27:15 +0000 |
commit | f262ae6c8b03f4a66397a2f70780d23328d90d51 (patch) | |
tree | dfff458d3f484bf166116fb807438f023da5fa3b /tunnelbridge_cmd.c | |
parent | dcf6c85bf2a9b88e8b2839e3aebc91e5576d111e (diff) | |
download | openttd-f262ae6c8b03f4a66397a2f70780d23328d90d51.tar.xz |
(svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r-- | tunnelbridge_cmd.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index a14386280..53eeae041 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -1033,23 +1033,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti) uint z; int x,y; - image = GB(ti->map5, 3, 2); // type of stuff under bridge (only defined for 0,1) - /** @todo So why do we even WASTE that one bit?! (map5, bit 4) */ - assert(image <= 1); - - if (!(ti->map5 & 0x20)) { - // draw land under bridge - if (ice) image += 2; - - if (image != 1 || ti->tileh == 0) { - DrawGroundSprite(_bridge_land_below[image] + _tileh_to_sprite[ti->tileh]); - } else { - DrawGroundSprite(_water_shore_sprites[ti->tileh]); - } - - // draw canal water? - if (ti->map5 & 8 && ti->z != 0) DrawCanalWater(ti->tile); - } else { + if (IsTransportUnderBridge(ti->tile)) { // draw transport route under bridge // draw foundation? @@ -1058,9 +1042,9 @@ static void DrawTile_TunnelBridge(TileInfo *ti) if (f) DrawFoundation(ti, f); } - if (!(image&1)) { + if (GetTransportTypeUnderBridge(ti->tile) == TRANSPORT_RAIL) { const RailtypeInfo *rti = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4)); - // railway + image = SPR_RAIL_TRACK_Y + (ti->map5 & 1); if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1]; image += rti->total_offset; @@ -1072,6 +1056,18 @@ static void DrawTile_TunnelBridge(TileInfo *ti) if (ice) image += 19; } DrawGroundSprite(image); + } else { + if (IsClearUnderBridge(ti->tile)) { + image = (ice ? SPR_FLAT_SNOWY_TILE : SPR_FLAT_GRASS_TILE); + DrawGroundSprite(image + _tileh_to_sprite[ti->tileh]); + } else { + if (ti->tileh == 0) { + DrawGroundSprite(SPR_FLAT_WATER_TILE); + if (ti->z != 0) DrawCanalWater(ti->tile); + } else { + DrawGroundSprite(_water_shore_sprites[ti->tileh]); + } + } } /* Cope for the direction of the bridge */ |