aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorlbsa712007-03-27 19:12:55 +0000
committerlbsa712007-03-27 19:12:55 +0000
commitccfddd1775fe2786ad54b7bbfe528e7eb65170b1 (patch)
treee9f60b7bdb0b84917ed060159814357ea80321c4 /OpenSim.RegionServer
parent* Introduced BaseHttpServer (doing nothing at the moment) (diff)
downloadopensim-SC_OLD-ccfddd1775fe2786ad54b7bbfe528e7eb65170b1.zip
opensim-SC_OLD-ccfddd1775fe2786ad54b7bbfe528e7eb65170b1.tar.gz
opensim-SC_OLD-ccfddd1775fe2786ad54b7bbfe528e7eb65170b1.tar.bz2
opensim-SC_OLD-ccfddd1775fe2786ad54b7bbfe528e7eb65170b1.tar.xz
* Continued refactoring away OpenSimRoot - now it's down to the final 2.
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/CAPS/AdminWebFront.cs11
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs4
-rw-r--r--OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs18
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs20
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs39
-rw-r--r--OpenSim.RegionServer/world/Primitive.cs27
-rw-r--r--OpenSim.RegionServer/world/World.cs33
7 files changed, 95 insertions, 57 deletions
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index ea32589..03f8692 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -2,6 +2,7 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using OpenSim.world;
5 6
6namespace OpenSim.CAPS 7namespace OpenSim.CAPS
7{ 8{
@@ -11,9 +12,11 @@ namespace OpenSim.CAPS
11 private string NewAccountForm; 12 private string NewAccountForm;
12 private string LoginForm; 13 private string LoginForm;
13 private string passWord = "Admin"; 14 private string passWord = "Admin";
15 private World m_world;
14 16
15 public AdminWebFront(string password) 17 public AdminWebFront(string password, World world)
16 { 18 {
19 m_world = world;
17 passWord = password; 20 passWord = password;
18 LoadAdminPage(); 21 LoadAdminPage();
19 } 22 }
@@ -45,11 +48,11 @@ namespace OpenSim.CAPS
45 { 48 {
46 responseString = " <p> Listing connected Clients </p>"; 49 responseString = " <p> Listing connected Clients </p>";
47 OpenSim.world.Avatar TempAv; 50 OpenSim.world.Avatar TempAv;
48 foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) 51 foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys)
49 { 52 {
50 if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") 53 if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar")
51 { 54 {
52 TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; 55 TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID];
53 responseString += "<p>"; 56 responseString += "<p>";
54 responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()); 57 responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
55 responseString += "</p>"; 58 responseString += "</p>";
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index a24d1fb..91f8008 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -91,7 +91,7 @@ namespace OpenSim
91 91
92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString()); 92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
93 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world"); 93 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world");
94 OpenSimRoot.Instance.LocalWorld = new World(); 94 OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.LocalWorld, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg);
95 OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld(); 95 OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
96 96
97 this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); 97 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
@@ -114,7 +114,7 @@ namespace OpenSim
114 114
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); 115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
116 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort); 116 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort);
117 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin")); 117 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld));
118 118
119 timer1.Enabled = true; 119 timer1.Enabled = true;
120 timer1.Interval = 100; 120 timer1.Interval = 100;
diff --git a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
index 83e340b..eee1c3a 100644
--- a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
+++ b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
@@ -12,11 +12,15 @@ namespace OpenSim.UserServer
12{ 12{
13 class LocalUserProfileManager : UserProfileManager 13 class LocalUserProfileManager : UserProfileManager
14 { 14 {
15 private IGridServer _gridServer; 15 private IGridServer m_gridServer;
16 private int m_port;
17 private string m_ipAddr;
16 18
17 public LocalUserProfileManager(IGridServer gridServer) 19 public LocalUserProfileManager(IGridServer gridServer, int simPort, string ipAddr)
18 { 20 {
19 _gridServer = gridServer; 21 m_gridServer = gridServer;
22 m_port = simPort;
23 m_ipAddr = ipAddr;
20 } 24 }
21 25
22 public override void InitUserProfiles() 26 public override void InitUserProfiles()
@@ -29,8 +33,8 @@ namespace OpenSim.UserServer
29 uint circode = (uint)response["circuit_code"]; 33 uint circode = (uint)response["circuit_code"];
30 theUser.AddSimCircuit(circode, LLUUID.Random()); 34 theUser.AddSimCircuit(circode, LLUUID.Random());
31 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; 35 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
32 response["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort; 36 response["sim_port"] = m_port;
33 response["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr; 37 response["sim_ip"] = m_ipAddr;
34 response["region_y"] = (Int32)996 * 256; 38 response["region_y"] = (Int32)996 * 256;
35 response["region_x"] = (Int32)997* 256; 39 response["region_x"] = (Int32)997* 256;
36 40
@@ -67,9 +71,9 @@ namespace OpenSim.UserServer
67 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]); 71 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
68 72
69 //working on local computer if so lets add to the gridserver's list of sessions? 73 //working on local computer if so lets add to the gridserver's list of sessions?
70 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local") 74 if (m_gridServer.GetName() == "Local")
71 { 75 {
72 ((LocalGridBase)this._gridServer).AddNewSession(_login); 76 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
73 } 77 }
74 } 78 }
75 } 79 }
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
index 86b098a..47af8a8 100644
--- a/OpenSim.RegionServer/UserServer/LoginServer.cs
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -52,7 +52,7 @@ namespace OpenSim.UserServer
52 /// </summary> 52 /// </summary>
53 public class LoginServer : LoginService , IUserServer 53 public class LoginServer : LoginService , IUserServer
54 { 54 {
55 private IGridServer _gridServer; 55 private IGridServer m_gridServer;
56 private ushort _loginPort = 8080; 56 private ushort _loginPort = 8080;
57 public IPAddress clientAddress = IPAddress.Loopback; 57 public IPAddress clientAddress = IPAddress.Loopback;
58 public IPAddress remoteAddress = IPAddress.Any; 58 public IPAddress remoteAddress = IPAddress.Any;
@@ -63,10 +63,14 @@ namespace OpenSim.UserServer
63 private string _mpasswd; 63 private string _mpasswd;
64 private bool _needPasswd = false; 64 private bool _needPasswd = false;
65 private LocalUserProfileManager userManager; 65 private LocalUserProfileManager userManager;
66 private int m_simPort;
67 private string m_simAddr;
66 68
67 public LoginServer(IGridServer gridServer) 69 public LoginServer(IGridServer gridServer, string simAddr, int simPort)
68 { 70 {
69 _gridServer = gridServer; 71 m_gridServer = gridServer;
72 m_simPort = simPort;
73 m_simAddr = simAddr;
70 } 74 }
71 75
72 // InitializeLogin: initialize the login 76 // InitializeLogin: initialize the login
@@ -89,7 +93,7 @@ namespace OpenSim.UserServer
89 SR.Close(); 93 SR.Close();
90 this._mpasswd = EncodePassword("testpass"); 94 this._mpasswd = EncodePassword("testpass");
91 95
92 userManager = new LocalUserProfileManager(this._gridServer); 96 userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr );
93 userManager.InitUserProfiles(); 97 userManager.InitUserProfiles();
94 userManager.SetKeys("", "", "", "Welcome to OpenSim"); 98 userManager.SetKeys("", "", "", "Welcome to OpenSim");
95 99
@@ -289,8 +293,8 @@ namespace OpenSim.UserServer
289 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); 293 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
290 Hashtable responseData = (Hashtable)response.Value; 294 Hashtable responseData = (Hashtable)response.Value;
291 295
292 responseData["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort; 296 responseData["sim_port"] = m_simPort;
293 responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr; 297 responseData["sim_ip"] = m_simAddr;
294 responseData["agent_id"] = Agent.ToStringHyphenated(); 298 responseData["agent_id"] = Agent.ToStringHyphenated();
295 responseData["session_id"] = Session.ToStringHyphenated(); 299 responseData["session_id"] = Session.ToStringHyphenated();
296 responseData["secure_session_id"]= secureSess.ToStringHyphenated(); 300 responseData["secure_session_id"]= secureSess.ToStringHyphenated();
@@ -327,9 +331,9 @@ namespace OpenSim.UserServer
327 _login.InventoryFolder = InventoryFolderID; 331 _login.InventoryFolder = InventoryFolderID;
328 332
329 //working on local computer if so lets add to the gridserver's list of sessions? 333 //working on local computer if so lets add to the gridserver's list of sessions?
330 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local") 334 if (m_gridServer.GetName() == "Local")
331 { 335 {
332 ((LocalGridBase)this._gridServer).AddNewSession(_login); 336 ((LocalGridBase)m_gridServer).AddNewSession(_login);
333 } 337 }
334 338
335 // forward the XML-RPC response to the client 339 // forward the XML-RPC response to the client
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
index 75f2cff..2ae9992 100644
--- a/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -30,14 +30,23 @@ namespace OpenSim.world
30 private byte[] visualParams; 30 private byte[] visualParams;
31 private AvatarWearable[] Wearables; 31 private AvatarWearable[] Wearables;
32 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 32 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
33 private World m_world;
34 private ulong m_regionHandle;
35 private Dictionary<uint, SimClient> m_clientThreads;
36 private string m_regionName;
33 37
34 public Avatar(SimClient TheClient) 38 public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle)
35 { 39 {
40 m_world = world;
41 m_clientThreads = clientThreads;
42 m_regionName = regionName;
43 m_regionHandle = regionHandle;
44
36 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
37 ControllingClient = TheClient; 46 ControllingClient = TheClient;
38 localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); 47 localid = 8880000 + (m_world._localNumber++);
39 position = new LLVector3(100.0f, 100.0f, 30.0f); 48 position = new LLVector3(100.0f, 100.0f, 30.0f);
40 position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; 49 position.Z = m_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
41 visualParams = new byte[218]; 50 visualParams = new byte[218];
42 for (int i = 0; i < 218; i++) 51 for (int i = 0; i < 218; i++)
43 { 52 {
@@ -52,7 +61,7 @@ namespace OpenSim.world
52 this.Wearables[0].ItemID = LLUUID.Random(); 61 this.Wearables[0].ItemID = LLUUID.Random();
53 62
54 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 63 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
55 64
56 } 65 }
57 66
58 public PhysicsActor PhysActor 67 public PhysicsActor PhysActor
@@ -96,11 +105,11 @@ namespace OpenSim.world
96 //use CreateTerseBlock() 105 //use CreateTerseBlock()
97 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 106 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
98 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 107 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
99 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 108 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
100 terse.RegionData.TimeDilation = 64096; 109 terse.RegionData.TimeDilation = 64096;
101 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 110 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
102 terse.ObjectData[0] = terseBlock; 111 terse.ObjectData[0] = terseBlock;
103 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 112 foreach (SimClient client in m_clientThreads.Values)
104 { 113 {
105 client.OutPacket(terse); 114 client.OutPacket(terse);
106 } 115 }
@@ -119,11 +128,11 @@ namespace OpenSim.world
119 //It has been a while since last update was sent so lets send one. 128 //It has been a while since last update was sent so lets send one.
120 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 129 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
121 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 130 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
122 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 131 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
123 terse.RegionData.TimeDilation = 64096; 132 terse.RegionData.TimeDilation = 64096;
124 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 133 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
125 terse.ObjectData[0] = terseBlock; 134 terse.ObjectData[0] = terseBlock;
126 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 135 foreach (SimClient client in m_clientThreads.Values)
127 { 136 {
128 client.OutPacket(terse); 137 client.OutPacket(terse);
129 } 138 }
@@ -172,7 +181,7 @@ namespace OpenSim.world
172 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 181 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
173 mov.AgentData.SessionID = this.ControllingClient.SessionID; 182 mov.AgentData.SessionID = this.ControllingClient.SessionID;
174 mov.AgentData.AgentID = this.ControllingClient.AgentID; 183 mov.AgentData.AgentID = this.ControllingClient.AgentID;
175 mov.Data.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 184 mov.Data.RegionHandle = m_regionHandle;
176 // TODO - dynamicalise this stuff 185 // TODO - dynamicalise this stuff
177 mov.Data.Timestamp = 1172750370; 186 mov.Data.Timestamp = 1172750370;
178 mov.Data.Position = new LLVector3(100f, 100f, 23f); 187 mov.Data.Position = new LLVector3(100f, 100f, 23f);
@@ -187,7 +196,7 @@ namespace OpenSim.world
187 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 196 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
188 //send a objectupdate packet with information about the clients avatar 197 //send a objectupdate packet with information about the clients avatar
189 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 198 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
190 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 199 objupdate.RegionData.RegionHandle = m_regionHandle;
191 objupdate.RegionData.TimeDilation = 64096; 200 objupdate.RegionData.TimeDilation = 64096;
192 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 201 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
193 202
@@ -202,9 +211,9 @@ namespace OpenSim.world
202 byte[] pb = pos2.GetBytes(); 211 byte[] pb = pos2.GetBytes();
203 212
204 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 213 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
205 OpenSimRoot.Instance.LocalWorld._localNumber++; 214 m_world._localNumber++;
206 215
207 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 216 foreach (SimClient client in m_clientThreads.Values)
208 { 217 {
209 client.OutPacket(objupdate); 218 client.OutPacket(objupdate);
210 if (client.AgentID != ControllingClient.AgentID) 219 if (client.AgentID != ControllingClient.AgentID)
@@ -241,7 +250,7 @@ namespace OpenSim.world
241 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 250 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
242 //send a objectupdate packet with information about the clients avatar 251 //send a objectupdate packet with information about the clients avatar
243 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 252 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
244 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 253 objupdate.RegionData.RegionHandle = m_regionHandle;
245 objupdate.RegionData.TimeDilation = 64096; 254 objupdate.RegionData.TimeDilation = 64096;
246 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 255 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
247 256
@@ -293,7 +302,7 @@ namespace OpenSim.world
293 this.visualParams[i] = appear.VisualParam[i].ParamValue; 302 this.visualParams[i] = appear.VisualParam[i].ParamValue;
294 } 303 }
295 304
296 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 305 foreach (SimClient client in m_clientThreads.Values)
297 { 306 {
298 if (client.AgentID != ControllingClient.AgentID) 307 if (client.AgentID != ControllingClient.AgentID)
299 { 308 {
@@ -490,7 +499,7 @@ namespace OpenSim.world
490 handshake.RegionInfo.SimAccess = 13; 499 handshake.RegionInfo.SimAccess = 13;
491 handshake.RegionInfo.WaterHeight = 20; 500 handshake.RegionInfo.WaterHeight = 20;
492 handshake.RegionInfo.RegionFlags = 72458694; 501 handshake.RegionInfo.RegionFlags = 72458694;
493 handshake.RegionInfo.SimName = _enc.GetBytes(OpenSimRoot.Instance.Cfg.RegionName + "\0"); 502 handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0");
494 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); 503 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
495 handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); 504 handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
496 handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); 505 handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs
index 6ff66a3..a185f0b 100644
--- a/OpenSim.RegionServer/world/Primitive.cs
+++ b/OpenSim.RegionServer/world/Primitive.cs
@@ -22,6 +22,9 @@ namespace OpenSim.world
22 private PhysicsActor _physActor; 22 private PhysicsActor _physActor;
23 private bool physicsEnabled = false; 23 private bool physicsEnabled = false;
24 private bool physicstest = false; //just added for testing 24 private bool physicstest = false; //just added for testing
25 private Dictionary<uint, SimClient> m_clientThreads;
26 private ulong m_regionHandle;
27 private World m_world;
25 28
26 public bool PhysicsEnabled 29 public bool PhysicsEnabled
27 { 30 {
@@ -65,10 +68,14 @@ namespace OpenSim.world
65 } 68 }
66 } 69 }
67 70
68 public Primitive() 71 public Primitive(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world)
69 { 72 {
70 mesh_cutbegin = 0.0f; 73 mesh_cutbegin = 0.0f;
71 mesh_cutend = 1.0f; 74 mesh_cutend = 1.0f;
75
76 m_clientThreads = clientThreads;
77 m_regionHandle = regionHandle;
78 m_world = world;
72 } 79 }
73 80
74 public override Mesh getMesh() 81 public override Mesh getMesh()
@@ -99,7 +106,7 @@ namespace OpenSim.world
99 { 106 {
100 if (this.newPrimFlag) 107 if (this.newPrimFlag)
101 { 108 {
102 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 109 foreach (SimClient client in m_clientThreads.Values)
103 { 110 {
104 client.OutPacket(OurPacket); 111 client.OutPacket(OurPacket);
105 } 112 }
@@ -108,11 +115,11 @@ namespace OpenSim.world
108 else if (this.updateFlag) 115 else if (this.updateFlag)
109 { 116 {
110 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 117 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
111 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 118 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
112 terse.RegionData.TimeDilation = 64096; 119 terse.RegionData.TimeDilation = 64096;
113 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 120 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
114 terse.ObjectData[0] = this.CreateImprovedBlock(); 121 terse.ObjectData[0] = this.CreateImprovedBlock();
115 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 122 foreach (SimClient client in m_clientThreads.Values)
116 { 123 {
117 client.OutPacket(terse); 124 client.OutPacket(terse);
118 } 125 }
@@ -120,7 +127,7 @@ namespace OpenSim.world
120 } 127 }
121 else if (this.dirtyFlag) 128 else if (this.dirtyFlag)
122 { 129 {
123 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 130 foreach (SimClient client in m_clientThreads.Values)
124 { 131 {
125 UpdateClient(client); 132 UpdateClient(client);
126 } 133 }
@@ -131,11 +138,11 @@ namespace OpenSim.world
131 if (this._physActor != null && this.physicsEnabled) 138 if (this._physActor != null && this.physicsEnabled)
132 { 139 {
133 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 140 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
134 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME 141 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
135 terse.RegionData.TimeDilation = 64096; 142 terse.RegionData.TimeDilation = 64096;
136 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 143 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
137 terse.ObjectData[0] = this.CreateImprovedBlock(); 144 terse.ObjectData[0] = this.CreateImprovedBlock();
138 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 145 foreach (SimClient client in m_clientThreads.Values)
139 { 146 {
140 client.OutPacket(terse); 147 client.OutPacket(terse);
141 } 148 }
@@ -255,7 +262,7 @@ namespace OpenSim.world
255 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) 262 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
256 { 263 {
257 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 264 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
258 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 265 objupdate.RegionData.RegionHandle = m_regionHandle;
259 objupdate.RegionData.TimeDilation = 64096; 266 objupdate.RegionData.TimeDilation = 64096;
260 267
261 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 268 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
@@ -323,7 +330,7 @@ namespace OpenSim.world
323 { 330 {
324 //need to clean this up as it shares a lot of code with CreateFromPacket() 331 //need to clean this up as it shares a lot of code with CreateFromPacket()
325 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 332 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
326 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; 333 objupdate.RegionData.RegionHandle = m_regionHandle;
327 objupdate.RegionData.TimeDilation = 64096; 334 objupdate.RegionData.TimeDilation = 64096;
328 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 335 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
329 336
@@ -480,7 +487,7 @@ namespace OpenSim.world
480 this.primData.LocalID = this.localid; 487 this.primData.LocalID = this.localid;
481 this.primData.Position = this.position; 488 this.primData.Position = this.position;
482 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); 489 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
483 OpenSimRoot.Instance.LocalWorld.localStorage.StorePrim(this.primData); 490 m_world.localStorage.StorePrim(this.primData);
484 } 491 }
485 } 492 }
486 493
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index e6d8921..7605f9e 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -25,10 +25,21 @@ namespace OpenSim.world
25 private Random Rand = new Random(); 25 private Random Rand = new Random();
26 private uint _primCount = 702000; 26 private uint _primCount = 702000;
27 private int storageCount; 27 private int storageCount;
28 private Dictionary<uint, SimClient> m_clientThreads;
29 private ulong m_regionHandle;
30 private World m_world;
31 private string m_regionName;
32 private SimConfig m_cfg;
28 33
29 public World() 34 public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world, string regionName, SimConfig cfg)
30 { 35 {
31 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); 36 m_clientThreads = clientThreads;
37 m_regionHandle = regionHandle;
38 m_world = world;
39 m_regionName = regionName;
40 m_cfg = cfg;
41
42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
32 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 43 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
33 44
34 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
@@ -115,9 +126,9 @@ namespace OpenSim.world
115 HeightmapGenHills hills = new HeightmapGenHills(); 126 HeightmapGenHills hills = new HeightmapGenHills();
116 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 127 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
117 this.phyScene.SetTerrain(this.LandMap); 128 this.phyScene.SetTerrain(this.LandMap);
118 OpenSimRoot.Instance.Cfg.SaveMap(this.LandMap); 129 m_cfg.SaveMap(this.LandMap);
119 130
120 foreach(SimClient client in OpenSimRoot.Instance.ClientThreads.Values) { 131 foreach(SimClient client in m_clientThreads.Values) {
121 this.SendLayerData(client); 132 this.SendLayerData(client);
122 } 133 }
123 } 134 }
@@ -134,7 +145,7 @@ namespace OpenSim.world
134 _primCount = prim.LocalID + 1; 145 _primCount = prim.LocalID + 1;
135 } 146 }
136 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 147 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
137 Primitive nPrim = new Primitive(); 148 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, m_world);
138 nPrim.CreateFromStorage(prim); 149 nPrim.CreateFromStorage(prim);
139 this.Entities.Add(nPrim.uuid, nPrim); 150 this.Entities.Add(nPrim.uuid, nPrim);
140 } 151 }
@@ -175,7 +186,7 @@ namespace OpenSim.world
175 186
176 public void AddViewerAgent(SimClient AgentClient) { 187 public void AddViewerAgent(SimClient AgentClient) {
177 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 188 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
178 Avatar NewAvatar = new Avatar(AgentClient); 189 Avatar NewAvatar = new Avatar(AgentClient, m_world, m_regionName, m_clientThreads, m_regionHandle );
179 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 190 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
180 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 191 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
181 NewAvatar.SendRegionHandshake(this); 192 NewAvatar.SendRegionHandshake(this);
@@ -187,7 +198,7 @@ namespace OpenSim.world
187 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) 198 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
188 { 199 {
189 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 200 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
190 Primitive prim = new Primitive(); 201 Primitive prim = new Primitive(m_clientThreads, m_regionHandle, m_world );
191 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 202 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
192 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); 203 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
193 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f); 204 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
@@ -210,7 +221,7 @@ namespace OpenSim.world
210 foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData ) 221 foreach( DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData )
211 { 222 {
212 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 223 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
213 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 224 foreach (Entity ent in m_world.Entities.Values)
214 { 225 {
215 if (ent.localid == Data.ObjectLocalID) 226 if (ent.localid == Data.ObjectLocalID)
216 { 227 {
@@ -220,7 +231,7 @@ namespace OpenSim.world
220 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 231 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
221 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 232 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
222 kill.ObjectData[0].ID = ent.localid; 233 kill.ObjectData[0].ID = ent.localid;
223 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 234 foreach (SimClient client in m_clientThreads.Values)
224 { 235 {
225 client.OutPacket(kill); 236 client.OutPacket(kill);
226 } 237 }
@@ -234,9 +245,9 @@ namespace OpenSim.world
234 } 245 }
235 foreach( libsecondlife.LLUUID uuid in DeRezEnts ) 246 foreach( libsecondlife.LLUUID uuid in DeRezEnts )
236 { 247 {
237 lock (OpenSimRoot.Instance.LocalWorld.Entities) 248 lock (m_world.Entities)
238 { 249 {
239 OpenSimRoot.Instance.LocalWorld.Entities.Remove(uuid); 250 m_world.Entities.Remove(uuid);
240 } 251 }
241 } 252 }
242 253