|
@@ -60,13 +60,14 @@ static int _smallmap_industry_count; ///
|
|
|
/** Macro for a height legend entry with configurable colour. */
|
|
|
#define MC(height) {0, STR_TINY_BLACK_HEIGHT, {height}, true, false, false}
|
|
|
|
|
|
/** Macro for end of list marker in arrays of LegendAndColour */
|
|
|
#define MKEND() {0, STR_NULL, {INVALID_INDUSTRYTYPE}, true, true, false}
|
|
|
|
|
|
/** Macro for break marker in arrays of LegendAndColour.
|
|
|
/**
|
|
|
* Macro for break marker in arrays of LegendAndColour.
|
|
|
* It will have valid data, though */
|
|
|
#define MS(a, b) {a, b, {INVALID_INDUSTRYTYPE}, true, false, true}
|
|
|
|
|
|
/** Structure for holding relevant data for legends in small map */
|
|
|
struct LegendAndColour {
|
|
|
uint8 colour; ///< Colour of the item on the map.
|
|
@@ -146,13 +147,14 @@ static const LegendAndColour _legend_lan
|
|
|
};
|
|
|
#undef MK
|
|
|
#undef MC
|
|
|
#undef MS
|
|
|
#undef MKEND
|
|
|
|
|
|
/** Allow room for all industries, plus a terminator entry
|
|
|
/**
|
|
|
* 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;
|
|
@@ -628,13 +630,14 @@ class SmallMapWindow : public Window {
|
|
|
scroll.x = (tx + 2 * this->zoom) * TILE_SIZE;
|
|
|
scroll.y = (ty - 2 * this->zoom) * TILE_SIZE;
|
|
|
}
|
|
|
return scroll;
|
|
|
}
|
|
|
|
|
|
/** Initialize or change the zoom level.
|
|
|
/**
|
|
|
* Initialize or change the zoom level.
|
|
|
* @param change Way to change the zoom level.
|
|
|
* @param zoom_pt Position to keep fixed while zooming.
|
|
|
* @pre \c *zoom_pt should contain a point in the smallmap display when zooming in or out.
|
|
|
*/
|
|
|
void SetZoomLevel(ZoomLevelChange change, const Point *zoom_pt)
|
|
|
{
|
|
@@ -980,38 +983,42 @@ public:
|
|
|
this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECTINDUSTRIES)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
|
|
|
|
|
|
this->SetZoomLevel(ZLC_INITIALIZE, NULL);
|
|
|
this->SmallMapCenterOnCurrentPos();
|
|
|
}
|
|
|
|
|
|
/** Compute maximal required height of the legends.
|
|
|
/**
|
|
|
* Compute maximal required height of the legends.
|
|
|
* @return Maximally needed height for displaying the smallmap legends in pixels.
|
|
|
*/
|
|
|
inline uint GetMaxLegendHeight() const
|
|
|
{
|
|
|
uint num_rows = max(this->min_number_of_fixed_rows, CeilDiv(_smallmap_industry_count, this->min_number_of_columns));
|
|
|
return WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + num_rows * FONT_HEIGHT_SMALL;
|
|
|
}
|
|
|
|
|
|
/** Compute minimal required width of the legends.
|
|
|
/**
|
|
|
* Compute minimal required width of the legends.
|
|
|
* @return Minimally needed width for displaying the smallmap legends in pixels.
|
|
|
*/
|
|
|
inline uint GetMinLegendWidth() const
|
|
|
{
|
|
|
return WD_FRAMERECT_LEFT + this->min_number_of_columns * this->column_width;
|
|
|
}
|
|
|
|
|
|
/** Return number of columns that can be displayed in \a width pixels.
|
|
|
/**
|
|
|
* Return number of columns that can be displayed in \a width pixels.
|
|
|
* @return Number of columns to display.
|
|
|
*/
|
|
|
inline uint GetNumberColumnsLegend(uint width) const
|
|
|
{
|
|
|
return width / this->column_width;
|
|
|
}
|
|
|
|
|
|
/** Compute height given a width.
|
|
|
/**
|
|
|
* Compute height given a width.
|
|
|
* @return Needed height for displaying the smallmap legends in pixels.
|
|
|
*/
|
|
|
uint GetLegendHeight(uint width) const
|
|
|
{
|
|
|
uint num_columns = this->GetNumberColumnsLegend(width);
|
|
|
uint num_rows = max(this->min_number_of_fixed_rows, CeilDiv(_smallmap_industry_count, num_columns));
|