diff options
author | frosch <frosch@openttd.org> | 2008-10-18 17:20:31 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-10-18 17:20:31 +0000 |
commit | 3d7ab65557c0c4533debbbb500e6f74edf84736a (patch) | |
tree | 5f6870cc29b48b0ab1270d5d5455d82ef1e9744a /src | |
parent | ad0a578b69750deb77e8b2edf2a01e54c8d9e665 (diff) | |
download | openttd-3d7ab65557c0c4533debbbb500e6f74edf84736a.tar.xz |
(svn r14487) -Fix: The station picker preview did not draw child sprites.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_station.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index ae13dfcca..3438a87ca 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -27,6 +27,7 @@ #include "functions.h" #include "tunnelbridge_map.h" #include "rail_map.h" +#include "spritecache.h" #include "table/sprites.h" #include "table/strings.h" @@ -811,8 +812,9 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID DrawSprite(image, PAL_NONE, x, y); + Point child_offset = {0, 0}; + foreach_draw_tile_seq(seq, sprites->seq) { - Point pt; image = seq->image.sprite; if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) { image += rti->total_offset; @@ -832,8 +834,15 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID } if ((byte)seq->delta_z != 0x80) { - pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z); + Point pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z); DrawSprite(image, pal, x + pt.x, y + pt.y); + + const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL); + child_offset.x = pt.x + spr->x_offs; + child_offset.y = pt.y + spr->y_offs; + } else { + /* For stations and original spritelayouts delta_x and delta_y are signed */ + DrawSprite(image, pal, x + child_offset.x + seq->delta_x, y + child_offset.y + seq->delta_y); } } |