Methapolis  0.27
 All Classes Namespaces Files Functions Variables Enumerator
TileBehavior.java
Go to the documentation of this file.
1 // This file is part of MicropolisJ.
2 // Copyright (C) 2013 Jason Long
3 // Portions Copyright (C) 1989-2007 Electronic Arts Inc.
4 //
5 // MicropolisJ is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU GPLv3, with additional terms.
7 // See the README file, included in this distribution, for details.
8 
9 package micropolisj.engine;
10 
11 import java.util.Random;
12 import static micropolisj.engine.TileConstants.*;
13 
14 public abstract class TileBehavior {
15  protected final Micropolis city;
16  protected final Random PRNG;
17  int xpos;
18  int ypos;
19  int tile;
20  int rawTile;
21 
22 
24  this.city = city;
25  this.PRNG = city.PRNG;
26  }
27 
28  public final void processTile(int xpos, int ypos) {
29  this.xpos = xpos;
30  this.ypos = ypos;
31  this.rawTile = city.getTileRaw(xpos, ypos);
32  this.tile = rawTile & LOMASK;
33  apply();
34  }
35 
39  public abstract void apply();
40 }