smallmap_gui.c
changeset 2368 cb44b5c6953d
parent 2332 73edb64097fb
child 2548 49c8a096033f
equal deleted inserted replaced
2367:037fa0ea7741 2368:cb44b5c6953d
   514  * @param t The tile of which we would like to get the color.
   514  * @param t The tile of which we would like to get the color.
   515  * @return The color of tile in the small map in mode "Owner"
   515  * @return The color of tile in the small map in mode "Owner"
   516  */
   516  */
   517 static inline uint32 GetSmallMapOwnerPixels(TileIndex tile)
   517 static inline uint32 GetSmallMapOwnerPixels(TileIndex tile)
   518 {
   518 {
   519 	TileType t = GetTileType(tile);
   519 	Owner o;
   520 
   520 
   521 	if (t == MP_INDUSTRY) {
   521 	switch (GetTileType(tile)) {
   522 		t = 0xff;
   522 		case MP_INDUSTRY: o = OWNER_SPECTATOR;    break;
   523 	} else if (t == MP_HOUSE || IsTileOwner(tile, OWNER_TOWN)) {
   523 		case MP_HOUSE:    o = OWNER_TOWN;         break;
   524 		t = 0x80;
   524 		default:          o = GetTileOwner(tile); break;
   525 	} else {
   525 	}
   526 		t = GetTileOwner(tile);
   526 
   527 	}
   527 	return _owner_colors[o];
   528 
       
   529 	return _owner_colors[t];
       
   530 }
   528 }
   531 
   529 
   532 
   530 
   533 static const uint32 _smallmap_mask_left[3] = {
   531 static const uint32 _smallmap_mask_left[3] = {
   534 	MKCOLOR(0xFF000000),
   532 	MKCOLOR(0xFF000000),
   602 	/* clear it */
   600 	/* clear it */
   603 	GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, 0);
   601 	GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, 0);
   604 
   602 
   605 	/* setup owner table */
   603 	/* setup owner table */
   606 	if (type == 5) {
   604 	if (type == 5) {
   607 		Player *p;
   605 		const Player* p;
   608 
       
   609 		/* clear the town colors */
       
   610 		memset(&_owner_colors[128], 0xB4, 128 * sizeof(*_owner_colors));
       
   611 
   606 
   612 		/* fill with some special colors */
   607 		/* fill with some special colors */
       
   608 		_owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4);
   613 		_owner_colors[OWNER_NONE] = MKCOLOR(0x54545454);
   609 		_owner_colors[OWNER_NONE] = MKCOLOR(0x54545454);
   614 		_owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA);
   610 		_owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA);
   615 		_owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */
   611 		_owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */
   616 
   612 
   617 		/* now fill with the player colors */
   613 		/* now fill with the player colors */