package NET.worlds.scape; import java.io.IOException; public class TwoWayPortal extends Portal { private static Object classCookie = new Object(); public TwoWayPortal(String targetRoom, float llx, float lly, float llz, float urx, float ury, float urz) { super(llx, lly, llz, urx, ury, urz); this.setFarSideInfo(null, targetRoom, null); } public TwoWayPortal() { } @Override public void saveState(Saver s) throws IOException { s.saveVersion(0, classCookie); super.saveState(s); } @Override public void restoreState(Restorer r) throws IOException, TooNewException { int vers = r.restoreVersion(classCookie); switch (vers) { case 0: super.restoreState(r); return; default: throw new TooNewException(); } } @Override public void detach() throws ClassCastException { super.detach(); Portal p = this.farSide(); if (p != null) { p.detach(); } } @Override public void reset(boolean showmessage) { super.reset(showmessage); if (this.farSideRoom() != null) { Portal p = this.farSide(); if (p != null) { if (p.isActive()) { return; } p.detach(); this.bidisconnect(); } Point3Temp left = this.getWorldPosition(); Point3Temp right = this.getFarCorner(); p = new Portal(right.x, right.y, left.z, left.x, left.y, right.z); this.farSideRoom().add(p); this.biconnect(p); } } }