/* CVS: $Id: SquareChangedEvt.java,v 1.9 2001/03/18 19:16:33 gvijf Exp $ */ package evolution.events; import evolution.World; import evolution.Human; import evolution.lands.SquareOfLand; /** * Event fired when a square changed. */ public class SquareChangedEvt extends Event { /** * Create a new square changed event. * @param square The square that changed. */ public SquareChangedEvt(SquareOfLand square) { sq = square; } /** * Return the square of land which changed. */ public SquareOfLand getSquare() { return sq; } /** * Return the x coordinate. */ public int getX() { return sq.getX(); } /** * Return the y coordinate. */ public int getY() { return sq.getY(); } /** * Return the state of the land on this square, * null if the landtype is yet unknown. */ public String getLandState() { return sq.getLandState(); } /** * Return the state of the construction on this square, * null if there is no construction. */ public String getConstructionState() { if(sq.getConstruction() == null) return null; return sq.getConstruction().getState(); } /** * Return the state of the human on this square, * null if there is no human. */ public String getHumanState() { if(sq.getHuman() == null) return null; return sq.getHuman().getState(); } /** * Return the energybufferstate of the human, that was standing on * the square that changed. */ public String getHumanEnergyBufferState() { if(sq.getHuman() == null) return null; return sq.getHuman().getEnergyBufferState(); } /** * Is this square selected? * e.g. for drawing a special border so the player can recognize this * visually */ public boolean isSelected() { if(sq.getHuman() == null) return false; return World.getInst().isSelected(sq.getHuman()); } /** * Is this square the active selection? * e.g. for drawing a special border so the player can recognize this * visually */ public boolean isActive() { if(sq.getHuman() == null) return false; return World.getInst().isActiveSelected(sq.getHuman()); } /** * The square of land which changed. */ private SquareOfLand sq; }