diff options
author | MW | 2007-05-26 14:34:57 +0000 |
---|---|---|
committer | MW | 2007-05-26 14:34:57 +0000 |
commit | c3a40b7d42276f152d8f4f6a7a3ad4eca3c6d7a8 (patch) | |
tree | c5de8198621ecacf0798ff84aa00208c6f51a78f /OpenSim/OpenSim.RegionServer/ClientView.Grid.cs | |
parent | Die Avatar class, and you to Primitive class! (diff) | |
download | opensim-SC-c3a40b7d42276f152d8f4f6a7a3ad4eca3c6d7a8.zip opensim-SC-c3a40b7d42276f152d8f4f6a7a3ad4eca3c6d7a8.tar.gz opensim-SC-c3a40b7d42276f152d8f4f6a7a3ad4eca3c6d7a8.tar.bz2 opensim-SC-c3a40b7d42276f152d8f4f6a7a3ad4eca3c6d7a8.tar.xz |
Die WebFrontEnd, Die Grid class!
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/ClientView.Grid.cs')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView.Grid.cs | 138 |
1 files changed, 2 insertions, 136 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs index 1121839..b4e4b5f 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs | |||
@@ -23,145 +23,11 @@ namespace OpenSim | |||
23 | 23 | ||
24 | public void EnableNeighbours() | 24 | public void EnableNeighbours() |
25 | { | 25 | { |
26 | if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child)) | 26 | |
27 | { | ||
28 | Hashtable SimParams; | ||
29 | ArrayList SendParams; | ||
30 | XmlRpcRequest GridReq; | ||
31 | XmlRpcResponse GridResp; | ||
32 | List<Packet> enablePackets = new List<Packet>(); | ||
33 | |||
34 | RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer; | ||
35 | |||
36 | foreach (Hashtable neighbour in gridServer.neighbours) | ||
37 | { | ||
38 | try | ||
39 | { | ||
40 | string neighbourIPStr = (string)neighbour["sim_ip"]; | ||
41 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr); | ||
42 | ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]); | ||
43 | string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString(); | ||
44 | |||
45 | Console.WriteLine(reqUrl); | ||
46 | |||
47 | SimParams = new Hashtable(); | ||
48 | SimParams["session_id"] = this.SessionID.ToString(); | ||
49 | SimParams["secure_session_id"] = this.SecureSessionID.ToString(); | ||
50 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
51 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
52 | SimParams["agent_id"] = this.AgentID.ToString(); | ||
53 | SimParams["circuit_code"] = (Int32)this.CircuitCode; | ||
54 | SimParams["child_agent"] = "1"; | ||
55 | SendParams = new ArrayList(); | ||
56 | SendParams.Add(SimParams); | ||
57 | |||
58 | GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
59 | GridResp = GridReq.Send(reqUrl, 3000); | ||
60 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
61 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
62 | enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); | ||
63 | |||
64 | |||
65 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
66 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
67 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
68 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
69 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
70 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
71 | enablePackets.Add(enablesimpacket); | ||
72 | } | ||
73 | catch (Exception e) | ||
74 | { | ||
75 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing."); | ||
76 | } | ||
77 | } | ||
78 | Thread.Sleep(3000); | ||
79 | foreach (Packet enable in enablePackets) | ||
80 | { | ||
81 | this.OutPacket(enable); | ||
82 | } | ||
83 | enablePackets.Clear(); | ||
84 | |||
85 | } | ||
86 | } | 27 | } |
87 | 28 | ||
88 | public void CrossSimBorder(LLVector3 avatarpos) | 29 | public void CrossSimBorder(LLVector3 avatarpos) |
89 | { // VERY VERY BASIC | 30 | { |
90 | |||
91 | LLVector3 newpos = avatarpos; | ||
92 | uint neighbourx = this.m_regionData.RegionLocX; | ||
93 | uint neighboury = this.m_regionData.RegionLocY; | ||
94 | |||
95 | if (avatarpos.X < 0) | ||
96 | { | ||
97 | neighbourx -= 1; | ||
98 | newpos.X = 254; | ||
99 | } | ||
100 | if (avatarpos.X > 255) | ||
101 | { | ||
102 | neighbourx += 1; | ||
103 | newpos.X = 1; | ||
104 | } | ||
105 | if (avatarpos.Y < 0) | ||
106 | { | ||
107 | neighboury -= 1; | ||
108 | newpos.Y = 254; | ||
109 | } | ||
110 | if (avatarpos.Y > 255) | ||
111 | { | ||
112 | neighboury += 1; | ||
113 | newpos.Y = 1; | ||
114 | } | ||
115 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); | ||
116 | |||
117 | Hashtable SimParams; | ||
118 | ArrayList SendParams; | ||
119 | XmlRpcRequest GridReq; | ||
120 | XmlRpcResponse GridResp; | ||
121 | foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) | ||
122 | { | ||
123 | if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) | ||
124 | { | ||
125 | Console.WriteLine("found the neighbouring sim"); | ||
126 | SimParams = new Hashtable(); | ||
127 | SimParams["firstname"] = this.ClientAvatar.firstname; | ||
128 | SimParams["lastname"] = this.ClientAvatar.lastname; | ||
129 | SimParams["circuit_code"] = this.CircuitCode.ToString(); | ||
130 | SimParams["pos_x"] = newpos.X.ToString(); | ||
131 | SimParams["pos_y"] = newpos.Y.ToString(); | ||
132 | SimParams["pos_z"] = newpos.Z.ToString(); | ||
133 | SendParams = new ArrayList(); | ||
134 | SendParams.Add(SimParams); | ||
135 | |||
136 | GridReq = new XmlRpcRequest("agent_crossing", SendParams); | ||
137 | GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); | ||
138 | |||
139 | CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); | ||
140 | NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | ||
141 | NewSimPack.AgentData.AgentID = this.AgentID; | ||
142 | NewSimPack.AgentData.SessionID = this.SessionID; | ||
143 | NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); | ||
144 | NewSimPack.Info.Position = newpos; | ||
145 | NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | ||
146 | NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); | ||
147 | NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); | ||
148 | System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); | ||
149 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
150 | NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | ||
151 | NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | ||
152 | NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | ||
153 | NewSimPack.RegionData.SimIP += (uint)byteIP[0]; | ||
154 | NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); | ||
155 | NewSimPack.RegionData.SeedCapability = new byte[0]; | ||
156 | this.OutPacket(NewSimPack); | ||
157 | this.DowngradeClient(); | ||
158 | /* lock (PacketQueue) | ||
159 | { | ||
160 | ProcessOutPacket(NewSimPack); | ||
161 | DowngradeClient(); | ||
162 | }*/ | ||
163 | } | ||
164 | } | ||
165 | } | 31 | } |
166 | } | 32 | } |
167 | } | 33 | } |