This repository has been archived on 2025-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
citylimitsj/src/micropolisj/engine/TileBehavior.java
jason@long.name a8713b682e api: getTile() now returns masked tile number
use getTileRaw() to get the raw tile number

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@897 d9718cc8-9f43-0410-858b-315f434eb58c
2013-12-06 16:02:02 +00:00

42 lines
972 B
Java

// This file is part of MicropolisJ.
// Copyright (C) 2013 Jason Long
// Portions Copyright (C) 1989-2007 Electronic Arts Inc.
//
// MicropolisJ is free software; you can redistribute it and/or modify
// it under the terms of the GNU GPLv3, with additional terms.
// See the README file, included in this distribution, for details.
package micropolisj.engine;
import java.util.Random;
import static micropolisj.engine.TileConstants.*;
public abstract class TileBehavior
{
protected final Micropolis city;
protected final Random PRNG;
int xpos;
int ypos;
int tile;
int rawTile;
protected TileBehavior(Micropolis city)
{
this.city = city;
this.PRNG = city.PRNG;
}
public final void processTile(int xpos, int ypos)
{
this.xpos = xpos;
this.ypos = ypos;
this.rawTile = city.getTileRaw(xpos, ypos);
this.tile = rawTile & LOMASK;
apply();
}
/**
* Activate the tile identified by xpos and ypos properties.
*/
public abstract void apply();
}