Fixed crash in minimap code
This commit is contained in:
@@ -1313,9 +1313,7 @@ void SmallMapWindow::SwitchMapType(SmallMapType map_type)
|
|||||||
inline uint SmallMapWindow::GetNumberRowsLegend(uint columns) const
|
inline uint SmallMapWindow::GetNumberRowsLegend(uint columns) const
|
||||||
{
|
{
|
||||||
/* Reserve one column for link colours */
|
/* Reserve one column for link colours */
|
||||||
uint num_rows_linkstats = CeilDiv(_smallmap_cargo_count, columns - 1);
|
return this->min_number_of_fixed_rows;
|
||||||
uint num_rows_others = CeilDiv(max(_smallmap_industry_count, _smallmap_company_count), columns);
|
|
||||||
return max(this->min_number_of_fixed_rows, max(num_rows_linkstats, num_rows_others));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1377,7 +1375,6 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
|
|||||||
uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / this->row_height;
|
uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / this->row_height;
|
||||||
uint columns = this->GetNumberColumnsLegend(wi->current_x);
|
uint columns = this->GetNumberColumnsLegend(wi->current_x);
|
||||||
uint number_of_rows = this->GetNumberRowsLegend(columns);
|
uint number_of_rows = this->GetNumberRowsLegend(columns);
|
||||||
number_of_rows = this->min_number_of_fixed_rows;
|
|
||||||
if (line >= number_of_rows) return -1;
|
if (line >= number_of_rows) return -1;
|
||||||
|
|
||||||
bool rtl = _current_text_dir == TD_RTL;
|
bool rtl = _current_text_dir == TD_RTL;
|
||||||
|
|||||||
Reference in New Issue
Block a user