Changeset - r16980:5fa38a729150
[Not reviewed]
master
0 1 0
terkhen - 14 years ago 2011-01-04 21:03:57
terkhen@openttd.org
(svn r21726) -Add: Allow to toggle height visualization in the owner view of the smallmap.
1 file changed with 8 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/smallmap_gui.cpp
Show inline comments
 
@@ -163,14 +163,14 @@ static LegendAndColour _legend_land_owne
 
 * Allow room for all industries, plus a terminator entry
 
 * This is required in order to have the indutry slots all filled up
 
 */
 
static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES + 1];
 
/** For connecting industry type to position in industries list(small map legend) */
 
static uint _industry_to_list_pos[NUM_INDUSTRYTYPES];
 
/** Show heightmap in industry mode of smallmap window. */
 
static bool _smallmap_industry_show_heightmap = false;
 
/** Show heightmap in industry and owner mode of smallmap window. */
 
static bool _smallmap_show_heightmap = false;
 
/** For connecting company ID to position in owner list (small map legend) */
 
static uint _company_to_list_pos[MAX_COMPANIES];
 

	
 
/**
 
 * Fills an array for the industries legends.
 
 */
 
@@ -440,13 +440,13 @@ static inline uint32 GetSmallMapIndustri
 
			/* Otherwise, return the colour which will make it disappear */
 
			t = (IsTileOnWater(tile) ? MP_WATER : MP_CLEAR);
 
		}
 
	}
 

	
 
	const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
 
	return ApplyMask(_smallmap_industry_show_heightmap ? cs->height_colours[TileHeight(tile)] : cs->default_colour, &_smallmap_vehicles_andor[t]);
 
	return ApplyMask(_smallmap_show_heightmap ? cs->height_colours[TileHeight(tile)] : cs->default_colour, &_smallmap_vehicles_andor[t]);
 
}
 

	
 
/**
 
 * Return the colour a tile would be displayed with in the small map in mode "Routes".
 
 *
 
 * @param tile The tile of which we would like to get the colour.
 
@@ -537,13 +537,14 @@ static inline uint32 GetSmallMapOwnerPix
 
		 * GetTileOwner returns the rail owner (level crossing) resp. the owner of ROADTYPE_ROAD (normal road),
 
		 * even if there are no ROADTYPE_ROAD bits on the tile.
 
		 */
 
	}
 

	
 
	if ((o <= MAX_COMPANIES && !_legend_land_owners[_company_to_list_pos[o]].show_on_map) || o == OWNER_NONE) {
 
		return _heightmap_schemes[_settings_client.gui.smallmap_land_colour].default_colour;
 
		const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
 
		return _smallmap_show_heightmap ? cs->height_colours[TileHeight(tile)] : cs->default_colour;
 
	} else if (o == OWNER_WATER) {
 
		return MKCOLOUR(0xCACACACA);
 
	} else if (o == OWNER_TOWN) {
 
		return MKCOLOUR(0xB4B4B4B4);
 
	}
 

	
 
@@ -1039,13 +1040,13 @@ public:
 
	SmallMapWindow(const WindowDesc *desc, int window_number) : Window(), refresh(FORCE_REFRESH_PERIOD)
 
	{
 
		this->InitNested(desc, window_number);
 
		this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR);
 

	
 
		BuildLandLegend();
 
		this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_industry_show_heightmap);
 
		this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_show_heightmap);
 

	
 
		this->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, this->show_towns);
 

	
 
		this->SetupWidgetData();
 

	
 
		this->SetZoomLevel(ZLC_INITIALIZE, NULL);
 
@@ -1387,14 +1388,14 @@ public:
 
					}
 
				}
 
				this->SetDirty();
 
				break;
 

	
 
			case SM_WIDGET_SHOW_HEIGHT: // Enable/disable showing of heightmap.
 
				_smallmap_industry_show_heightmap = !_smallmap_industry_show_heightmap;
 
				this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_industry_show_heightmap);
 
				_smallmap_show_heightmap = !_smallmap_show_heightmap;
 
				this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_show_heightmap);
 
				this->SetDirty();
 
				break;
 
		}
 
	}
 

	
 
	/**
0 comments (0 inline, 0 general)