tile-names: make applyZone() work with dyn-numbered tiles

This commit is contained in:
Jason Long 2014-06-21 22:07:34 -04:00
parent a2c7d1bca0
commit 005a988d3a
2 changed files with 13 additions and 13 deletions

View file

@ -32,25 +32,25 @@ class BuildingTool extends ToolStroke
switch (tool) switch (tool)
{ {
case FIRE: case FIRE:
return applyZone(eff, FIRESTATION); return applyZone(eff, Tiles.loadByOrdinal(FIRESTATION));
case POLICE: case POLICE:
return applyZone(eff, POLICESTATION); return applyZone(eff, Tiles.loadByOrdinal(POLICESTATION));
case POWERPLANT: case POWERPLANT:
return applyZone(eff, POWERPLANT); return applyZone(eff, Tiles.loadByOrdinal(POWERPLANT));
case STADIUM: case STADIUM:
return applyZone(eff, STADIUM); return applyZone(eff, Tiles.loadByOrdinal(STADIUM));
case SEAPORT: case SEAPORT:
return applyZone(eff, PORT); return applyZone(eff, Tiles.loadByOrdinal(PORT));
case NUCLEAR: case NUCLEAR:
return applyZone(eff, NUCLEAR); return applyZone(eff, Tiles.loadByOrdinal(NUCLEAR));
case AIRPORT: case AIRPORT:
return applyZone(eff, AIRPORT); return applyZone(eff, Tiles.loadByOrdinal(AIRPORT));
default: default:
// not expected // not expected

View file

@ -69,13 +69,13 @@ public class ToolStroke
return applyParkTool(eff); return applyParkTool(eff);
case RESIDENTIAL: case RESIDENTIAL:
return applyZone(eff, RESCLR); return applyZone(eff, Tiles.loadByOrdinal(RESCLR));
case COMMERCIAL: case COMMERCIAL:
return applyZone(eff, COMCLR); return applyZone(eff, Tiles.loadByOrdinal(COMCLR));
case INDUSTRIAL: case INDUSTRIAL:
return applyZone(eff, INDCLR); return applyZone(eff, Tiles.loadByOrdinal(INDCLR));
default: default:
// not expected // not expected
@ -125,11 +125,11 @@ public class ToolStroke
return new CityLocation(xpos, ypos); return new CityLocation(xpos, ypos);
} }
boolean applyZone(ToolEffectIfc eff, int base) boolean applyZone(ToolEffectIfc eff, TileSpec base)
{ {
assert isZoneCenter(base); assert base.zone;
TileSpec.BuildingInfo bi = Tiles.get(base).getBuildingInfo(); TileSpec.BuildingInfo bi = base.getBuildingInfo();
if (bi == null) { if (bi == null) {
throw new Error("Cannot applyZone to #"+base); throw new Error("Cannot applyZone to #"+base);
} }