tile-names: let building be defined by named tiles
This commit is contained in:
parent
c3fde70ddc
commit
d3009d1b9f
1 changed files with 21 additions and 7 deletions
|
@ -80,14 +80,28 @@ public class TileSpec
|
|||
bi.height = Integer.parseInt(p2[1]);
|
||||
|
||||
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; }
|
||||
if (this.isNumberedTile()) {
|
||||
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] = tileMap.get(Integer.toString(startTile));
|
||||
startTile++;
|
||||
for (int row = 0; row < bi.height; row++) {
|
||||
for (int col = 0; col < bi.width; col++) {
|
||||
bi.members[row*bi.width+col] = tileMap.get(Integer.toString(startTile));
|
||||
startTile++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
int mcol = bi.width >= 3 ? -1 : 0;
|
||||
int mrow = bi.height >= 3 ? -1 : 0;
|
||||
for (int row = 0; row < bi.height; row++) {
|
||||
for (int col = 0; col < bi.width; col++) {
|
||||
String n = this.name + (
|
||||
(row + mrow == 0 && col + mcol == 0) ? "" :
|
||||
("@"+(col+mcol)+","+(row+mrow)));
|
||||
bi.members[row*bi.width+col] = tileMap.get(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue