diff --git a/OpenSim/Data/MySQL/Resources/GridStore.migrations b/OpenSim/Data/MySQL/Resources/GridStore.migrations index eda6dbb2a3..98ba8c5604 100644 --- a/OpenSim/Data/MySQL/Resources/GridStore.migrations +++ b/OpenSim/Data/MySQL/Resources/GridStore.migrations @@ -94,3 +94,12 @@ BEGIN; alter table regions modify column regionName varchar(128) default NULL; COMMIT; + +:VERSION 9 # ------------ + +BEGIN; + +alter table regions add column `parcelMapTexture` varchar(36) default NULL; + +COMMIT; + diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index eac2743b20..ac95598048 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); + MapBlockFromGridRegion(block, r, 0); mapBlocks.Add(block); } avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); @@ -955,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { List response = new List(); - // this should return one mapblock at most. - // (diva note: why?? in that case we should GetRegionByPosition) + // this should return one mapblock at most. It is triggered by a click + // on an unloaded square. // But make sure: Look whether the one we requested is in there List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, minX * (int)Constants.RegionSize, @@ -973,7 +973,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { // found it => add it to response MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); + MapBlockFromGridRegion(block, r, flag); response.Add(block); break; } @@ -989,10 +989,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap block.Access = 254; // means 'simulator is offline' response.Add(block); } - if ((flag & 2) == 2) // V2 !!! - remoteClient.SendMapBlock(response, 2); - else - remoteClient.SendMapBlock(response, 0); + // The lower 16 bits are an unsigned int16 + remoteClient.SendMapBlock(response, flag & 0xffff); } else { @@ -1012,21 +1010,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); + MapBlockFromGridRegion(block, r, flag); mapBlocks.Add(block); } - if ((flag & 2) == 2) // V2 !!! - remoteClient.SendMapBlock(mapBlocks, 2); - else - remoteClient.SendMapBlock(mapBlocks, 0); + remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); return mapBlocks; } - protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) + protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) { block.Access = r.Access; - block.MapImageId = r.TerrainImage; + switch (flag & 0xffff) + { + case 0: + block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; + break; + case 2: + block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; + break; + default: + block.MapImageId = UUID.Zero; + break; + } block.Name = r.RegionName; block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); @@ -1160,7 +1166,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { MapBlockData mapBlock = new MapBlockData(); - MapBlockFromGridRegion(mapBlock, r); + MapBlockFromGridRegion(mapBlock, r, 0); AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); if (texAsset != null) @@ -1342,6 +1348,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); UUID terrainImageID = UUID.Random(); + UUID parcelImageID = UUID.Zero; // UUID.Random(); AssetBase asset = new AssetBase( terrainImageID, @@ -1358,13 +1365,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.AssetService.Store(asset); // Switch to the new one - UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; + UUID lastTerrainImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; + UUID lastParcelImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; + m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; m_scene.RegionInfo.RegionSettings.Save(); // Delete the old one - m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastMapRegionUUID); - m_scene.AssetService.Delete(lastMapRegionUUID.ToString()); + // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); + m_scene.AssetService.Delete(lastTerrainImageID.ToString()); + m_scene.AssetService.Delete(lastParcelImageID.ToString()); } private void MakeRootAgent(ScenePresence avatar) diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 7137f9ac71..d80999649f 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -190,6 +190,7 @@ namespace OpenSim.Services.Interfaces public UUID ScopeID = UUID.Zero; public UUID TerrainImage = UUID.Zero; + public UUID ParcelImage = UUID.Zero; public byte Access; public int Maturity; public string RegionSecret = string.Empty; @@ -236,6 +237,7 @@ namespace OpenSim.Services.Interfaces RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; + ParcelImage = ConvertFrom.RegionSettings.ParcelImageID; Access = ConvertFrom.AccessLevel; Maturity = ConvertFrom.RegionSettings.Maturity; RegionSecret = ConvertFrom.regionSecret; @@ -253,6 +255,7 @@ namespace OpenSim.Services.Interfaces RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.TerrainImage; + ParcelImage = ConvertFrom.ParcelImage; Access = ConvertFrom.Access; Maturity = ConvertFrom.Maturity; RegionSecret = ConvertFrom.RegionSecret; @@ -281,7 +284,7 @@ namespace OpenSim.Services.Interfaces public override int GetHashCode() { - return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); + return RegionID.GetHashCode() ^ TerrainImage.GetHashCode() ^ ParcelImage.GetHashCode(); } #endregion @@ -359,6 +362,7 @@ namespace OpenSim.Services.Interfaces kvp["serverURI"] = ServerURI; kvp["serverPort"] = InternalEndPoint.Port.ToString(); kvp["regionMapTexture"] = TerrainImage.ToString(); + kvp["parcelMapTexture"] = ParcelImage.ToString(); kvp["access"] = Access.ToString(); kvp["regionSecret"] = RegionSecret; kvp["owner_uuid"] = EstateOwner.ToString(); @@ -411,6 +415,9 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("regionMapTexture")) UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); + if (kvp.ContainsKey("parcelMapTexture")) + UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); + if (kvp.ContainsKey("access")) Access = Byte.Parse((string)kvp["access"]);