buildings: for component tiles, link back to the owner tile
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@811 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
3941b35fa4
commit
7069c8150c
3 changed files with 20 additions and 0 deletions
|
@ -11,6 +11,9 @@ public class TileSpec
|
||||||
boolean canBurn;
|
boolean canBurn;
|
||||||
boolean canConduct;
|
boolean canConduct;
|
||||||
boolean zone;
|
boolean zone;
|
||||||
|
public TileSpec owner;
|
||||||
|
public int ownerOffsetX;
|
||||||
|
public int ownerOffsetY;
|
||||||
|
|
||||||
Map<String,String> attributes;
|
Map<String,String> attributes;
|
||||||
List<String> images;
|
List<String> images;
|
||||||
|
|
|
@ -53,6 +53,16 @@ public class Tiles
|
||||||
if (tmp != null) {
|
if (tmp != null) {
|
||||||
tiles[i].onShutdown = get(Integer.parseInt(tmp));
|
tiles[i].onShutdown = get(Integer.parseInt(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TileSpec.BuildingInfo bi = tiles[i].getBuildingInfo();
|
||||||
|
if (bi != null) {
|
||||||
|
for (int j = 0; j < bi.members.length; j++) {
|
||||||
|
int tid = bi.members[j];
|
||||||
|
tiles[tid].owner = tiles[i];
|
||||||
|
tiles[tid].ownerOffsetX = (bi.width >= 3 ? -1 : 0) + j % bi.width;
|
||||||
|
tiles[tid].ownerOffsetY = (bi.height >= 3 ? -1 : 0) + j / bi.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1093,6 +1093,13 @@ public class MainWindow extends JFrame
|
||||||
|
|
||||||
ZoneStatus z = engine.queryZoneStatus(xpos, ypos);
|
ZoneStatus z = engine.queryZoneStatus(xpos, ypos);
|
||||||
notificationPane.showZoneStatus(engine, xpos, ypos, z);
|
notificationPane.showZoneStatus(engine, xpos, ypos, z);
|
||||||
|
|
||||||
|
TileSpec ts = Tiles.get(engine.getTile(xpos, ypos) & TileConstants.LOMASK);
|
||||||
|
if (ts != null) {
|
||||||
|
System.out.println("owner: "+ts.owner);
|
||||||
|
System.out.println(" x: "+ts.ownerOffsetX);
|
||||||
|
System.out.println(" y: "+ts.ownerOffsetY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doZoom(int dir, Point mousePt)
|
private void doZoom(int dir, Point mousePt)
|
||||||
|
|
Reference in a new issue