From 63d7a92fb4a1a513ae539d9bf42c67fc22abcf90 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Sat, 4 Oct 2008 18:08:35 +0000 Subject: Added immediate TP failure message for TPs to regions that aren't there, instead of the 130s timeout somewhere. Additionally, mark the map-tile as offline. This partly fixes the TP problems of Mantis 2332; the rest is a viewer problem (just relogin). --- .../Modules/World/WorldMap/WorldMapModule.cs | 38 ++++++++++++++++++++-- .../Scenes/SceneCommunicationService.cs | 19 +++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs index 9dbe225..bc62e07 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs @@ -248,8 +248,42 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) { List mapBlocks; - mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4); - remoteClient.SendMapBlock(mapBlocks, flag); + if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible + { + List response = new List(); + + // this should return one mapblock at most. But make sure: Look whether the one we requested is in there + mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); + if (mapBlocks != null) + { + foreach (MapBlockData block in mapBlocks) + { + if (block.X == minX && block.Y == minY) + { + // found it => add it to response + response.Add(block); + break; + } + } + } + + if (response.Count == 0) + { + // response still empty => couldn't find the map-tile the user clicked on => tell the client + MapBlockData block = new MapBlockData(); + block.X = (ushort)minX; + block.Y = (ushort)minY; + block.Access = 254; // == not there + response.Add(block); + } + remoteClient.SendMapBlock(response, 0); + } + else + { + // normal mapblock request. Use the provided values + mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); + remoteClient.SendMapBlock(mapBlocks, flag); + } } public Hashtable OnHTTPGetMapImage(Hashtable keysvals) diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 08793d9..b342cb6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -736,6 +736,25 @@ namespace OpenSim.Region.Environment.Scenes avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); } } + else + { + // TP to a place that doesn't exist (anymore) + // Inform the viewer about that + avatar.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); + + // and set the map-tile to '(Offline)' + uint regX, regY; + Helpers.LongToUInts(regionHandle, out regX, out regY); + + MapBlockData block = new MapBlockData(); + block.X = (ushort)(regX / Constants.RegionSize); + block.Y = (ushort)(regY / Constants.RegionSize); + block.Access = 254; // == not there + + List blocks = new List(); + blocks.Add(block); + avatar.ControllingClient.SendMapBlock(blocks, 0); + } } } -- cgit v1.1