tile-animation: let tiles.rc determine coal plant's smoke animation

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@757 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-07-20 21:34:58 +00:00
parent 1ce5080705
commit ba7ade2fa4
4 changed files with 18 additions and 14 deletions

View file

@ -761,12 +761,12 @@
# BEGIN COAL POWER #
745 coal@0,0 (conducts)
746 coal@16,0 (conducts)
747 coal@32,0 (conducts) (becomes=916)
748 coal@48,0 (conducts) (becomes=920)
747 coal@32,0 (conducts) (onpower=916)
748 coal@48,0 (conducts) (onpower=920)
749 coal@0,16 (conducts)
750 coal@16,16 (zone)(conducts)
751 coal@32,16 (conducts) (becomes=924)
752 coal@48,16 (conducts) (becomes=928)
751 coal@32,16 (conducts) (onpower=924)
752 coal@48,16 (conducts) (onpower=928)
753 coal@0,32 (conducts)
754 coal@16,32 (conducts)
755 coal@32,32 (conducts)

View file

@ -1334,16 +1334,15 @@ class MapScanner
*/
void coalSmoke()
{
final int [] SmTb = { COALSMOKE1, COALSMOKE2, COALSMOKE3, COALSMOKE4 };
final int [] dx = { 1, 2, 1, 2 };
final int [] dy = { -1, -1, 0, 0 };
for (int z = 0; z < 4; z++) {
int tile = city.getTile(xpos+dx[z], ypos+dy[z]) & LOMASK;
if (tile >= COALBASE && tile < COALBASE + 4*4) {
city.setTile(xpos + dx[z], ypos + dy[z],
(char) (SmTb[z] | PWRBIT)
);
for (int dx = -1; dx <= 2; dx++) {
for (int dy = -1; dy <= 2; dy++) {
int tile = city.getTile(xpos+dx, ypos+dy);
TileSpec ts = Tiles.get(tile & LOMASK);
if (ts != null && ts.onPower != null) {
city.setTile(xpos + dx, ypos + dy,
(char) (ts.onPower.tileNumber | (tile & ALLBITS))
);
}
}
}
}

View file

@ -6,6 +6,7 @@ public class TileSpec
{
int tileNumber;
TileSpec animNext;
TileSpec onPower;
boolean canBurn;
boolean canConduct;
boolean zone;

View file

@ -45,6 +45,10 @@ public class Tiles
if (tmp != null) {
tiles[i].animNext = get(Integer.parseInt(tmp));
}
tmp = tiles[i].getAttribute("onpower");
if (tmp != null) {
tiles[i].onPower = get(Integer.parseInt(tmp));
}
}
}