aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.World
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.World')
-rw-r--r--OpenSim/OpenSim.World/Avatar.cs31
-rw-r--r--OpenSim/OpenSim.World/Estate/EstateManager.cs23
-rw-r--r--OpenSim/OpenSim.World/ParcelManager.cs51
-rw-r--r--OpenSim/OpenSim.World/World.cs21
4 files changed, 54 insertions, 72 deletions
diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs
index 6a4c0f8..c251d57 100644
--- a/OpenSim/OpenSim.World/Avatar.cs
+++ b/OpenSim/OpenSim.World/Avatar.cs
@@ -175,38 +175,7 @@ namespace OpenSim.world
175 /// </summary> 175 /// </summary>
176 public void SendRegionHandshake() 176 public void SendRegionHandshake()
177 { 177 {
178 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
179 RegionHandshakePacket handshake = new RegionHandshakePacket();
180 178
181 handshake.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor;
182 handshake.RegionInfo.IsEstateManager = false;
183 handshake.RegionInfo.TerrainHeightRange00 = m_regInfo.estateSettings.terrainHeightRange0;
184 handshake.RegionInfo.TerrainHeightRange01 = m_regInfo.estateSettings.terrainHeightRange1;
185 handshake.RegionInfo.TerrainHeightRange10 = m_regInfo.estateSettings.terrainHeightRange2;
186 handshake.RegionInfo.TerrainHeightRange11 = m_regInfo.estateSettings.terrainHeightRange3;
187 handshake.RegionInfo.TerrainStartHeight00 = m_regInfo.estateSettings.terrainStartHeight0;
188 handshake.RegionInfo.TerrainStartHeight01 = m_regInfo.estateSettings.terrainStartHeight1;
189 handshake.RegionInfo.TerrainStartHeight10 = m_regInfo.estateSettings.terrainStartHeight2;
190 handshake.RegionInfo.TerrainStartHeight11 = m_regInfo.estateSettings.terrainStartHeight3;
191 handshake.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
192 handshake.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight;
193
194
195 handshake.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
196
197 handshake.RegionInfo.SimName = _enc.GetBytes(m_regInfo.estateSettings.waterHeight + "\0");
198 handshake.RegionInfo.SimOwner = m_regInfo.MasterAvatarAssignedUUID;
199 handshake.RegionInfo.TerrainBase0 = m_regInfo.estateSettings.terrainBase0;
200 handshake.RegionInfo.TerrainBase1 = m_regInfo.estateSettings.terrainBase1;
201 handshake.RegionInfo.TerrainBase2 = m_regInfo.estateSettings.terrainBase2;
202 handshake.RegionInfo.TerrainBase3 = m_regInfo.estateSettings.terrainBase3;
203 handshake.RegionInfo.TerrainDetail0 = m_regInfo.estateSettings.terrainDetail0;
204 handshake.RegionInfo.TerrainDetail1 = m_regInfo.estateSettings.terrainDetail1;
205 handshake.RegionInfo.TerrainDetail2 = m_regInfo.estateSettings.terrainDetail2;
206 handshake.RegionInfo.TerrainDetail3 = m_regInfo.estateSettings.terrainDetail3;
207 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
208
209 this.ControllingClient.OutPacket(handshake);
210 } 179 }
211 180
212 /// <summary> 181 /// <summary>
diff --git a/OpenSim/OpenSim.World/Estate/EstateManager.cs b/OpenSim/OpenSim.World/Estate/EstateManager.cs
index 85d9b0c..c94587a 100644
--- a/OpenSim/OpenSim.World/Estate/EstateManager.cs
+++ b/OpenSim/OpenSim.World/Estate/EstateManager.cs
@@ -217,18 +217,22 @@ namespace OpenSim.world.Estate
217 217
218 public void sendRegionInfoPacketToAll() 218 public void sendRegionInfoPacketToAll()
219 { 219 {
220 foreach (OpenSim.world.Avatar av in m_world.Avatars.Values) 220 List<Avatar> avatars = m_world.RequestAvatarList();
221 { 221
222 this.sendRegionInfoPacket(av.ControllingClient); 222 for (int i = 0; i < avatars.Count; i++)
223 } 223 {
224 this.sendRegionInfoPacket(avatars[i].ControllingClient);
225 }
224 } 226 }
225 227
226 public void sendRegionHandshakeToAll() 228 public void sendRegionHandshakeToAll()
227 { 229 {
228 foreach (OpenSim.world.Avatar av in m_world.Avatars.Values) 230 List<Avatar> avatars = m_world.RequestAvatarList();
231
232 for (int i = 0; i < avatars.Count; i++)
229 { 233 {
230 av.SendRegionHandshake(); 234 this.sendRegionHandshake(avatars[i].ControllingClient);
231 } 235 }
232 } 236 }
233 237
234 public void sendRegionInfoPacket(IClientAPI remote_client) 238 public void sendRegionInfoPacket(IClientAPI remote_client)
@@ -259,5 +263,10 @@ namespace OpenSim.world.Estate
259 remote_client.OutPacket(regionInfoPacket); 263 remote_client.OutPacket(regionInfoPacket);
260 } 264 }
261 265
266 public void sendRegionHandshake(IClientAPI remoteClient)
267 {
268 remoteClient.SendRegionHandshake(m_regInfo);
269 }
270
262 } 271 }
263} 272}
diff --git a/OpenSim/OpenSim.World/ParcelManager.cs b/OpenSim/OpenSim.World/ParcelManager.cs
index 4a9bfb1..db6909d 100644
--- a/OpenSim/OpenSim.World/ParcelManager.cs
+++ b/OpenSim/OpenSim.World/ParcelManager.cs
@@ -35,7 +35,7 @@ using OpenSim.Framework.Types;
35 35
36namespace OpenSim.world 36namespace OpenSim.world
37{ 37{
38 38
39 39
40 #region ParcelManager Class 40 #region ParcelManager Class
41 /// <summary> 41 /// <summary>
@@ -62,7 +62,7 @@ namespace OpenSim.world
62 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 62 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
63 63
64 //RequestResults (I think these are right, they seem to work): 64 //RequestResults (I think these are right, they seem to work):
65 public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel 65 public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
66 public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel 66 public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel
67 67
68 //These are other constants. Yay! 68 //These are other constants. Yay!
@@ -143,7 +143,7 @@ namespace OpenSim.world
143 } 143 }
144 parcelList[lastParcelLocalID].forceUpdateParcelInfo(); 144 parcelList[lastParcelLocalID].forceUpdateParcelInfo();
145 145
146 146
147 } 147 }
148 /// <summary> 148 /// <summary>
149 /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList 149 /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList
@@ -258,12 +258,12 @@ namespace OpenSim.world
258 int startParcelIndex = startParcel.parcelData.localID; 258 int startParcelIndex = startParcel.parcelData.localID;
259 parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); 259 parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false));
260 parcelList[startParcelIndex].forceUpdateParcelInfo(); 260 parcelList[startParcelIndex].forceUpdateParcelInfo();
261 261
262 262
263 //Now add the new parcel 263 //Now add the new parcel
264 addParcel(newParcel); 264 addParcel(newParcel);
265 265
266 266
267 267
268 268
269 269
@@ -282,7 +282,7 @@ namespace OpenSim.world
282 { 282 {
283 end_x -= 4; 283 end_x -= 4;
284 end_y -= 4; 284 end_y -= 4;
285 285
286 //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! 286 //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box!
287 //This should be fixed later -- somewhat "incomplete code" --Ming 287 //This should be fixed later -- somewhat "incomplete code" --Ming
288 Parcel startParcel, endParcel; 288 Parcel startParcel, endParcel;
@@ -456,7 +456,7 @@ namespace OpenSim.world
456 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) 456 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
457 { 457 {
458 join(west, south, east, north, remote_client.AgentId); 458 join(west, south, east, north, remote_client.AgentId);
459 459
460 } 460 }
461 #endregion 461 #endregion
462 462
@@ -543,7 +543,7 @@ namespace OpenSim.world
543 //Place all new variables here! 543 //Place all new variables here!
544 newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); 544 newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone());
545 newParcel.parcelData = parcelData.Copy(); 545 newParcel.parcelData = parcelData.Copy();
546 546
547 return newParcel; 547 return newParcel;
548 } 548 }
549 549
@@ -565,7 +565,7 @@ namespace OpenSim.world
565 updatePacket.ParcelData.AABBMin = parcelData.AABBMin; 565 updatePacket.ParcelData.AABBMin = parcelData.AABBMin;
566 updatePacket.ParcelData.Area = parcelData.area; 566 updatePacket.ParcelData.Area = parcelData.area;
567 updatePacket.ParcelData.AuctionID = parcelData.auctionID; 567 updatePacket.ParcelData.AuctionID = parcelData.auctionID;
568 updatePacket.ParcelData.AuthBuyerID =parcelData.authBuyerID; //unemplemented 568 updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented
569 569
570 updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; 570 updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray;
571 571
@@ -606,7 +606,7 @@ namespace OpenSim.world
606 updatePacket.ParcelData.SequenceID = sequence_id; 606 updatePacket.ParcelData.SequenceID = sequence_id;
607 updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented 607 updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented
608 updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented 608 updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented
609 updatePacket.ParcelData.SnapSelection = snap_selection; 609 updatePacket.ParcelData.SnapSelection = snap_selection;
610 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; 610 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
611 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; 611 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
612 updatePacket.ParcelData.TotalPrims = 0; //unemplemented 612 updatePacket.ParcelData.TotalPrims = 0; //unemplemented
@@ -638,14 +638,17 @@ namespace OpenSim.world
638 parcelData.userLocation = packet.ParcelData.UserLocation; 638 parcelData.userLocation = packet.ParcelData.UserLocation;
639 parcelData.userLookAt = packet.ParcelData.UserLookAt; 639 parcelData.userLookAt = packet.ParcelData.UserLookAt;
640 640
641 foreach (Avatar av in m_world.Avatars.Values) 641 List<Avatar> avatars = m_world.RequestAvatarList();
642
643 for (int i = 0; i < avatars.Count; i++)
642 { 644 {
643 Parcel over = m_world.parcelManager.getParcel((int)Math.Round(av.Pos.X), (int)Math.Round(av.Pos.Y)); 645 Parcel over = m_world.parcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
644 if (over == this) 646 if (over == this)
645 { 647 {
646 sendParcelProperties(0, false, 0, av.ControllingClient); 648 sendParcelProperties(0, false, 0, avatars[i].ControllingClient);
647 } 649 }
648 } 650 }
651
649 } 652 }
650 } 653 }
651 #endregion 654 #endregion
@@ -720,7 +723,7 @@ namespace OpenSim.world
720 //Valid: Lets set it 723 //Valid: Lets set it
721 parcelBitmap = bitmap; 724 parcelBitmap = bitmap;
722 forceUpdateParcelInfo(); 725 forceUpdateParcelInfo();
723 726
724 } 727 }
725 } 728 }
726 /// <summary> 729 /// <summary>
@@ -761,23 +764,23 @@ namespace OpenSim.world
761 private bool[,] convertBytesToParcelBitmap() 764 private bool[,] convertBytesToParcelBitmap()
762 { 765 {
763 bool[,] tempConvertMap = new bool[64, 64]; 766 bool[,] tempConvertMap = new bool[64, 64];
764 tempConvertMap.Initialize(); 767 tempConvertMap.Initialize();
765 byte tempByte = 0; 768 byte tempByte = 0;
766 int x = 0, y = 0, i = 0, bitNum = 0; 769 int x = 0, y = 0, i = 0, bitNum = 0;
767 for(i = 0; i < 512; i++) 770 for (i = 0; i < 512; i++)
768 { 771 {
769 tempByte = parcelData.parcelBitmapByteArray[i]; 772 tempByte = parcelData.parcelBitmapByteArray[i];
770 for(bitNum = 0; bitNum < 8; bitNum++) 773 for (bitNum = 0; bitNum < 8; bitNum++)
771 { 774 {
772 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); 775 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
773 tempConvertMap[x, y] = bit; 776 tempConvertMap[x, y] = bit;
774 x++; 777 x++;
775 if(x > 63) 778 if (x > 63)
776 { 779 {
777 x = 0; 780 x = 0;
778 y++; 781 y++;
779 } 782 }
780 783
781 } 784 }
782 785
783 } 786 }
@@ -859,7 +862,7 @@ namespace OpenSim.world
859 { 862 {
860 //Throw an exception - The bitmap is not 64x64 863 //Throw an exception - The bitmap is not 64x64
861 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); 864 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps");
862 865
863 } 866 }
864 867
865 int x, y; 868 int x, y;
@@ -879,9 +882,9 @@ namespace OpenSim.world
879 882
880 #endregion 883 #endregion
881 884
882 885
883 } 886 }
884 #endregion 887 #endregion
885 888
886 889
887} 890}
diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs
index dc9602e..3e74501 100644
--- a/OpenSim/OpenSim.World/World.cs
+++ b/OpenSim/OpenSim.World/World.cs
@@ -24,9 +24,8 @@ namespace OpenSim.world
24 { 24 {
25 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); 25 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
26 public object LockPhysicsEngine = new object(); 26 public object LockPhysicsEngine = new object();
27 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars; 27 protected Dictionary<libsecondlife.LLUUID, Avatar> Avatars;
28 public Dictionary<libsecondlife.LLUUID, Primitive> Prims; 28 protected Dictionary<libsecondlife.LLUUID, Primitive> Prims;
29 //public ScriptEngine Scripts;
30 public uint _localNumber = 0; 29 public uint _localNumber = 0;
31 private PhysicsScene phyScene; 30 private PhysicsScene phyScene;
32 private float timeStep = 0.1f; 31 private float timeStep = 0.1f;
@@ -83,8 +82,8 @@ namespace OpenSim.world
83 this.m_datastore = m_regInfo.DataStore; 82 this.m_datastore = m_regInfo.DataStore;
84 this.RegisterRegionWithComms(); 83 this.RegisterRegionWithComms();
85 84
86 parcelManager = new ParcelManager(this,this.m_regInfo); 85 parcelManager = new ParcelManager(this, this.m_regInfo);
87 estateManager = new EstateManager(this,this.m_regInfo); 86 estateManager = new EstateManager(this, this.m_regInfo);
88 87
89 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); 88 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
90 m_scripts = new Dictionary<string, ScriptFactory>(); 89 m_scripts = new Dictionary<string, ScriptFactory>();
@@ -476,10 +475,12 @@ namespace OpenSim.world
476 try 475 try
477 { 476 {
478 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 477 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
479 newAvatar = new Avatar(remoteClient, this, m_clientThreads,this.m_regInfo); 478 newAvatar = new Avatar(remoteClient, this, m_clientThreads, this.m_regInfo);
480 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world"); 479 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world");
481 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake "); 480 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake ");
482 newAvatar.SendRegionHandshake(); 481
482 //newAvatar.SendRegionHandshake();
483 this.estateManager.sendRegionHandshake(remoteClient);
483 484
484 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 485 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
485 lock (this.LockPhysicsEngine) 486 lock (this.LockPhysicsEngine)
@@ -522,7 +523,7 @@ namespace OpenSim.world
522 /// </summary> 523 /// </summary>
523 protected void InformClientOfNeighbours(IClientAPI remoteClient) 524 protected void InformClientOfNeighbours(IClientAPI remoteClient)
524 { 525 {
525 // Console.WriteLine("informing client of neighbouring regions"); 526 // Console.WriteLine("informing client of neighbouring regions");
526 List<RegionInfo> neighbours = this.commsManager.RequestNeighbours(this.m_regInfo); 527 List<RegionInfo> neighbours = this.commsManager.RequestNeighbours(this.m_regInfo);
527 528
528 //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); 529 //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
@@ -530,7 +531,7 @@ namespace OpenSim.world
530 { 531 {
531 for (int i = 0; i < neighbours.Count; i++) 532 for (int i = 0; i < neighbours.Count; i++)
532 { 533 {
533 // Console.WriteLine("sending neighbours data"); 534 // Console.WriteLine("sending neighbours data");
534 AgentCircuitData agent = remoteClient.RequestClientInfo(); 535 AgentCircuitData agent = remoteClient.RequestClientInfo();
535 agent.BaseFolder = LLUUID.Zero; 536 agent.BaseFolder = LLUUID.Zero;
536 agent.InventoryFolder = LLUUID.Zero; 537 agent.InventoryFolder = LLUUID.Zero;
@@ -556,7 +557,7 @@ namespace OpenSim.world
556 // ie it could be all Avatars within a certain range of the calling prim/avatar. 557 // ie it could be all Avatars within a certain range of the calling prim/avatar.
557 558
558 /// <summary> 559 /// <summary>
559 /// 560 /// Request a List of all Avatars in this World
560 /// </summary> 561 /// </summary>
561 /// <returns></returns> 562 /// <returns></returns>
562 public List<Avatar> RequestAvatarList() 563 public List<Avatar> RequestAvatarList()