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:
jason@long.name 2013-12-03 01:04:22 +00:00
parent a47ceac844
commit 58ffb6c73b
2 changed files with 6 additions and 1 deletions

View file

@ -428,6 +428,11 @@ public class Micropolis
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)
{
if (map[ypos][xpos] != newTile)

View file

@ -182,7 +182,7 @@ public class MicropolisDrawingArea extends JComponent
int cell = m.getTile(x,y);
if (blinkUnpoweredZones &&
isZoneCenter(cell) &&
(cell & PWRBIT) == 0)
!m.isTilePowered(x, y))
{
unpoweredZones.add(new Point(x,y));
if (blink)