tiles.rc: use description numbers from tiles.rc rather than hardcoded numbers
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@821 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
52512c8987
commit
521a41f028
4 changed files with 9 additions and 23 deletions
|
@ -2549,7 +2549,7 @@ public class Micropolis
|
|||
public ZoneStatus queryZoneStatus(int xpos, int ypos)
|
||||
{
|
||||
ZoneStatus zs = new ZoneStatus();
|
||||
zs.building = getBuildingId(getTile(xpos, ypos));
|
||||
zs.building = getDescriptionNumber(getTile(xpos, ypos));
|
||||
|
||||
int z;
|
||||
z = (popDensity[ypos/2][xpos/2] / 64) % 4;
|
||||
|
|
|
@ -208,16 +208,6 @@ public class TileConstants
|
|||
|
||||
private TileConstants() {}
|
||||
|
||||
private static int [] buildingBases = {
|
||||
DIRT, RIVER, TREEBASE, RUBBLE,
|
||||
FLOOD, RADTILE, FIRE, ROADBASE,
|
||||
POWERBASE, RAILBASE, RESBASE, COMBASE,
|
||||
INDBASE, PORTBASE, AIRPORTBASE, COALBASE,
|
||||
FIRESTBASE, POLICESTBASE, STADIUMBASE, NUCLEARBASE,
|
||||
HBRDG0, RADAR_ANIM, FOUNTAIN, INDBASE2,
|
||||
FOOTBALLGAME1, VBRDG0, URANIUM_FUEL, LAST_TILE
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether the tile can be auto-bulldozed for
|
||||
* placement of road, rail, or wire.
|
||||
|
@ -253,14 +243,15 @@ public class TileConstants
|
|||
}
|
||||
|
||||
//used by queryZoneStatus
|
||||
public static int getBuildingId(int tile)
|
||||
public static int getDescriptionNumber(int tile)
|
||||
{
|
||||
tile &= LOMASK;
|
||||
int i = Arrays.binarySearch(buildingBases, tile);
|
||||
if (i >= 0) {
|
||||
return i;
|
||||
} else {
|
||||
return -i - 2;
|
||||
TileSpec ts = Tiles.get(tile);
|
||||
if (ts != null) {
|
||||
return ts.getDescriptionNumber();
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,11 +106,6 @@ public class Tiles
|
|||
{
|
||||
for (int i = 0; i < tiles.length; i++) {
|
||||
// do something here
|
||||
int old = TileConstants.getBuildingId(i);
|
||||
int n = Tiles.get(i).getDescriptionNumber();
|
||||
if (old != n) {
|
||||
System.err.println("Tile "+i+": expected "+old+" but got "+n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class NotificationPane extends JPanel
|
|||
headerLbl.setText(strings.getString("notification.query_hdr"));
|
||||
headerLbl.setBackground(QUERY_COLOR);
|
||||
|
||||
String buildingStr = s_strings.getString("zone."+zone.building);
|
||||
String buildingStr = zone.building != -1 ? s_strings.getString("zone."+zone.building) : "";
|
||||
String popDensityStr = s_strings.getString("status."+zone.popDensity);
|
||||
String landValueStr = s_strings.getString("status."+zone.landValue);
|
||||
String crimeLevelStr = s_strings.getString("status."+zone.crimeLevel);
|
||||
|
|
Reference in a new issue