Mercurial > hg > openttd
changeset 19907:e66469894c9c draft
(svn r24840) -Fix: Draw NewGRF railtypes in NewGRF station previews.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Sun, 23 Dec 2012 15:38:54 +0000 |
parents | 4cdf512f07a1 |
children | 440fd0c78034 |
files | src/newgrf_station.cpp src/station_cmd.cpp src/station_func.h |
diffstat | 3 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -843,10 +843,16 @@ SpriteID image = sprites->ground.sprite; PaletteID pal = sprites->ground.pal; - image += HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? ground_relocation : total_offset; - if (HasBit(pal, SPRITE_MODIFIER_CUSTOM_SPRITE)) pal += ground_relocation; - - DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y); + RailTrackOffset overlay_offset; + if (rti != NULL && rti->UsesOverlay() && SplitGroundSpriteForOverlay(NULL, &image, &overlay_offset)) { + SpriteID ground = GetCustomRailSprite(rti, INVALID_TILE, RTSG_GROUND); + DrawSprite(image, PAL_NONE, x, y); + DrawSprite(ground + overlay_offset, PAL_NONE, x, y); + } else { + image += HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? ground_relocation : total_offset; + if (HasBit(pal, SPRITE_MODIFIER_CUSTOM_SPRITE)) pal += ground_relocation; + DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y); + } DrawRailTileSeqInGUI(x, y, sprites, total_offset, relocation, palette);
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2559,7 +2559,7 @@ * @param [out] overlay_offset Overlay to draw. * @return true if overlay can be drawn. */ -static bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset) +bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset) { bool snow_desert; switch (*ground) {
--- a/src/station_func.h +++ b/src/station_func.h @@ -16,6 +16,7 @@ #include "rail_type.h" #include "road_type.h" #include "economy_func.h" +#include "rail.h" void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius); @@ -44,6 +45,8 @@ void UpdateAirportsNoise(); +bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset); + /** * Calculates the maintenance cost of a number of station tiles. * @param num Number of station tiles.