From ac77c50ba9efb7755bd36e832a9a93fb25946a5f Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 28 Nov 2007 12:36:09 +0000 Subject: Moved the m_sceneGridService.RegisterRegion(RegionInfo); call out of LoadWorldMap and into its own public method (which is called during region creation). We shouldn't have things like that in methods like LoadWorldMap as some regions might not being having a worldmap loaded via the LoadWorldMap method (like in custom applications). Deleted the CreateTerrainTextureInitial Method which was a 99% duplicate of CreateTerrainTexture, with just a bool field setting difference. That bool is now passed to CreateTerrainTexture as a param. --- OpenSim/Region/ClientStack/ClientView.API.cs | 10 ++--- .../Region/ClientStack/RegionApplicationBase.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.cs | 51 ++++++++++------------ .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 2 +- 5 files changed, 30 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 80111d9..25d23be 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -467,13 +467,13 @@ namespace OpenSim.Region.ClientStack /// /// /// - public void SendTeleportCancel() + public void SendTeleportFailed() { - TeleportCancelPacket tpCancel = new TeleportCancelPacket(); - tpCancel.Info.SessionID = m_sessionId; - tpCancel.Info.AgentID = AgentId; + TeleportFailedPacket tpFailed = new TeleportFailedPacket(); + tpFailed.Info.AgentID = this.AgentId; + tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); - OutPacket(tpCancel, ThrottleOutPacketType.Task); + OutPacket(tpFailed, ThrottleOutPacketType.Task); } /// diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index bcd845f..7445c2e 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -113,6 +113,7 @@ namespace OpenSim.Region.ClientStack udpServer.LocalScene = scene; scene.LoadWorldMap(); + scene.RegisterRegionWithGrid(); scene.PhysScene = GetPhysicsScene(); scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ef08486..68af360 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -258,8 +258,6 @@ namespace OpenSim.Region.Environment.Scenes httpListener = httpServer; m_dumpAssetsToFile = dumpAssetsToFile; - // This function was moved to terrain for some kind of map hack by babble - RegisterRegionWithComms(); } #endregion @@ -291,6 +289,7 @@ namespace OpenSim.Region.Environment.Scenes } return true; } + public virtual void Restart(float seconds) { if (seconds < 15) @@ -312,6 +311,7 @@ namespace OpenSim.Region.Environment.Scenes } + public void restartTimer_Elapsed(object sender, ElapsedEventArgs e) { m_RestartTimerCounter++; @@ -328,6 +328,7 @@ namespace OpenSim.Region.Environment.Scenes } } + public void restartNOW() { MainLog.Instance.Error("REGION", "Closing"); @@ -335,6 +336,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Error("REGION", "Firing Region Restart Message"); base.Restart(0); } + public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) { m_restartWaitTimer.Stop(); @@ -363,6 +365,7 @@ namespace OpenSim.Region.Environment.Scenes // Reset list to nothing. m_regionRestartNotifyList = new List(); } + public override void Close() { ForEachScenePresence(delegate(ScenePresence avatar) @@ -534,7 +537,7 @@ namespace OpenSim.Region.Environment.Scenes { if (Terrain.Tainted() && !Terrain.StillEditing()) { - CreateTerrainTexture(); + CreateTerrainTexture(true); lock (Terrain.heightmap) { @@ -683,12 +686,9 @@ namespace OpenSim.Region.Environment.Scenes Terrain.SetHeights2D(map); } - CreateTerrainTextureInitial(); + CreateTerrainTexture(false); //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map - - // These two 'commands' *must be* next to each other or sim rebooting fails. - m_sceneGridService.RegisterRegion(RegionInfo); - m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); + } catch (Exception e) { @@ -696,10 +696,18 @@ namespace OpenSim.Region.Environment.Scenes } } + public void RegisterRegionWithGrid() + { + RegisterCommsEvents(); + // These two 'commands' *must be* next to each other or sim rebooting fails. + m_sceneGridService.RegisterRegion(RegionInfo); + m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); + } + /// /// /// - public void CreateTerrainTexture() + public void CreateTerrainTexture(bool temporary) { //create a texture asset of the terrain byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); @@ -710,24 +718,11 @@ namespace OpenSim.Region.Environment.Scenes asset.Name = "terrainImage"; asset.Description = RegionInfo.RegionName; asset.Type = 0; - asset.Temporary = true; + asset.Temporary = temporary; AssetCache.AddAsset(asset); } - public void CreateTerrainTextureInitial() - { - //create a texture asset of the terrain - byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); - m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); - AssetBase asset = new AssetBase(); - asset.FullID = m_regInfo.EstateSettings.terrainImageID; - asset.Data = data; - asset.Name = "terrainImage"; - asset.Description = RegionInfo.RegionName; - asset.Type = 0; - asset.Temporary = false; - AssetCache.AddAsset(asset); - } + #endregion #region Primitives Methods @@ -1117,7 +1112,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void RegisterRegionWithComms() + public void RegisterCommsEvents() { // Don't register here. babblefro moved registration to *after *the map // functions on line 675 so that a proper map will generate and get sent to grid services @@ -1129,11 +1124,9 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.OnCloseAgentConnection += CloseConnection; m_sceneGridService.OnRegionUp += OtherRegionUp; - m_sceneGridService.KillObject = SendKillObject; - - // Tell Other regions that I'm here. - + m_sceneGridService.KillObject = SendKillObject; } + public void UnRegisterReginWithComms() { m_sceneGridService.OnRegionUp -= OtherRegionUp; diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 550b232..56316e6 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -255,7 +255,7 @@ namespace SimpleApp { } - public virtual void SendTeleportCancel() + public virtual void SendTeleportFailed() { } diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 389ba47..535d519 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -63,7 +63,7 @@ namespace SimpleApp } Terrain.GetHeights1D(map); - CreateTerrainTexture(); + CreateTerrainTexture(true); } public override void AddNewClient(IClientAPI client, bool child) -- cgit v1.1