overlay-map: remove upper tile number limit
also- refactor a for-loop into a separate method to avoid having code indented too far git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@911 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
145c1ae944
commit
84d8906a88
1 changed files with 16 additions and 11 deletions
|
@ -316,7 +316,7 @@ public class OverlayMapView extends JComponent
|
||||||
{
|
{
|
||||||
for (int x = minX; x < maxX; x++)
|
for (int x = minX; x < maxX; x++)
|
||||||
{
|
{
|
||||||
int tile = engine.getTile(x,y) & LOMASK;
|
int tile = engine.getTile(x,y);
|
||||||
switch (mapState) {
|
switch (mapState) {
|
||||||
case RESIDENTIAL:
|
case RESIDENTIAL:
|
||||||
if (isZoneAny(tile) &&
|
if (isZoneAny(tile) &&
|
||||||
|
@ -367,16 +367,7 @@ public class OverlayMapView extends JComponent
|
||||||
// in the checkPower function
|
// in the checkPower function
|
||||||
|
|
||||||
if (tile != -1) {
|
if (tile != -1) {
|
||||||
if (tile >= 0 && tile <= LAST_TILE) {
|
paintTile(img, x, y, tile);
|
||||||
for (int yy = 0; yy < TILE_HEIGHT; yy++)
|
|
||||||
{
|
|
||||||
for (int xx = 0; xx < TILE_WIDTH; xx++)
|
|
||||||
{
|
|
||||||
img.setRGB(x*TILE_WIDTH+xx,y*TILE_HEIGHT+yy,
|
|
||||||
tileArrayImage.getRGB(xx,tile*TILE_OFFSET_Y+yy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,6 +407,20 @@ public class OverlayMapView extends JComponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void paintTile(BufferedImage img, int x, int y, int tile)
|
||||||
|
{
|
||||||
|
assert tile >= 0;
|
||||||
|
|
||||||
|
for (int yy = 0; yy < TILE_HEIGHT; yy++)
|
||||||
|
{
|
||||||
|
for (int xx = 0; xx < TILE_WIDTH; xx++)
|
||||||
|
{
|
||||||
|
img.setRGB(x*TILE_WIDTH+xx,y*TILE_HEIGHT+yy,
|
||||||
|
tileArrayImage.getRGB(xx,tile*TILE_OFFSET_Y+yy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle getViewRect(ConnectedView cv)
|
Rectangle getViewRect(ConnectedView cv)
|
||||||
{
|
{
|
||||||
Rectangle rawRect = cv.scrollPane.getViewport().getViewRect();
|
Rectangle rawRect = cv.scrollPane.getViewport().getViewRect();
|
||||||
|
|
Reference in a new issue