aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs60
1 files changed, 4 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ebf5a06..9cf181b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1129,64 +1129,12 @@ namespace OpenSim.Region.Framework.Scenes
1129 1129
1130 byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); 1130 byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png");
1131 if (data != null) 1131 if (data != null)
1132 LazySaveGeneratedMaptile(data, temporary);
1133 }
1134
1135 public void LazySaveGeneratedMaptile(byte[] data, bool temporary)
1136 {
1137 // Overwrites the local Asset cache with new maptile data
1138 // Assets are single write, this causes the asset server to ignore this update,
1139 // but the local asset cache does not
1140
1141 // this is on purpose! The net result of this is the region always has the most up to date
1142 // map tile while protecting the (grid) asset database from bloat caused by a new asset each
1143 // time a mapimage is generated!
1144
1145 UUID lastMapRegionUUID = m_regInfo.lastMapUUID;
1146
1147 int lastMapRefresh = 0;
1148 int twoDays = 172800;
1149 int RefreshSeconds = twoDays;
1150
1151 try
1152 {
1153 lastMapRefresh = Convert.ToInt32(m_regInfo.lastMapRefresh);
1154 }
1155 catch (ArgumentException)
1156 { 1132 {
1133 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
1134
1135 if (mapModule != null)
1136 mapModule.LazySaveGeneratedMaptile(data, temporary);
1157 } 1137 }
1158 catch (FormatException)
1159 {
1160 }
1161 catch (OverflowException)
1162 {
1163 }
1164
1165 UUID TerrainImageUUID = UUID.Random();
1166
1167 if (lastMapRegionUUID == UUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
1168 {
1169 m_regInfo.SaveLastMapUUID(TerrainImageUUID);
1170
1171 m_log.Warn("[MAPTILE]: STORING MAPTILE IMAGE");
1172 }
1173 else
1174 {
1175 TerrainImageUUID = lastMapRegionUUID;
1176 m_log.Warn("[MAPTILE]: REUSING OLD MAPTILE IMAGE ID");
1177 }
1178
1179 m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
1180
1181 AssetBase asset = new AssetBase();
1182 asset.Metadata.FullID = m_regInfo.RegionSettings.TerrainImageID;
1183 asset.Data = data;
1184 asset.Metadata.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
1185 asset.Metadata.Description = RegionInfo.RegionName;
1186
1187 asset.Metadata.Type = 0;
1188 asset.Metadata.Temporary = temporary;
1189 AssetCache.AddAsset(asset);
1190 } 1138 }
1191 1139
1192 #endregion 1140 #endregion