query tool: check bounds before attempting query
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@575 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
5219c6f1be
commit
b1a1dea224
2 changed files with 4 additions and 1 deletions
|
@ -431,7 +431,7 @@ public class Micropolis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean testBounds(int xpos, int ypos)
|
final public boolean testBounds(int xpos, int ypos)
|
||||||
{
|
{
|
||||||
return xpos >= 0 && xpos < getWidth() &&
|
return xpos >= 0 && xpos < getWidth() &&
|
||||||
ypos >= 0 && ypos < getHeight();
|
ypos >= 0 && ypos < getHeight();
|
||||||
|
|
|
@ -898,6 +898,9 @@ public class MainWindow extends JFrame
|
||||||
|
|
||||||
void doQueryTool(int xpos, int ypos)
|
void doQueryTool(int xpos, int ypos)
|
||||||
{
|
{
|
||||||
|
if (!engine.testBounds(xpos, ypos))
|
||||||
|
return;
|
||||||
|
|
||||||
ZoneStatus z = engine.queryZoneStatus(xpos, ypos);
|
ZoneStatus z = engine.queryZoneStatus(xpos, ypos);
|
||||||
notificationPane.showZoneStatus(engine, xpos, ypos, z);
|
notificationPane.showZoneStatus(engine, xpos, ypos, z);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue