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;
|
private AssetCache _assetCache;
|
||||||
|
|
||||||
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName)
|
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
m_clientThreads = clientThreads;
|
m_clientThreads = clientThreads;
|
||||||
m_regionHandle = regionHandle;
|
m_regionHandle = regionHandle;
|
||||||
|
@ -68,14 +70,28 @@ namespace OpenSim.world
|
||||||
this.SetDefaultScripts();
|
this.SetDefaultScripts();
|
||||||
this.LoadScriptEngines();
|
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)
|
public void AddScript(Entity entity, Script script)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ScriptHandler scriptHandler = new ScriptHandler(script, entity, this);
|
ScriptHandler scriptHandler = new ScriptHandler(script, entity, this);
|
||||||
m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler);
|
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)
|
public void AddScript(Entity entity, string scriptData)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
int scriptstart = 0;
|
int scriptstart = 0;
|
||||||
int scriptend = 0;
|
int scriptend = 0;
|
||||||
|
@ -113,7 +129,11 @@ namespace OpenSim.world
|
||||||
//Console.WriteLine("added script");
|
//Console.WriteLine("added script");
|
||||||
this.AddScript(entity, scriptFactory());
|
this.AddScript(entity, scriptFactory());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddScript() - Failed with exception " + e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryCache InventoryCache
|
public InventoryCache InventoryCache
|
||||||
|
@ -144,6 +164,8 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (this.phyScene.IsThreaded)
|
if (this.phyScene.IsThreaded)
|
||||||
{
|
{
|
||||||
|
@ -182,8 +204,15 @@ namespace OpenSim.world
|
||||||
storageCount = 0;
|
storageCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Update() - Failed with exception " + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool LoadStorageDLL(string dllName)
|
public bool LoadStorageDLL(string dllName)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
ILocalStorage store = null;
|
ILocalStorage store = null;
|
||||||
|
@ -211,10 +240,17 @@ namespace OpenSim.world
|
||||||
this.localStorage = store;
|
this.localStorage = store;
|
||||||
return (store == null);
|
return (store == null);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Regenerate Terrain
|
#region Regenerate Terrain
|
||||||
|
|
||||||
public void RegenerateTerrain()
|
public void RegenerateTerrain()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Terrain.hills();
|
Terrain.hills();
|
||||||
|
|
||||||
|
@ -234,8 +270,15 @@ namespace OpenSim.world
|
||||||
Entities[UUID].LandRenegerated();
|
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)
|
public void RegenerateTerrain(float[,] newMap)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
this.Terrain.setHeights2D(newMap);
|
this.Terrain.setHeights2D(newMap);
|
||||||
lock (this.LockPhysicsEngine)
|
lock (this.LockPhysicsEngine)
|
||||||
|
@ -254,8 +297,15 @@ namespace OpenSim.world
|
||||||
Entities[UUID].LandRenegerated();
|
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)
|
public void RegenerateTerrain(bool changes, int pointx, int pointy)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (changes)
|
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
|
#endregion
|
||||||
|
|
||||||
public void LoadWorldMap()
|
public void LoadWorldMap()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
float[] map = this.localStorage.LoadWorld();
|
float[] map = this.localStorage.LoadWorld();
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
@ -289,14 +346,28 @@ namespace OpenSim.world
|
||||||
this.Terrain.setHeights1D(map);
|
this.Terrain.setHeights1D(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadWorldMap() - Failed with exception " + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadPrimsFromStorage()
|
public void LoadPrimsFromStorage()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
|
||||||
this.localStorage.LoadPrimitives(this);
|
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)
|
public void PrimFromStorage(PrimData prim)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (prim.LocalID >= this._primCount)
|
if (prim.LocalID >= this._primCount)
|
||||||
{
|
{
|
||||||
|
@ -307,13 +378,27 @@ namespace OpenSim.world
|
||||||
nPrim.CreateFromStorage(prim);
|
nPrim.CreateFromStorage(prim);
|
||||||
this.Entities.Add(nPrim.uuid, nPrim);
|
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()
|
public void Close()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
this.localStorage.ShutDown();
|
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)
|
public void SendLayerData(SimClient RemoteClient)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
int[] patches = new int[4];
|
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)
|
public void SendLayerData(int px, int py, SimClient RemoteClient)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
int[] patches = new int[1];
|
int[] patches = new int[1];
|
||||||
int patchx, patchy;
|
int patchx, patchy;
|
||||||
|
@ -351,8 +443,15 @@ namespace OpenSim.world
|
||||||
Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
|
Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches);
|
||||||
RemoteClient.OutPacket(layerpack);
|
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)
|
public void GetInitialPrims(SimClient RemoteClient)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
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)
|
public void AddViewerAgent(SimClient agentClient)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
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);
|
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);
|
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)
|
public void RemoveViewerAgent(SimClient agentClient)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
lock (Entities)
|
lock (Entities)
|
||||||
{
|
{
|
||||||
|
@ -401,8 +513,15 @@ namespace OpenSim.world
|
||||||
Avatars.Remove(agentClient.AgentID);
|
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)
|
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
|
||||||
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
|
Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this);
|
||||||
|
@ -420,9 +539,17 @@ namespace OpenSim.world
|
||||||
this.Entities.Add(prim.uuid, prim);
|
this.Entities.Add(prim.uuid, prim);
|
||||||
this._primCount++;
|
this._primCount++;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Failed with exception " + e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool Backup()
|
public bool Backup()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Terrain backup routines
|
||||||
if (Terrain.tainted > 0)
|
if (Terrain.tainted > 0)
|
||||||
{
|
{
|
||||||
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.");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Terrain saved, informing Physics.");
|
||||||
phyScene.SetTerrain(Terrain.getHeights1D());
|
phyScene.SetTerrain(Terrain.getHeights1D());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Primitive backup routines
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives");
|
||||||
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||||
{
|
{
|
||||||
Entities[UUID].BackUp();
|
Entities[UUID].BackUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Backup successful
|
||||||
return true;
|
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()
|
public void SetDefaultScripts()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
this.m_scripts.Add("FollowRandomAvatar", delegate()
|
this.m_scripts.Add("FollowRandomAvatar", delegate()
|
||||||
{
|
{
|
||||||
return new FollowRandomAvatar();
|
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