/* Spielplan.java * * Copyright (c) 2002, Marc Schiereck * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Marc Schiereck */ package org.gzigzag; import java.util.*; public class Spielplan { public static final String rcsid = "$Id: Spielplan.java,v 1.1.2.1 2002/10/31 17:05:20 benja Exp $"; ZZCell startCell; ZZCell window; public Spielplan(ZZCell s, ZZCell w) { startCell = s; window = w; } public ZZCell getPosition() { return ZZCursorReal.get(window); } public void setPosition(ZZCell c) { ZZCursorReal.set(window, c); } public boolean hasBox(ZZCell c) { if (c.s("d.kiste", 1) != null) { return true; } else { return false; } } public void moveBox(ZZCell v, ZZCell n) { ZZCell temp = v.s("d.kiste",1); v.disconnect("d.kiste",1); n.connect("d.kiste",1,temp); } public List getLagerplaetze() { List lagerplatzListe = new ArrayList(); ZZCell cur = startCell.s("d.lagerplaetze",1); while(cur != null) { lagerplatzListe.add(cur); cur = cur.s("d.lagerplaetze",1); } return lagerplatzListe; } public boolean hasLagerplatz(ZZCell c) { // >oo< //if(startCell == null) { return c.s("d.lagerplaetze", -1) != null; /*} ZZCell cur = startCell.s("d.lagerplaetze",1); while(cur != null) { if (c.equals(cur)) return true; cur = cur.s("d.lagerplaetze",1); } return false;*/ } }