* Enables maptile display in grid mode for simulators that are not on the same instance.

* Only generates a new maptile after a refresh interval
* Maptile names have the UnixTimeSinceEpoch that they were generated and the regionUUID they're from, so you can know which ones are no longer necessary.
* Updates RegionInfo, so backup your /bin/Region/*.xml files.
0.6.0-stable
Teravus Ovares 2008-06-14 02:39:27 +00:00
parent b47dd07932
commit 6bea792436
5 changed files with 110 additions and 6 deletions

View File

@ -208,6 +208,9 @@ namespace OpenSim.Framework
public string RegionName = String.Empty;
public string regionSecret = LLUUID.Random().ToString();
public LLUUID lastMapUUID = LLUUID.Zero;
public string lastMapRefresh = "0";
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
public RegionInfo(string description, string filename, bool skipConsoleConfig)
@ -384,6 +387,11 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"(Sandbox Mode Only)Password for Master Avatar account",
MasterAvatarSandboxPassword, true);
configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"Last Map UUID", lastMapUUID.ToString(), true);
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
}
public void loadConfigurationOptions()
@ -430,6 +438,12 @@ namespace OpenSim.Framework
"(Sandbox Mode Only)Password for Master Avatar account", "test", false,
(ConfigurationOption.ConfigurationOptionShouldBeAsked)
shouldMasterAvatarDetailsBeAsked);
configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"Last Map UUID", lastMapUUID.ToString(), true);
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
}
public bool shouldMasterAvatarDetailsBeAsked(string configuration_key)
@ -498,6 +512,12 @@ namespace OpenSim.Framework
string tempMD5Passwd = (string) configuration_result;
MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
break;
case "lastmap_uuid":
lastMapUUID = (LLUUID)configuration_result;
break;
case "lastmap_refresh":
lastMapRefresh = (string)configuration_result;
break;
}
return true;
@ -507,5 +527,13 @@ namespace OpenSim.Framework
{
configMember.forceSetConfigurationOption("estate_covanant_uuid", notecard.ToString());
}
public void SaveLastMapUUID(LLUUID mapUUID)
{
lastMapUUID = mapUUID;
lastMapRefresh = Util.UnixTimeSinceEpoch().ToString();
configMember.forceSetConfigurationOption("lastmap_uuid", mapUUID.ToString());
configMember.forceSetConfigurationOption("lastmap_refresh", lastMapRefresh);
}
}
}

View File

@ -511,7 +511,7 @@ namespace OpenSim
//moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(true);
scene.CreateTerrainTexture(false);
try
{

View File

@ -1224,6 +1224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
mapReply.Data[i] = new MapBlockReplyPacket.DataBlock();
mapReply.Data[i].MapImageID = mapBlocks2[i].MapImageId;
//m_log.Warn(mapBlocks2[i].MapImageId.ToString());
mapReply.Data[i].X = mapBlocks2[i].X;
mapReply.Data[i].Y = mapBlocks2[i].Y;
mapReply.Data[i].WaterHeight = mapBlocks2[i].WaterHeight;

View File

@ -389,7 +389,9 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
m_tainted = false;
m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
m_scene.SaveTerrain();
m_scene.CreateTerrainTexture(true);
// Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
//m_scene.CreateTerrainTexture(true);
}
}

View File

@ -1287,12 +1287,51 @@ namespace OpenSim.Region.Environment.Scenes
return;
}
m_regInfo.EstateSettings.terrainImageID = LLUUID.Random();
LLUUID lastMapRegionUUID = m_regInfo.lastMapUUID;
int lastMapRefresh = 0;
int twoDays = 172800;
int RefreshSeconds = twoDays;
try
{
lastMapRefresh = Convert.ToInt32(m_regInfo.lastMapRefresh);
} catch (ArgumentException)
{}
catch (FormatException)
{}
catch (OverflowException)
{}
LLUUID TerrainImageLLUUID = LLUUID.Random();
if (lastMapRegionUUID == LLUUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
{
m_regInfo.SaveLastMapUUID(TerrainImageLLUUID);
m_log.Warn("[MAPTILE]: STORING MAPTILE IMAGE");
//Extra protection.. probably not needed.
}
else
{
TerrainImageLLUUID = lastMapRegionUUID;
m_log.Warn("[MAPTILE]: REUSING OLD MAPTILE IMAGE ID");
}
m_regInfo.EstateSettings.terrainImageID = TerrainImageLLUUID;
AssetBase asset = new AssetBase();
asset.FullID = m_regInfo.EstateSettings.terrainImageID;
asset.Data = data;
asset.Name = "terrainImage";
asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
asset.Description = RegionInfo.RegionName;
asset.Type = 0;
asset.Temporary = temporary;
AssetCache.AddAsset(asset);
@ -1302,11 +1341,45 @@ namespace OpenSim.Region.Environment.Scenes
byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png");
if (data != null)
{
m_regInfo.EstateSettings.terrainImageID = LLUUID.Random();
LLUUID lastMapRegionUUID = m_regInfo.lastMapUUID;
int lastMapRefresh = 0;
int twoDays = 172800;
int RefreshSeconds = twoDays;
try
{
lastMapRefresh = Convert.ToInt32(m_regInfo.lastMapRefresh);
}
catch (ArgumentException)
{ }
catch (FormatException)
{ }
catch (OverflowException)
{ }
LLUUID TerrainImageLLUUID = LLUUID.Random();
if (lastMapRegionUUID == LLUUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
{
m_regInfo.SaveLastMapUUID(TerrainImageLLUUID);
//m_log.Warn(terrainImageID);
//Extra protection.. probably not needed.
}
else
{
TerrainImageLLUUID = lastMapRegionUUID;
}
m_regInfo.EstateSettings.terrainImageID = TerrainImageLLUUID;
AssetBase asset = new AssetBase();
asset.FullID = m_regInfo.EstateSettings.terrainImageID;
asset.Data = data;
asset.Name = "terrainImage";
asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
asset.Description = RegionInfo.RegionName;
asset.Type = 0;
asset.Temporary = temporary;