toolstroke: do not pick random numbers when generating a tool preview
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@647 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
59c5547e87
commit
47fdf7c3c2
2 changed files with 11 additions and 4 deletions
|
@ -100,8 +100,8 @@ class Bulldozer extends ToolStroke
|
|||
continue;
|
||||
tile = tile & LOMASK;
|
||||
if (tile != RADTILE && tile != DIRT) {
|
||||
int nTile = (TINYEXP + city.PRNG.nextInt(3))
|
||||
| ANIMBIT | BULLBIT;
|
||||
int z = inPreview ? 0 : city.PRNG.nextInt(3);
|
||||
int nTile = (TINYEXP + z) | ANIMBIT | BULLBIT;
|
||||
eff.setTile(xx, yy, nTile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public class ToolStroke
|
|||
int ypos;
|
||||
int xdest;
|
||||
int ydest;
|
||||
boolean inPreview;
|
||||
|
||||
ToolStroke(Micropolis city, MicropolisTool tool, int xpos, int ypos)
|
||||
{
|
||||
|
@ -33,7 +34,13 @@ public class ToolStroke
|
|||
public final ToolPreview getPreview()
|
||||
{
|
||||
ToolEffect eff = new ToolEffect(city);
|
||||
applyArea(eff);
|
||||
inPreview = true;
|
||||
try {
|
||||
applyArea(eff);
|
||||
}
|
||||
finally {
|
||||
inPreview = false;
|
||||
}
|
||||
return eff.preview;
|
||||
}
|
||||
|
||||
|
@ -232,7 +239,7 @@ public class ToolStroke
|
|||
}
|
||||
}
|
||||
|
||||
int z = city.PRNG.nextInt(5);
|
||||
int z = inPreview ? 0 : city.PRNG.nextInt(5);
|
||||
int tile;
|
||||
if (z < 4) {
|
||||
tile = (WOODS2 + z) | BURNBIT | BULLBIT;
|
||||
|
|
Reference in a new issue