diff options
author | Melanie | 2012-01-31 03:09:44 +0000 |
---|---|---|
committer | Melanie | 2012-01-31 03:09:44 +0000 |
commit | d2dfa4cfe7aadfed0611fb31414d9c8fff420b24 (patch) | |
tree | f4ca3592110fef6c32dff592ee37fc7eac819d02 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-d2dfa4cfe7aadfed0611fb31414d9c8fff420b24.zip opensim-SC-d2dfa4cfe7aadfed0611fb31414d9c8fff420b24.tar.gz opensim-SC-d2dfa4cfe7aadfed0611fb31414d9c8fff420b24.tar.bz2 opensim-SC-d2dfa4cfe7aadfed0611fb31414d9c8fff420b24.tar.xz |
Make parcel sale overlays work. No auction support.
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 88 |
2 files changed, 87 insertions, 7 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index a680a59..f482d8f 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -383,6 +383,9 @@ namespace OpenSim | |||
383 | // TODO : Try setting resource for region xstats here on scene | 383 | // TODO : Try setting resource for region xstats here on scene |
384 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); | 384 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); |
385 | 385 | ||
386 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); | ||
387 | scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
388 | |||
386 | try | 389 | try |
387 | { | 390 | { |
388 | scene.RegisterRegionWithGrid(); | 391 | scene.RegisterRegionWithGrid(); |
@@ -398,9 +401,6 @@ namespace OpenSim | |||
398 | Environment.Exit(1); | 401 | Environment.Exit(1); |
399 | } | 402 | } |
400 | 403 | ||
401 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); | ||
402 | scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
403 | |||
404 | // We need to do this after we've initialized the | 404 | // We need to do this after we've initialized the |
405 | // scripting engines. | 405 | // scripting engines. |
406 | scene.CreateScriptInstances(); | 406 | scene.CreateScriptInstances(); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index e42c946..6c6aa37 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
213 | UUID agentID, Caps caps) | 213 | UUID agentID, Caps caps) |
214 | { | 214 | { |
215 | //try | 215 | //try |
216 | //{ | 216 | // |
217 | //m_log.DebugFormat("[MAPLAYER]: path: {0}, param: {1}, agent:{2}", | 217 | //m_log.DebugFormat("[MAPLAYER]: path: {0}, param: {1}, agent:{2}", |
218 | // path, param, agentID.ToString()); | 218 | // path, param, agentID.ToString()); |
219 | 219 | ||
@@ -1345,10 +1345,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1345 | if (data == null) | 1345 | if (data == null) |
1346 | return; | 1346 | return; |
1347 | 1347 | ||
1348 | byte[] overlay = GenerateOverlay(); | ||
1349 | |||
1348 | m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); | 1350 | m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); |
1349 | 1351 | ||
1350 | UUID terrainImageID = UUID.Random(); | 1352 | UUID terrainImageID = UUID.Random(); |
1351 | UUID parcelImageID = UUID.Zero; // UUID.Random(); | 1353 | UUID parcelImageID = UUID.Zero; |
1352 | 1354 | ||
1353 | AssetBase asset = new AssetBase( | 1355 | AssetBase asset = new AssetBase( |
1354 | terrainImageID, | 1356 | terrainImageID, |
@@ -1364,9 +1366,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1364 | m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); | 1366 | m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); |
1365 | m_scene.AssetService.Store(asset); | 1367 | m_scene.AssetService.Store(asset); |
1366 | 1368 | ||
1369 | if (overlay != null) | ||
1370 | { | ||
1371 | parcelImageID = UUID.Random(); | ||
1372 | |||
1373 | AssetBase parcels = new AssetBase( | ||
1374 | parcelImageID, | ||
1375 | "parcelImage_" + m_scene.RegionInfo.RegionID.ToString(), | ||
1376 | (sbyte)AssetType.Texture, | ||
1377 | m_scene.RegionInfo.RegionID.ToString()); | ||
1378 | parcels.Data = overlay; | ||
1379 | parcels.Description = m_scene.RegionInfo.RegionName; | ||
1380 | parcels.Temporary = false; | ||
1381 | parcels.Flags = AssetFlags.Maptile; | ||
1382 | |||
1383 | m_scene.AssetService.Store(parcels); | ||
1384 | } | ||
1385 | |||
1367 | // Switch to the new one | 1386 | // Switch to the new one |
1368 | UUID lastTerrainImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | 1387 | UUID lastTerrainImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; |
1369 | UUID lastParcelImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | 1388 | UUID lastParcelImageID = m_scene.RegionInfo.RegionSettings.ParcelImageID; |
1370 | m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; | 1389 | m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; |
1371 | m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; | 1390 | m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; |
1372 | m_scene.RegionInfo.RegionSettings.Save(); | 1391 | m_scene.RegionInfo.RegionSettings.Save(); |
@@ -1374,7 +1393,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1374 | // Delete the old one | 1393 | // Delete the old one |
1375 | // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); | 1394 | // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); |
1376 | m_scene.AssetService.Delete(lastTerrainImageID.ToString()); | 1395 | m_scene.AssetService.Delete(lastTerrainImageID.ToString()); |
1377 | m_scene.AssetService.Delete(lastParcelImageID.ToString()); | 1396 | if (lastParcelImageID != UUID.Zero) |
1397 | m_scene.AssetService.Delete(lastParcelImageID.ToString()); | ||
1378 | } | 1398 | } |
1379 | 1399 | ||
1380 | private void MakeRootAgent(ScenePresence avatar) | 1400 | private void MakeRootAgent(ScenePresence avatar) |
@@ -1420,6 +1440,66 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1420 | } | 1440 | } |
1421 | } | 1441 | } |
1422 | 1442 | ||
1443 | private Byte[] GenerateOverlay() | ||
1444 | { | ||
1445 | Bitmap overlay = new Bitmap(256, 256); | ||
1446 | |||
1447 | bool[,] saleBitmap = new bool[64, 64]; | ||
1448 | for (int x = 0 ; x < 64 ; x++) | ||
1449 | { | ||
1450 | for (int y = 0 ; y < 64 ; y++) | ||
1451 | saleBitmap[x, y] = false; | ||
1452 | } | ||
1453 | |||
1454 | bool landForSale = false; | ||
1455 | |||
1456 | List<ILandObject> parcels = m_scene.LandChannel.AllParcels(); | ||
1457 | |||
1458 | Color background = Color.FromArgb(0, 0, 0, 0); | ||
1459 | SolidBrush transparent = new SolidBrush(background); | ||
1460 | Graphics g = Graphics.FromImage(overlay); | ||
1461 | g.FillRectangle(transparent, 0, 0, 256, 256); | ||
1462 | |||
1463 | SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)); | ||
1464 | |||
1465 | foreach (ILandObject land in parcels) | ||
1466 | { | ||
1467 | // m_log.DebugFormat("[WORLD MAP]: Parcel {0} flags {1}", land.LandData.Name, land.LandData.Flags); | ||
1468 | if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) | ||
1469 | { | ||
1470 | landForSale = true; | ||
1471 | |||
1472 | saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap()); | ||
1473 | } | ||
1474 | } | ||
1475 | |||
1476 | if (!landForSale) | ||
1477 | { | ||
1478 | m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName); | ||
1479 | return null; | ||
1480 | } | ||
1481 | |||
1482 | m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName); | ||
1483 | |||
1484 | for (int x = 0 ; x < 64 ; x++) | ||
1485 | { | ||
1486 | for (int y = 0 ; y < 64 ; y++) | ||
1487 | { | ||
1488 | if (saleBitmap[x, y]) | ||
1489 | g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4); | ||
1490 | } | ||
1491 | } | ||
1492 | |||
1493 | try | ||
1494 | { | ||
1495 | return OpenJPEG.EncodeFromImage(overlay, true); | ||
1496 | } | ||
1497 | catch (Exception e) | ||
1498 | { | ||
1499 | m_log.DebugFormat("[WORLD MAP]: Error creating parcel overlay: " + e.ToString()); | ||
1500 | } | ||
1501 | return null; | ||
1502 | } | ||
1423 | } | 1503 | } |
1424 | 1504 | ||
1425 | public struct MapRequestState | 1505 | public struct MapRequestState |