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/ProgressiveAdder.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/ProgressiveAdder.java')
| -rw-r--r-- | NET/worlds/scape/ProgressiveAdder.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/NET/worlds/scape/ProgressiveAdder.java b/NET/worlds/scape/ProgressiveAdder.java new file mode 100644 index 0000000..29696c2 --- /dev/null +++ b/NET/worlds/scape/ProgressiveAdder.java @@ -0,0 +1,49 @@ +package NET.worlds.scape; + +import NET.worlds.core.IniFile; +import java.util.Vector; + +public class ProgressiveAdder implements FrameHandler { + Vector addList = new Vector(); + static ProgressiveAdder theProgressiveAdder = null; + + public static ProgressiveAdder get() { + if (theProgressiveAdder == null) { + theProgressiveAdder = new ProgressiveAdder(); + } + + return theProgressiveAdder; + } + + ProgressiveAdder() { + } + + public boolean enabled() { + return IniFile.gamma().getIniInt("ProgressiveAvLoading", 0) == 1; + } + + void scheduleForAdd(WObject parent, WObject child) { + synchronized (this.addList) { + WObject[] objs = new WObject[]{parent, child}; + this.addList.addElement(objs); + } + } + + @Override + public boolean handle(FrameEvent fe) { + synchronized (this.addList) { + if (this.addList.size() > 0) { + WObject[] objs = (WObject[])this.addList.elementAt(0); + WObject parent = objs[0]; + WObject child = objs[1]; + if (!parent.discarded && !child.discarded) { + parent.add(child); + } + + this.addList.removeElementAt(0); + } + + return true; + } + } +} |