blob: aa3621e0057ee96f5d368e9c2fa04eb35daa1dcf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
package NET.worlds.scape;
import NET.worlds.network.URL;
import java.io.IOException;
import java.util.Enumeration;
public class RemotePortal extends WObject {
private static Object classCookie = new Object();
RemotePortal() {
}
@Override
public void saveState(Saver s) throws IOException {
assert false;
}
@Override
public void restoreState(Restorer r) throws IOException, TooNewException {
Portal p = new Portal();
r.replace(this, p);
int vers = r.restoreVersion(classCookie);
WObject dlRepresentation = null;
WObject initialRepresentation = null;
p.superRestoreState(r);
Point3 p1 = (Point3)r.restore();
Point3 p2 = (Point3)r.restore();
p.moveTo(p1);
p.setFarCorner(p2);
Point3 p3 = (Point3)r.restore();
Point3 p4 = (Point3)r.restore();
URL wname = URL.restore(r);
String rname = r.restoreString();
p.connectTo(wname, rname, p3, p4);
switch (vers) {
case 0:
r.setOldFlag();
r.restoreBoolean();
dlRepresentation = (WObject)r.restoreMaybeNull();
initialRepresentation = (WObject)r.restoreMaybeNull();
r.restoreMaybeNull();
break;
case 1:
dlRepresentation = (WObject)r.restoreMaybeNull();
initialRepresentation = (WObject)r.restoreMaybeNull();
break;
default:
throw new TooNewException();
}
if (initialRepresentation instanceof Surface) {
Surface s = (Surface)initialRepresentation;
Material m = s.getMaterial();
s.setMaterial(null);
p.setMaterial(m);
}
if (dlRepresentation instanceof Surface) {
Surface s = (Surface)dlRepresentation;
Material m = s.getMaterial();
s.setMaterial(null);
p.setMaterial(m);
}
if (initialRepresentation != null) {
for (Enumeration en = initialRepresentation.getHandlers(); en.hasMoreElements(); en = initialRepresentation.getHandlers()) {
SuperRoot h = (SuperRoot)en.nextElement();
initialRepresentation.removeHandler(h);
p.addHandler(h);
}
}
}
}
|