1
0
Fork 0

(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers

release/0.4.5
tron 2005-08-27 13:04:15 +00:00
parent ffdefbdee2
commit 1677748d4d
1 changed files with 8 additions and 12 deletions

View File

@ -516,17 +516,15 @@ static uint32 _owner_colors[256];
*/ */
static inline uint32 GetSmallMapOwnerPixels(TileIndex tile) static inline uint32 GetSmallMapOwnerPixels(TileIndex tile)
{ {
TileType t = GetTileType(tile); Owner o;
if (t == MP_INDUSTRY) { switch (GetTileType(tile)) {
t = 0xff; case MP_INDUSTRY: o = OWNER_SPECTATOR; break;
} else if (t == MP_HOUSE || IsTileOwner(tile, OWNER_TOWN)) { case MP_HOUSE: o = OWNER_TOWN; break;
t = 0x80; default: o = GetTileOwner(tile); break;
} else {
t = GetTileOwner(tile);
} }
return _owner_colors[t]; return _owner_colors[o];
} }
@ -604,12 +602,10 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town
/* setup owner table */ /* setup owner table */
if (type == 5) { if (type == 5) {
Player *p; const Player* p;
/* clear the town colors */
memset(&_owner_colors[128], 0xB4, 128 * sizeof(*_owner_colors));
/* fill with some special colors */ /* fill with some special colors */
_owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4);
_owner_colors[OWNER_NONE] = MKCOLOR(0x54545454); _owner_colors[OWNER_NONE] = MKCOLOR(0x54545454);
_owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA); _owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA);
_owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */ _owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */