aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-06-14 02:39:27 +0000
committerTeravus Ovares2008-06-14 02:39:27 +0000
commit6bea792436521c1635eed73a002975f4334c9354 (patch)
treeb4a443457851d845f82e93c577e04ce9e85e4660 /OpenSim/Region/Environment/Scenes/Scene.cs
parentsave_assets_to_file path shouldn't always assume uploaded (diff)
downloadopensim-SC-6bea792436521c1635eed73a002975f4334c9354.zip
opensim-SC-6bea792436521c1635eed73a002975f4334c9354.tar.gz
opensim-SC-6bea792436521c1635eed73a002975f4334c9354.tar.bz2
opensim-SC-6bea792436521c1635eed73a002975f4334c9354.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs81
1 files changed, 77 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e70fbe2..a7535e1 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1287,12 +1287,51 @@ namespace OpenSim.Region.Environment.Scenes
1287 return; 1287 return;
1288 } 1288 }
1289 1289
1290 m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); 1290
1291
1292 LLUUID lastMapRegionUUID = m_regInfo.lastMapUUID;
1293
1294 int lastMapRefresh = 0;
1295 int twoDays = 172800;
1296 int RefreshSeconds = twoDays;
1297
1298 try
1299 {
1300 lastMapRefresh = Convert.ToInt32(m_regInfo.lastMapRefresh);
1301 } catch (ArgumentException)
1302 {}
1303 catch (FormatException)
1304 {}
1305 catch (OverflowException)
1306 {}
1307
1308 LLUUID TerrainImageLLUUID = LLUUID.Random();
1309
1310 if (lastMapRegionUUID == LLUUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
1311 {
1312
1313 m_regInfo.SaveLastMapUUID(TerrainImageLLUUID);
1314
1315 m_log.Warn("[MAPTILE]: STORING MAPTILE IMAGE");
1316 //Extra protection.. probably not needed.
1317
1318 }
1319 else
1320 {
1321 TerrainImageLLUUID = lastMapRegionUUID;
1322 m_log.Warn("[MAPTILE]: REUSING OLD MAPTILE IMAGE ID");
1323 }
1324
1325
1326
1327 m_regInfo.EstateSettings.terrainImageID = TerrainImageLLUUID;
1328
1291 AssetBase asset = new AssetBase(); 1329 AssetBase asset = new AssetBase();
1292 asset.FullID = m_regInfo.EstateSettings.terrainImageID; 1330 asset.FullID = m_regInfo.EstateSettings.terrainImageID;
1293 asset.Data = data; 1331 asset.Data = data;
1294 asset.Name = "terrainImage"; 1332 asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
1295 asset.Description = RegionInfo.RegionName; 1333 asset.Description = RegionInfo.RegionName;
1334
1296 asset.Type = 0; 1335 asset.Type = 0;
1297 asset.Temporary = temporary; 1336 asset.Temporary = temporary;
1298 AssetCache.AddAsset(asset); 1337 AssetCache.AddAsset(asset);
@@ -1302,11 +1341,45 @@ namespace OpenSim.Region.Environment.Scenes
1302 byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); 1341 byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png");
1303 if (data != null) 1342 if (data != null)
1304 { 1343 {
1305 m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); 1344 LLUUID lastMapRegionUUID = m_regInfo.lastMapUUID;
1345
1346 int lastMapRefresh = 0;
1347 int twoDays = 172800;
1348 int RefreshSeconds = twoDays;
1349
1350 try
1351 {
1352 lastMapRefresh = Convert.ToInt32(m_regInfo.lastMapRefresh);
1353 }
1354 catch (ArgumentException)
1355 { }
1356 catch (FormatException)
1357 { }
1358 catch (OverflowException)
1359 { }
1360
1361 LLUUID TerrainImageLLUUID = LLUUID.Random();
1362
1363 if (lastMapRegionUUID == LLUUID.Zero || (lastMapRefresh + RefreshSeconds) < Util.UnixTimeSinceEpoch())
1364 {
1365
1366 m_regInfo.SaveLastMapUUID(TerrainImageLLUUID);
1367
1368 //m_log.Warn(terrainImageID);
1369 //Extra protection.. probably not needed.
1370
1371 }
1372 else
1373 {
1374 TerrainImageLLUUID = lastMapRegionUUID;
1375 }
1376
1377 m_regInfo.EstateSettings.terrainImageID = TerrainImageLLUUID;
1378
1306 AssetBase asset = new AssetBase(); 1379 AssetBase asset = new AssetBase();
1307 asset.FullID = m_regInfo.EstateSettings.terrainImageID; 1380 asset.FullID = m_regInfo.EstateSettings.terrainImageID;
1308 asset.Data = data; 1381 asset.Data = data;
1309 asset.Name = "terrainImage"; 1382 asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
1310 asset.Description = RegionInfo.RegionName; 1383 asset.Description = RegionInfo.RegionName;
1311 asset.Type = 0; 1384 asset.Type = 0;
1312 asset.Temporary = temporary; 1385 asset.Temporary = temporary;