aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs81
2 files changed, 80 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
index e2b7fb2..9d8bbfc 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
@@ -389,7 +389,9 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
389 m_tainted = false; 389 m_tainted = false;
390 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); 390 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
391 m_scene.SaveTerrain(); 391 m_scene.SaveTerrain();
392 m_scene.CreateTerrainTexture(true); 392
393 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
394 //m_scene.CreateTerrainTexture(true);
393 } 395 }
394 } 396 }
395 397
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;