api: provide isTilePowered() to check whether a given location has power
instead of requiring front-end to test for PWRBIT git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@888 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
a47ceac844
commit
58ffb6c73b
2 changed files with 6 additions and 1 deletions
|
@ -428,6 +428,11 @@ public class Micropolis
|
||||||
return map[ypos][xpos];
|
return map[ypos][xpos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTilePowered(int xpos, int ypos)
|
||||||
|
{
|
||||||
|
return (getTile(xpos, ypos) & PWRBIT) == PWRBIT;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTile(int xpos, int ypos, char newTile)
|
public void setTile(int xpos, int ypos, char newTile)
|
||||||
{
|
{
|
||||||
if (map[ypos][xpos] != newTile)
|
if (map[ypos][xpos] != newTile)
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class MicropolisDrawingArea extends JComponent
|
||||||
int cell = m.getTile(x,y);
|
int cell = m.getTile(x,y);
|
||||||
if (blinkUnpoweredZones &&
|
if (blinkUnpoweredZones &&
|
||||||
isZoneCenter(cell) &&
|
isZoneCenter(cell) &&
|
||||||
(cell & PWRBIT) == 0)
|
!m.isTilePowered(x, y))
|
||||||
{
|
{
|
||||||
unpoweredZones.add(new Point(x,y));
|
unpoweredZones.add(new Point(x,y));
|
||||||
if (blink)
|
if (blink)
|
||||||
|
|
Reference in a new issue