diff --git a/station_cmd.c b/station_cmd.c --- a/station_cmd.c +++ b/station_cmd.c @@ -2137,7 +2137,8 @@ static void DrawTile_Station(TileInfo *t const DrawTileSeqStruct *dtss; const DrawTileSprites *t = NULL; byte railtype = _m[ti->tile].m3 & 0xF; - int type_offset; + const RailtypeInfo *rti = GetRailTypeInfo(railtype); + SpriteID offset; uint32 relocation = 0; { @@ -2173,26 +2174,26 @@ static void DrawTile_Station(TileInfo *t image |= image_or_modificator; // For custom sprites, there's no railtype-based pitching. - type_offset = railtype * ((image & SPRITE_MASK) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 1); + offset = (image & SPRITE_MASK) < _custom_sprites_base ? rti->total_offset : railtype; + image += offset; // station_land array has been increased from 82 elements to 114 // but this is something else. If AI builds station with 114 it looks all weird - image += type_offset; DrawGroundSprite(image); if (_debug_pbs_level >= 1) { byte pbs = PBSTileReserved(ti->tile); - if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite((0x3ED + type_offset) | PALETTE_CRASH); - if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite((0x3EE + type_offset) | PALETTE_CRASH); - if (pbs & TRACK_BIT_UPPER) DrawGroundSprite((0x3EF + type_offset) | PALETTE_CRASH); - if (pbs & TRACK_BIT_LOWER) DrawGroundSprite((0x3F0 + type_offset) | PALETTE_CRASH); - if (pbs & TRACK_BIT_LEFT) DrawGroundSprite((0x3F2 + type_offset) | PALETTE_CRASH); - if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite((0x3F1 + type_offset) | PALETTE_CRASH); + if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite(rti->base_sprites.single_y | PALETTE_CRASH); + if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite(rti->base_sprites.single_x | PALETTE_CRASH); + if (pbs & TRACK_BIT_UPPER) DrawGroundSprite(rti->base_sprites.single_n | PALETTE_CRASH); + if (pbs & TRACK_BIT_LOWER) DrawGroundSprite(rti->base_sprites.single_s | PALETTE_CRASH); + if (pbs & TRACK_BIT_LEFT) DrawGroundSprite(rti->base_sprites.single_w | PALETTE_CRASH); + if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite(rti->base_sprites.single_e | PALETTE_CRASH); } foreach_draw_tile_seq(dtss, t->seq) { image = dtss->image + relocation; - image += type_offset; + image += offset; if (_display_opt & DO_TRANS_BUILDINGS) { MAKE_TRANSPARENT(image); } else { @@ -2212,9 +2213,7 @@ void StationPickerDrawSprite(int x, int uint32 ormod, img; const DrawTileSeqStruct *dtss; const DrawTileSprites *t; - - /* baseimage */ - railtype *= TRACKTYPE_SPRITE_PITCH; + const RailtypeInfo *rti = GetRailTypeInfo(railtype); ormod = PLAYER_SPRITE_COLOR(_local_player); @@ -2223,11 +2222,11 @@ void StationPickerDrawSprite(int x, int img = t->ground_sprite; if (img & PALETTE_MODIFIER_COLOR) img |= ormod; - DrawSprite(img + railtype, x, y); + DrawSprite(img + rti->total_offset, x, y); foreach_draw_tile_seq(dtss, t->seq) { Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z); - DrawSprite((dtss->image | ormod) + railtype, x + pt.x, y + pt.y); + DrawSprite((dtss->image | ormod) + rti->total_offset, x + pt.x, y + pt.y); } }