changeset 8906:39d12674a79a draft

(svn r12674) -Fix [FS#1902]: Colour remaps on station sprites only worked for company colours.
author peter1138 <peter1138@openttd.org>
date Sat, 12 Apr 2008 22:11:21 +0000
parents 85cf73f7d343
children 875d0ded8de2
files src/newgrf_station.cpp src/station_cmd.cpp
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -754,7 +754,7 @@
 	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
 	SpriteID relocation;
 	SpriteID image;
-	SpriteID pal = PLAYER_SPRITE_COLOR(_local_player);
+	SpriteID palette = PLAYER_SPRITE_COLOR(_local_player);
 	uint tile = 2;
 
 	statspec = GetCustomStationSpec(sclass, station);
@@ -792,6 +792,17 @@
 			image += relocation;
 		}
 
+		SpriteID pal;
+		if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) {
+			if (seq->image.pal > 0) {
+				pal = seq->image.pal;
+			} else {
+				pal = palette;
+			}
+		} else {
+			pal = PAL_NONE;
+		}
+
 		if ((byte)seq->delta_z != 0x80) {
 			pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z);
 			DrawSprite(image, pal, x + pt.x, y + pt.y);
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2199,10 +2199,14 @@
 		}
 
 		SpriteID pal;
-		if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
-			pal = palette;
+		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 = dtss->image.pal;
+			pal = PAL_NONE;
 		}
 
 		if ((byte)dtss->delta_z != 0x80) {