src/station_cmd.cpp
changeset 10355 8a930759b457
parent 10353 452d21d281e6
--- a/src/station_cmd.cpp	Sat Nov 22 15:57:31 2008 +0000
+++ b/src/station_cmd.cpp	Sat Nov 22 16:04:11 2008 +0000
@@ -24,6 +24,7 @@
 #include "industry_map.h"
 #include "newgrf_callbacks.h"
 #include "newgrf_station.h"
+#include "newgrf_commons.h"
 #include "yapf/yapf.h"
 #include "road_type.h"
 #include "road_internal.h" /* For drawing catenary/checking road removal */
@@ -2325,13 +2326,14 @@
 		}
 	} else {
 		SpriteID image = t->ground.sprite;
+		SpriteID pal   = t->ground.pal;
 		if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
 			image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
 			image += custom_ground_offset;
 		} else {
 			image += total_offset;
 		}
-		DrawGroundSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE);
+		DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
 
 		/* PBS debugging, draw reserved tracks darker */
 		if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && IsRailwayStation(ti->tile) && GetRailwayStationReservation(ti->tile)) {
@@ -2361,16 +2363,7 @@
 			image += relocation;
 		}
 
-		SpriteID pal;
-		if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) {
-			if (dtss->image.pal > 0) {
-				pal = dtss->image.pal;
-			} else {
-				pal = palette;
-			}
-		} else {
-			pal = PAL_NONE;
-		}
+		SpriteID pal = SpriteLayoutPaletteTransform(image, dtss->image.pal, palette);
 
 		if ((byte)dtss->delta_z != 0x80) {
 			AddSortableSpriteToDraw(