mirror of https://github.com/OpenTTD/OpenTTD
(svn r14230) -Codechange: Simplify MapDOSColour() using the new stuff.
parent
fc216aeeb8
commit
3ce1a5672e
|
@ -321,18 +321,10 @@ StringID MapGRFStringID(uint32 grfid, StringID str)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8 MapDOSColour(uint8 colour)
|
static inline uint8 MapDOSColour(uint8 colour)
|
||||||
{
|
{
|
||||||
if (_use_palette == PAL_DOS) return colour;
|
extern const byte _palmap_d2w[];
|
||||||
|
return (_use_palette == PAL_DOS ? colour : _palmap_d2w[colour]);
|
||||||
if (colour < 10) {
|
|
||||||
static uint8 dos_to_win_colour_map[] = { 0, 215, 216, 136, 88, 106, 32, 33, 40, 245 };
|
|
||||||
return dos_to_win_colour_map[colour];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colour >= 245 && colour < 254) return colour - 28;
|
|
||||||
|
|
||||||
return colour;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::map<uint32, uint32> _grf_id_overrides;
|
static std::map<uint32, uint32> _grf_id_overrides;
|
||||||
|
|
|
@ -39,7 +39,7 @@ static const byte _palmap_w2d[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Converting from the DOS palette to the Windows palette */
|
/** Converting from the DOS palette to the Windows palette */
|
||||||
static const byte _palmap_d2w[] = {
|
extern const byte _palmap_d2w[] = {
|
||||||
0, 215, 216, 136, 88, 106, 32, 33, // 0..7
|
0, 215, 216, 136, 88, 106, 32, 33, // 0..7
|
||||||
40, 245, 10, 11, 12, 13, 14, 15, // 8..15
|
40, 245, 10, 11, 12, 13, 14, 15, // 8..15
|
||||||
16, 17, 18, 19, 20, 21, 22, 23, // 16..23
|
16, 17, 18, 19, 20, 21, 22, 23, // 16..23
|
||||||
|
|
Loading…
Reference in New Issue