Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

iar_mods
Justin Clark-Casey (justincc) 2012-01-30 21:34:40 +00:00
commit dbc039783b
3 changed files with 46 additions and 20 deletions

View File

@ -94,3 +94,12 @@ BEGIN;
alter table regions modify column regionName varchar(128) default NULL; alter table regions modify column regionName varchar(128) default NULL;
COMMIT; COMMIT;
:VERSION 9 # ------------
BEGIN;
alter table regions add column `parcelMapTexture` varchar(36) default NULL;
COMMIT;

View File

@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
foreach (GridRegion r in regions) foreach (GridRegion r in regions)
{ {
MapBlockData block = new MapBlockData(); MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r); MapBlockFromGridRegion(block, r, 0);
mapBlocks.Add(block); mapBlocks.Add(block);
} }
avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
@ -955,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
List<MapBlockData> response = new List<MapBlockData>(); List<MapBlockData> response = new List<MapBlockData>();
// this should return one mapblock at most. // this should return one mapblock at most. It is triggered by a click
// (diva note: why?? in that case we should GetRegionByPosition) // on an unloaded square.
// But make sure: Look whether the one we requested is in there // But make sure: Look whether the one we requested is in there
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
minX * (int)Constants.RegionSize, minX * (int)Constants.RegionSize,
@ -973,7 +973,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
// found it => add it to response // found it => add it to response
MapBlockData block = new MapBlockData(); MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r); MapBlockFromGridRegion(block, r, flag);
response.Add(block); response.Add(block);
break; break;
} }
@ -989,10 +989,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
block.Access = 254; // means 'simulator is offline' block.Access = 254; // means 'simulator is offline'
response.Add(block); response.Add(block);
} }
if ((flag & 2) == 2) // V2 !!! // The lower 16 bits are an unsigned int16
remoteClient.SendMapBlock(response, 2); remoteClient.SendMapBlock(response, flag & 0xffff);
else
remoteClient.SendMapBlock(response, 0);
} }
else else
{ {
@ -1012,21 +1010,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
foreach (GridRegion r in regions) foreach (GridRegion r in regions)
{ {
MapBlockData block = new MapBlockData(); MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r); MapBlockFromGridRegion(block, r, flag);
mapBlocks.Add(block); mapBlocks.Add(block);
} }
if ((flag & 2) == 2) // V2 !!! remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
remoteClient.SendMapBlock(mapBlocks, 2);
else
remoteClient.SendMapBlock(mapBlocks, 0);
return mapBlocks; return mapBlocks;
} }
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
{ {
block.Access = r.Access; 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.Name = r.RegionName;
block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
@ -1160,7 +1166,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
foreach (GridRegion r in regions) foreach (GridRegion r in regions)
{ {
MapBlockData mapBlock = new MapBlockData(); MapBlockData mapBlock = new MapBlockData();
MapBlockFromGridRegion(mapBlock, r); MapBlockFromGridRegion(mapBlock, r, 0);
AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
if (texAsset != null) if (texAsset != null)
@ -1342,6 +1348,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
UUID terrainImageID = UUID.Random(); UUID terrainImageID = UUID.Random();
UUID parcelImageID = UUID.Zero; // UUID.Random();
AssetBase asset = new AssetBase( AssetBase asset = new AssetBase(
terrainImageID, terrainImageID,
@ -1358,13 +1365,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.AssetService.Store(asset); m_scene.AssetService.Store(asset);
// Switch to the new one // 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.TerrainImageID = terrainImageID;
m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID;
m_scene.RegionInfo.RegionSettings.Save(); m_scene.RegionInfo.RegionSettings.Save();
// Delete the old one // Delete the old one
m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastMapRegionUUID); // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID);
m_scene.AssetService.Delete(lastMapRegionUUID.ToString()); m_scene.AssetService.Delete(lastTerrainImageID.ToString());
m_scene.AssetService.Delete(lastParcelImageID.ToString());
} }
private void MakeRootAgent(ScenePresence avatar) private void MakeRootAgent(ScenePresence avatar)

View File

@ -190,6 +190,7 @@ namespace OpenSim.Services.Interfaces
public UUID ScopeID = UUID.Zero; public UUID ScopeID = UUID.Zero;
public UUID TerrainImage = UUID.Zero; public UUID TerrainImage = UUID.Zero;
public UUID ParcelImage = UUID.Zero;
public byte Access; public byte Access;
public int Maturity; public int Maturity;
public string RegionSecret = string.Empty; public string RegionSecret = string.Empty;
@ -236,6 +237,7 @@ namespace OpenSim.Services.Interfaces
RegionID = ConvertFrom.RegionID; RegionID = ConvertFrom.RegionID;
ServerURI = ConvertFrom.ServerURI; ServerURI = ConvertFrom.ServerURI;
TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; TerrainImage = ConvertFrom.RegionSettings.TerrainImageID;
ParcelImage = ConvertFrom.RegionSettings.ParcelImageID;
Access = ConvertFrom.AccessLevel; Access = ConvertFrom.AccessLevel;
Maturity = ConvertFrom.RegionSettings.Maturity; Maturity = ConvertFrom.RegionSettings.Maturity;
RegionSecret = ConvertFrom.regionSecret; RegionSecret = ConvertFrom.regionSecret;
@ -253,6 +255,7 @@ namespace OpenSim.Services.Interfaces
RegionID = ConvertFrom.RegionID; RegionID = ConvertFrom.RegionID;
ServerURI = ConvertFrom.ServerURI; ServerURI = ConvertFrom.ServerURI;
TerrainImage = ConvertFrom.TerrainImage; TerrainImage = ConvertFrom.TerrainImage;
ParcelImage = ConvertFrom.ParcelImage;
Access = ConvertFrom.Access; Access = ConvertFrom.Access;
Maturity = ConvertFrom.Maturity; Maturity = ConvertFrom.Maturity;
RegionSecret = ConvertFrom.RegionSecret; RegionSecret = ConvertFrom.RegionSecret;
@ -281,7 +284,7 @@ namespace OpenSim.Services.Interfaces
public override int GetHashCode() public override int GetHashCode()
{ {
return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); return RegionID.GetHashCode() ^ TerrainImage.GetHashCode() ^ ParcelImage.GetHashCode();
} }
#endregion #endregion
@ -359,6 +362,7 @@ namespace OpenSim.Services.Interfaces
kvp["serverURI"] = ServerURI; kvp["serverURI"] = ServerURI;
kvp["serverPort"] = InternalEndPoint.Port.ToString(); kvp["serverPort"] = InternalEndPoint.Port.ToString();
kvp["regionMapTexture"] = TerrainImage.ToString(); kvp["regionMapTexture"] = TerrainImage.ToString();
kvp["parcelMapTexture"] = ParcelImage.ToString();
kvp["access"] = Access.ToString(); kvp["access"] = Access.ToString();
kvp["regionSecret"] = RegionSecret; kvp["regionSecret"] = RegionSecret;
kvp["owner_uuid"] = EstateOwner.ToString(); kvp["owner_uuid"] = EstateOwner.ToString();
@ -411,6 +415,9 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("regionMapTexture")) if (kvp.ContainsKey("regionMapTexture"))
UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage);
if (kvp.ContainsKey("parcelMapTexture"))
UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage);
if (kvp.ContainsKey("access")) if (kvp.ContainsKey("access"))
Access = Byte.Parse((string)kvp["access"]); Access = Byte.Parse((string)kvp["access"]);