tile-names: BuildingInfo: allow dyn-numbered tiles
This commit is contained in:
parent
f136a3f4f4
commit
d0fbfd92a2
4 changed files with 12 additions and 12 deletions
|
@ -170,7 +170,7 @@ class MapScanner extends TileBehavior
|
|||
{
|
||||
for (int x = xorg; x < xorg+bi.width; x++)
|
||||
{
|
||||
city.setTile(x, y, (char) bi.members[i]);
|
||||
city.setTile(x, y, (char) bi.members[i].tileNumber);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ class MapScanner extends TileBehavior
|
|||
int xx = xorg + x;
|
||||
int yy = yorg + y;
|
||||
|
||||
TileSpec ts = Tiles.get(bi.members[i]);
|
||||
TileSpec ts = bi.members[i];
|
||||
if (powerOn && ts.onPower != null) {
|
||||
ts = ts.onPower;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TileSpec
|
|||
{
|
||||
int width;
|
||||
int height;
|
||||
short [] members;
|
||||
TileSpec [] members;
|
||||
}
|
||||
|
||||
public BuildingInfo getBuildingInfo()
|
||||
|
@ -79,14 +79,14 @@ public class TileSpec
|
|||
bi.width = Integer.parseInt(p2[0]);
|
||||
bi.height = Integer.parseInt(p2[1]);
|
||||
|
||||
bi.members = new short[bi.width*bi.height];
|
||||
int startTile = tileNumber;
|
||||
bi.members = new TileSpec[bi.width*bi.height];
|
||||
int startTile = Integer.parseInt(name);
|
||||
if (bi.width >= 3) { startTile--; }
|
||||
if (bi.height >= 3) { startTile -= bi.width; }
|
||||
|
||||
for (int row = 0; row < bi.height; row++) {
|
||||
for (int col = 0; col < bi.width; col++) {
|
||||
bi.members[row*bi.width+col] = (short)startTile;
|
||||
bi.members[row*bi.width+col] = tileMap.get(Integer.toString(startTile));
|
||||
startTile++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,17 +64,17 @@ public class Tiles
|
|||
TileSpec.BuildingInfo bi = tiles[i].getBuildingInfo();
|
||||
if (bi != null) {
|
||||
for (int j = 0; j < bi.members.length; j++) {
|
||||
int tid = bi.members[j];
|
||||
TileSpec memberTile = bi.members[j];
|
||||
int offx = (bi.width >= 3 ? -1 : 0) + j % bi.width;
|
||||
int offy = (bi.height >= 3 ? -1 : 0) + j / bi.width;
|
||||
|
||||
if (tiles[tid].owner == null &&
|
||||
if (memberTile.owner == null &&
|
||||
(offx != 0 || offy != 0)
|
||||
)
|
||||
{
|
||||
tiles[tid].owner = tiles[i];
|
||||
tiles[tid].ownerOffsetX = offx;
|
||||
tiles[tid].ownerOffsetY = offy;
|
||||
memberTile.owner = tiles[i];
|
||||
memberTile.ownerOffsetX = offx;
|
||||
memberTile.ownerOffsetY = offy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class ToolStroke
|
|||
{
|
||||
for (int columnNum = 0; columnNum < bi.width; columnNum++)
|
||||
{
|
||||
eff.setTile(columnNum, rowNum, (char) bi.members[i]);
|
||||
eff.setTile(columnNum, rowNum, (char) bi.members[i].tileNumber);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue