Added exception handling to each function in World.cs - code is assumed stable so MSVC debugging of this code should no longer be needed. If however, it is needed, put a breakpoint on the exception handler concerned.
parent
855122add1
commit
c6b1dd0fac
|
@ -44,6 +44,8 @@ namespace OpenSim.world
|
|||
private AssetCache _assetCache;
|
||||
|
||||
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_clientThreads = clientThreads;
|
||||
m_regionHandle = regionHandle;
|
||||
|
@ -68,14 +70,28 @@ namespace OpenSim.world
|
|||
this.SetDefaultScripts();
|
||||
this.LoadScriptEngines();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Constructor failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddScript(Entity entity, Script script)
|
||||
{
|
||||
try
|
||||
{
|
||||
ScriptHandler scriptHandler = new ScriptHandler(script, entity, this);
|
||||
m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddScript() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddScript(Entity entity, string scriptData)
|
||||
{
|
||||
try
|
||||
{
|
||||
int scriptstart = 0;
|
||||
int scriptend = 0;
|
||||
|
@ -113,7 +129,11 @@ namespace OpenSim.world
|
|||
//Console.WriteLine("added script");
|
||||
this.AddScript(entity, scriptFactory());
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddScript() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryCache InventoryCache
|
||||
|
@ -144,6 +164,8 @@ namespace OpenSim.world
|
|||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.phyScene.IsThreaded)
|
||||
{
|
||||
|
@ -182,8 +204,15 @@ namespace OpenSim.world
|
|||
storageCount = 0;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Update() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoadStorageDLL(string dllName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
ILocalStorage store = null;
|
||||
|
@ -211,10 +240,17 @@ namespace OpenSim.world
|
|||
this.localStorage = store;
|
||||
return (store == null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#region Regenerate Terrain
|
||||
|
||||
public void RegenerateTerrain()
|
||||
{
|
||||
try
|
||||
{
|
||||
Terrain.hills();
|
||||
|
||||
|
@ -234,8 +270,15 @@ namespace OpenSim.world
|
|||
Entities[UUID].LandRenegerated();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void RegenerateTerrain(float[,] newMap)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Terrain.setHeights2D(newMap);
|
||||
lock (this.LockPhysicsEngine)
|
||||
|
@ -254,8 +297,15 @@ namespace OpenSim.world
|
|||
Entities[UUID].LandRenegerated();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void RegenerateTerrain(bool changes, int pointx, int pointy)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (changes)
|
||||
{
|
||||
|
@ -271,10 +321,17 @@ namespace OpenSim.world
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LoadWorldMap()
|
||||
{
|
||||
try
|
||||
{
|
||||
float[] map = this.localStorage.LoadWorld();
|
||||
if (map == null)
|
||||
|
@ -289,14 +346,28 @@ namespace OpenSim.world
|
|||
this.Terrain.setHeights1D(map);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadWorldMap() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadPrimsFromStorage()
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
|
||||
this.localStorage.LoadPrimitives(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void PrimFromStorage(PrimData prim)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (prim.LocalID >= this._primCount)
|
||||
{
|
||||
|
@ -307,13 +378,27 @@ namespace OpenSim.world
|
|||
nPrim.CreateFromStorage(prim);
|
||||
this.Entities.Add(nPrim.uuid, nPrim);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.localStorage.ShutDown();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Close() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void SendLayerData(SimClient RemoteClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
int[] patches = new int[4];
|
||||
|
||||
|
@ -331,8 +416,15 @@ namespace OpenSim.world
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: SendLayerData() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void SendLayerData(int px, int py, SimClient RemoteClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
int[] patches = new int[1];
|
||||
int patchx, patchy;
|
||||
|
@ -351,8 +443,15 @@ namespace OpenSim.world
|
|||
Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
|
||||
RemoteClient.OutPacket(layerpack);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: SendLayerData() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void GetInitialPrims(SimClient RemoteClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||
{
|
||||
|
@ -363,8 +462,15 @@ namespace OpenSim.world
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: GetInitialPrims() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddViewerAgent(SimClient agentClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
||||
Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle);
|
||||
|
@ -387,10 +493,16 @@ namespace OpenSim.world
|
|||
{
|
||||
this.Avatars.Add(agentClient.AgentID, newAvatar);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddViewerAgent() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveViewerAgent(SimClient agentClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (Entities)
|
||||
{
|
||||
|
@ -401,8 +513,15 @@ namespace OpenSim.world
|
|||
Avatars.Remove(agentClient.AgentID);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
||||
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
|
||||
|
@ -420,9 +539,17 @@ namespace OpenSim.world
|
|||
this.Entities.Add(prim.uuid, prim);
|
||||
this._primCount++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool Backup()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Terrain backup routines
|
||||
if (Terrain.tainted > 0)
|
||||
{
|
||||
Terrain.tainted = 0;
|
||||
|
@ -431,21 +558,39 @@ namespace OpenSim.world
|
|||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Terrain saved, informing Physics.");
|
||||
phyScene.SetTerrain(Terrain.getHeights1D());
|
||||
}
|
||||
|
||||
// Primitive backup routines
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives");
|
||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||
{
|
||||
Entities[UUID].BackUp();
|
||||
}
|
||||
|
||||
// Backup successful
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Backup failed
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backup Failed with exception " + e.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDefaultScripts()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.m_scripts.Add("FollowRandomAvatar", delegate()
|
||||
{
|
||||
return new FollowRandomAvatar();
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: SetDefaultScripts() - Failed with exception " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue