Avoid rare cases of mini-map producing a divide-by-zero error (bug #25155)
This commit is contained in:
parent
807f8d2144
commit
4600614f6d
2 changed files with 3 additions and 2 deletions
|
@ -181,6 +181,7 @@ Version 1.13.5+dev:
|
|||
* Add tip to recall units instead of recruiting them if costs exceed 20 gold (recruitment costs)
|
||||
* Resolve sides in map editor not having a proper side number and subsequently
|
||||
causing a crash upon editing (bug #25093)
|
||||
* Avoid rare cases of mini-map producing a divide-by-zero error (bug #25155)
|
||||
|
||||
Version 1.13.5:
|
||||
* Campaigns:
|
||||
|
|
|
@ -707,8 +707,8 @@ map_location display::minimap_location_on(int x, int y)
|
|||
// probably more adjustments to do (border, minimap shift...)
|
||||
// but the mouse and human capacity to evaluate the rectangle center
|
||||
// is not pixel precise.
|
||||
int px = (x - minimap_location_.x) * get_map().w()*hex_width() / minimap_location_.w;
|
||||
int py = (y - minimap_location_.y) * get_map().h()*hex_size() / minimap_location_.h;
|
||||
int px = (x - minimap_location_.x) * get_map().w()*hex_width() / std::max (minimap_location_.w, 1);
|
||||
int py = (y - minimap_location_.y) * get_map().h()*hex_size() / std::max(minimap_location_.h, 1);
|
||||
|
||||
map_location loc = pixel_position_to_hex(px, py);
|
||||
if (loc.x < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue