diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/SetZoomMode.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/SetZoomMode.java')
| -rw-r--r-- | NET/worlds/scape/SetZoomMode.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/NET/worlds/scape/SetZoomMode.java b/NET/worlds/scape/SetZoomMode.java new file mode 100644 index 0000000..739f2ac --- /dev/null +++ b/NET/worlds/scape/SetZoomMode.java @@ -0,0 +1,61 @@ +package NET.worlds.scape; + +import NET.worlds.console.Window; +import java.io.IOException; +import java.util.Enumeration; + +public class SetZoomMode extends Action implements MomentumBehavior { + private boolean zoomMode; + private static Object classCookie = new Object(); + + public SetZoomMode(boolean on) { + this.zoomMode = on; + } + + public SetZoomMode() { + } + + @Override + public Persister trigger(Event e, Persister seqID) { + SuperRoot owner = this.getOwner(); + if (owner != null && owner instanceof Pilot && ((Pilot)owner).isActive()) { + Window w = Window.getMainWindow(); + if (w == null) { + return null; + } else { + w.setDeltaMode(this.zoomMode); + return null; + } + } else { + return null; + } + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(0, classCookie); + super.saveState(s); + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + switch (r.restoreVersion(classCookie)) { + case 0: + super.restoreState(r); + return; + default: + throw new TooNewException(); + } + } + + @Override + public void transferFrom(Enumeration oldMBs) { + while (oldMBs.hasMoreElements()) { + SuperRoot sr = (SuperRoot)oldMBs.nextElement(); + if (sr instanceof SetZoomMode) { + this.zoomMode = ((SetZoomMode)sr).zoomMode; + break; + } + } + } +} |