Fix minimap crash
This commit is contained in:
parent
859cb31f5d
commit
cb7f855fd8
|
@ -95,10 +95,8 @@ void Minimap::clean()
|
||||||
|
|
||||||
void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scale)
|
void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scale)
|
||||||
{
|
{
|
||||||
if(screenRect.isEmpty())
|
if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition())
|
||||||
return;
|
return ;
|
||||||
if(MMBLOCK_SIZE*scale <= 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
|
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
|
||||||
g_painter->saveState();
|
g_painter->saveState();
|
||||||
|
@ -142,9 +140,7 @@ void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scal
|
||||||
|
|
||||||
Point Minimap::getPoint(const Position& pos, const Rect& screenRect, const Position& mapCenter, float scale)
|
Point Minimap::getPoint(const Position& pos, const Rect& screenRect, const Position& mapCenter, float scale)
|
||||||
{
|
{
|
||||||
if(screenRect.isEmpty())
|
if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition())
|
||||||
return Point(-1,-1);
|
|
||||||
if(MMBLOCK_SIZE*scale <= 1)
|
|
||||||
return Point(-1,-1);
|
return Point(-1,-1);
|
||||||
|
|
||||||
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
|
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
|
||||||
|
@ -155,9 +151,7 @@ Point Minimap::getPoint(const Position& pos, const Rect& screenRect, const Posit
|
||||||
|
|
||||||
Position Minimap::getPosition(const Point& point, const Rect& screenRect, const Position& mapCenter, float scale)
|
Position Minimap::getPosition(const Point& point, const Rect& screenRect, const Position& mapCenter, float scale)
|
||||||
{
|
{
|
||||||
if(screenRect.isEmpty())
|
if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition())
|
||||||
return Position();
|
|
||||||
if(MMBLOCK_SIZE*scale <= 1)
|
|
||||||
return Position();
|
return Position();
|
||||||
|
|
||||||
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
|
Rect mapRect = calcMapRect(screenRect, mapCenter, scale);
|
||||||
|
|
Loading…
Reference in New Issue