autobulldoze: fix behavior of road and rail tools
now when there's not enough money to build a rail or road, the auto-bulldoze will not have any effect git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@591 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
408d3d44bf
commit
21ecd20092
1 changed files with 16 additions and 7 deletions
|
@ -483,7 +483,6 @@ public enum MicropolisTool
|
||||||
if (!engine.testBounds(xpos, ypos))
|
if (!engine.testBounds(xpos, ypos))
|
||||||
return ToolResult.UH_OH;
|
return ToolResult.UH_OH;
|
||||||
|
|
||||||
autoDoze(engine, xpos, ypos);
|
|
||||||
ToolResult result = layRail(engine, xpos, ypos);
|
ToolResult result = layRail(engine, xpos, ypos);
|
||||||
fixZone(engine, xpos, ypos);
|
fixZone(engine, xpos, ypos);
|
||||||
return result;
|
return result;
|
||||||
|
@ -494,7 +493,6 @@ public enum MicropolisTool
|
||||||
if (!engine.testBounds(xpos, ypos))
|
if (!engine.testBounds(xpos, ypos))
|
||||||
return ToolResult.UH_OH;
|
return ToolResult.UH_OH;
|
||||||
|
|
||||||
autoDoze(engine, xpos, ypos);
|
|
||||||
ToolResult result = layRoad(engine, xpos, ypos);
|
ToolResult result = layRoad(engine, xpos, ypos);
|
||||||
fixZone(engine, xpos, ypos);
|
fixZone(engine, xpos, ypos);
|
||||||
return result;
|
return result;
|
||||||
|
@ -673,9 +671,14 @@ public enum MicropolisTool
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//TODO- check if auto-bulldoze is enabled
|
|
||||||
if (tile != DIRT) {
|
if (tile != DIRT) {
|
||||||
return ToolResult.NONE;
|
if (engine.autoBulldoze && canAutoBulldozeRRW(tile)) {
|
||||||
|
cost += 1; //autodoze cost
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// cannot do rail here
|
||||||
|
return ToolResult.NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//rail on dirt
|
//rail on dirt
|
||||||
|
@ -775,9 +778,15 @@ public enum MicropolisTool
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO- auto-bulldoze here
|
if (tile != DIRT) {
|
||||||
if (tile != DIRT)
|
if (engine.autoBulldoze && canAutoBulldozeRRW(tile)) {
|
||||||
return ToolResult.NONE;
|
cost += 1; //autodoze cost
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// cannot do road here
|
||||||
|
return ToolResult.NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// road on dirt
|
// road on dirt
|
||||||
engine.setTile(xpos, ypos, (char) (TileConstants.ROADS | BULLBIT | BURNBIT));
|
engine.setTile(xpos, ypos, (char) (TileConstants.ROADS | BULLBIT | BURNBIT));
|
||||||
|
|
Reference in a new issue