diff options
author | Teravus Ovares | 2008-06-14 02:39:27 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-06-14 02:39:27 +0000 |
commit | 6bea792436521c1635eed73a002975f4334c9354 (patch) | |
tree | b4a443457851d845f82e93c577e04ce9e85e4660 /OpenSim | |
parent | save_assets_to_file path shouldn't always assume uploaded (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 81 |
5 files changed, 110 insertions, 6 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 9c27891..979ced5 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -208,6 +208,9 @@ namespace OpenSim.Framework | |||
208 | public string RegionName = String.Empty; | 208 | public string RegionName = String.Empty; |
209 | public string regionSecret = LLUUID.Random().ToString(); | 209 | public string regionSecret = LLUUID.Random().ToString(); |
210 | 210 | ||
211 | public LLUUID lastMapUUID = LLUUID.Zero; | ||
212 | public string lastMapRefresh = "0"; | ||
213 | |||
211 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 214 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
212 | 215 | ||
213 | public RegionInfo(string description, string filename, bool skipConsoleConfig) | 216 | public RegionInfo(string description, string filename, bool skipConsoleConfig) |
@@ -384,6 +387,11 @@ namespace OpenSim.Framework | |||
384 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | 387 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
385 | "(Sandbox Mode Only)Password for Master Avatar account", | 388 | "(Sandbox Mode Only)Password for Master Avatar account", |
386 | MasterAvatarSandboxPassword, true); | 389 | MasterAvatarSandboxPassword, true); |
390 | configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
391 | "Last Map UUID", lastMapUUID.ToString(), true); | ||
392 | configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
393 | "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); | ||
394 | |||
387 | } | 395 | } |
388 | 396 | ||
389 | public void loadConfigurationOptions() | 397 | public void loadConfigurationOptions() |
@@ -430,6 +438,12 @@ namespace OpenSim.Framework | |||
430 | "(Sandbox Mode Only)Password for Master Avatar account", "test", false, | 438 | "(Sandbox Mode Only)Password for Master Avatar account", "test", false, |
431 | (ConfigurationOption.ConfigurationOptionShouldBeAsked) | 439 | (ConfigurationOption.ConfigurationOptionShouldBeAsked) |
432 | shouldMasterAvatarDetailsBeAsked); | 440 | shouldMasterAvatarDetailsBeAsked); |
441 | configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
442 | "Last Map UUID", lastMapUUID.ToString(), true); | ||
443 | |||
444 | configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
445 | "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); | ||
446 | |||
433 | } | 447 | } |
434 | 448 | ||
435 | public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) | 449 | public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) |
@@ -498,6 +512,12 @@ namespace OpenSim.Framework | |||
498 | string tempMD5Passwd = (string) configuration_result; | 512 | string tempMD5Passwd = (string) configuration_result; |
499 | MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); | 513 | MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); |
500 | break; | 514 | break; |
515 | case "lastmap_uuid": | ||
516 | lastMapUUID = (LLUUID)configuration_result; | ||
517 | break; | ||
518 | case "lastmap_refresh": | ||
519 | lastMapRefresh = (string)configuration_result; | ||
520 | break; | ||
501 | } | 521 | } |
502 | 522 | ||
503 | return true; | 523 | return true; |
@@ -507,5 +527,13 @@ namespace OpenSim.Framework | |||
507 | { | 527 | { |
508 | configMember.forceSetConfigurationOption("estate_covanant_uuid", notecard.ToString()); | 528 | configMember.forceSetConfigurationOption("estate_covanant_uuid", notecard.ToString()); |
509 | } | 529 | } |
530 | public void SaveLastMapUUID(LLUUID mapUUID) | ||
531 | { | ||
532 | lastMapUUID = mapUUID; | ||
533 | lastMapRefresh = Util.UnixTimeSinceEpoch().ToString(); | ||
534 | |||
535 | configMember.forceSetConfigurationOption("lastmap_uuid", mapUUID.ToString()); | ||
536 | configMember.forceSetConfigurationOption("lastmap_refresh", lastMapRefresh); | ||
537 | } | ||
510 | } | 538 | } |
511 | } \ No newline at end of file | 539 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f96c29b..6d74903 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -511,7 +511,7 @@ namespace OpenSim | |||
511 | 511 | ||
512 | //moved these here as the terrain texture has to be created after the modules are initialized | 512 | //moved these here as the terrain texture has to be created after the modules are initialized |
513 | // and has to happen before the region is registered with the grid. | 513 | // and has to happen before the region is registered with the grid. |
514 | scene.CreateTerrainTexture(true); | 514 | scene.CreateTerrainTexture(false); |
515 | 515 | ||
516 | try | 516 | try |
517 | { | 517 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5cbe04e..0b2aa52 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -1224,6 +1224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1224 | { | 1224 | { |
1225 | mapReply.Data[i] = new MapBlockReplyPacket.DataBlock(); | 1225 | mapReply.Data[i] = new MapBlockReplyPacket.DataBlock(); |
1226 | mapReply.Data[i].MapImageID = mapBlocks2[i].MapImageId; | 1226 | mapReply.Data[i].MapImageID = mapBlocks2[i].MapImageId; |
1227 | //m_log.Warn(mapBlocks2[i].MapImageId.ToString()); | ||
1227 | mapReply.Data[i].X = mapBlocks2[i].X; | 1228 | mapReply.Data[i].X = mapBlocks2[i].X; |
1228 | mapReply.Data[i].Y = mapBlocks2[i].Y; | 1229 | mapReply.Data[i].Y = mapBlocks2[i].Y; |
1229 | mapReply.Data[i].WaterHeight = mapBlocks2[i].WaterHeight; | 1230 | mapReply.Data[i].WaterHeight = mapBlocks2[i].WaterHeight; |
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; |