diff options
author | peter1138 <peter1138@openttd.org> | 2010-03-03 19:07:34 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2010-03-03 19:07:34 +0000 |
commit | 1025d003b30f6ce0be320a9ed3b53e2e85565325 (patch) | |
tree | 1bc4dd9a07b562969cf906a3c9112b13cd27bfc1 | |
parent | c3d3e7d3831f288120d3bc90d7dba6add01b1e7c (diff) | |
download | openttd-1025d003b30f6ce0be320a9ed3b53e2e85565325.tar.xz |
(svn r19307) -Add: Let railtypes specify their own smallmap colour. No legend support yet.
-rw-r--r-- | src/newgrf.cpp | 5 | ||||
-rw-r--r-- | src/rail.h | 5 | ||||
-rw-r--r-- | src/smallmap_gui.cpp | 8 | ||||
-rw-r--r-- | src/table/railtypes.h | 12 |
4 files changed, 30 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 4ca71a90f..ad212be14 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2583,6 +2583,10 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR rti->acceleration_type = Clamp(buf->ReadByte(), 0, 2); break; + case 0x16: // Map colour + rti->map_colour = MapDOSColour(buf->ReadByte()); + break; + default: ret = CIR_UNKNOWN; break; @@ -2637,6 +2641,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte case 0x11: // Curve speed advantage case 0x12: // Station graphic case 0x15: // Acceleration model + case 0x16: // Map colour buf->ReadByte(); break; diff --git a/src/rail.h b/src/rail.h index 049e4286e..aaa592da9 100644 --- a/src/rail.h +++ b/src/rail.h @@ -204,6 +204,11 @@ struct RailtypeInfo { RailTypeLabel label; /** + * Colour on mini-map + */ + byte map_colour; + + /** * Sprite groups for resolving sprites */ const SpriteGroup *group[RTSG_END]; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 51554367b..40d238c9b 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -419,6 +419,14 @@ static inline uint32 GetSmallMapRoutesPixels(TileIndex tile, TileType t) case STATION_DOCK: return MKCOLOUR(0x98989898); default: return MKCOLOUR(0xFFFFFFFF); } + } else if (t == MP_RAILWAY) { + AndOr andor = { + GetRailTypeInfo(GetRailType(tile))->map_colour * MKCOLOUR(0x00010100), + _smallmap_contours_andor[t].mand + }; + + const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; + return ApplyMask(cs->default_colour, &andor); } /* Ground colour */ diff --git a/src/table/railtypes.h b/src/table/railtypes.h index 75d69ee69..d70e22954 100644 --- a/src/table/railtypes.h +++ b/src/table/railtypes.h @@ -90,6 +90,9 @@ static const RailtypeInfo _original_railtypes[] = { /* rail type label */ 'RAIL', + /* map colour */ + 0x0A, + { NULL }, }, @@ -170,6 +173,9 @@ static const RailtypeInfo _original_railtypes[] = { /* rail type label */ 'ELRL', + /* map colour */ + 0x0A, + { NULL }, }, @@ -246,6 +252,9 @@ static const RailtypeInfo _original_railtypes[] = { /* rail type label */ 'MONO', + /* map colour */ + 0x0A, + { NULL }, }, @@ -322,6 +331,9 @@ static const RailtypeInfo _original_railtypes[] = { /* rail type label */ 'MGLV', + /* map colour */ + 0x0A, + { NULL }, }, }; |