diff options
author | Justin Clark-Casey (justincc) | 2014-05-30 19:38:10 +0100 |
---|---|---|
committer | Justin Clark-Casey | 2014-06-10 20:21:15 +0100 |
commit | 068cab94e074673d1116518e0e24af680a148370 (patch) | |
tree | 873137d56fc8847990fe074a6b195329e7bebe44 /OpenSim | |
parent | Add some info about xbuild command line switches to clean and select between ... (diff) | |
download | opensim-SC_OLD-068cab94e074673d1116518e0e24af680a148370.zip opensim-SC_OLD-068cab94e074673d1116518e0e24af680a148370.tar.gz opensim-SC_OLD-068cab94e074673d1116518e0e24af680a148370.tar.bz2 opensim-SC_OLD-068cab94e074673d1116518e0e24af680a148370.tar.xz |
Fix bug where setting a parcel in a varregion for sale would make sale bitmap generation in WorldMapModule throw an exception on next startup.
This commit replaces the hardcoded region sizes in WorldMapModule.GenerateOverlay() with numbers pulled from m_scene.RegionInfo
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 31 |
2 files changed, 42 insertions, 10 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ce14b58..7ac94a0 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -147,8 +147,29 @@ namespace OpenSim.Framework | |||
147 | public uint WorldLocX = 0; | 147 | public uint WorldLocX = 0; |
148 | public uint WorldLocY = 0; | 148 | public uint WorldLocY = 0; |
149 | public uint WorldLocZ = 0; | 149 | public uint WorldLocZ = 0; |
150 | |||
151 | /// <summary> | ||
152 | /// X dimension of the region. | ||
153 | /// </summary> | ||
154 | /// <remarks> | ||
155 | /// If this is a varregion then the default size set here will be replaced when we load the region config. | ||
156 | /// </remarks> | ||
150 | public uint RegionSizeX = Constants.RegionSize; | 157 | public uint RegionSizeX = Constants.RegionSize; |
158 | |||
159 | /// <summary> | ||
160 | /// X dimension of the region. | ||
161 | /// </summary> | ||
162 | /// <remarks> | ||
163 | /// If this is a varregion then the default size set here will be replaced when we load the region config. | ||
164 | /// </remarks> | ||
151 | public uint RegionSizeY = Constants.RegionSize; | 165 | public uint RegionSizeY = Constants.RegionSize; |
166 | |||
167 | /// <summary> | ||
168 | /// Z dimension of the region. | ||
169 | /// </summary> | ||
170 | /// <remarks> | ||
171 | /// XXX: Unknown if this accounts for regions with negative Z. | ||
172 | /// </remarks> | ||
152 | public uint RegionSizeZ = Constants.RegionHeight; | 173 | public uint RegionSizeZ = Constants.RegionHeight; |
153 | 174 | ||
154 | private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>(); | 175 | private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>(); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b98afbc..e4977cf 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1578,12 +1578,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1578 | 1578 | ||
1579 | private Byte[] GenerateOverlay() | 1579 | private Byte[] GenerateOverlay() |
1580 | { | 1580 | { |
1581 | using (Bitmap overlay = new Bitmap(256, 256)) | 1581 | // These need to be ints for bitmap generation |
1582 | int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; | ||
1583 | int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; | ||
1584 | |||
1585 | int landTileSize = LandManagementModule.LandUnit; | ||
1586 | int regionLandTilesX = regionSizeX / landTileSize; | ||
1587 | int regionLandTilesY = regionSizeY / landTileSize; | ||
1588 | |||
1589 | using (Bitmap overlay = new Bitmap(regionSizeX, regionSizeY)) | ||
1582 | { | 1590 | { |
1583 | bool[,] saleBitmap = new bool[64, 64]; | 1591 | bool[,] saleBitmap = new bool[regionLandTilesX, regionLandTilesY]; |
1584 | for (int x = 0 ; x < 64 ; x++) | 1592 | for (int x = 0; x < regionLandTilesX; x++) |
1585 | { | 1593 | { |
1586 | for (int y = 0 ; y < 64 ; y++) | 1594 | for (int y = 0; y < regionLandTilesY; y++) |
1587 | saleBitmap[x, y] = false; | 1595 | saleBitmap[x, y] = false; |
1588 | } | 1596 | } |
1589 | 1597 | ||
@@ -1596,8 +1604,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1596 | using (Graphics g = Graphics.FromImage(overlay)) | 1604 | using (Graphics g = Graphics.FromImage(overlay)) |
1597 | { | 1605 | { |
1598 | using (SolidBrush transparent = new SolidBrush(background)) | 1606 | using (SolidBrush transparent = new SolidBrush(background)) |
1599 | g.FillRectangle(transparent, 0, 0, 256, 256); | 1607 | g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); |
1600 | |||
1601 | 1608 | ||
1602 | foreach (ILandObject land in parcels) | 1609 | foreach (ILandObject land in parcels) |
1603 | { | 1610 | { |
@@ -1620,12 +1627,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1620 | 1627 | ||
1621 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) | 1628 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) |
1622 | { | 1629 | { |
1623 | for (int x = 0 ; x < 64 ; x++) | 1630 | for (int x = 0 ; x < regionLandTilesX ; x++) |
1624 | { | 1631 | { |
1625 | for (int y = 0 ; y < 64 ; y++) | 1632 | for (int y = 0 ; y < regionLandTilesY ; y++) |
1626 | { | 1633 | { |
1627 | if (saleBitmap[x, y]) | 1634 | if (saleBitmap[x, y]) |
1628 | g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4); | 1635 | g.FillRectangle( |
1636 | yellow, x * landTileSize, | ||
1637 | regionSizeX - landTileSize - (y * landTileSize), | ||
1638 | landTileSize, | ||
1639 | landTileSize); | ||
1629 | } | 1640 | } |
1630 | } | 1641 | } |
1631 | } | 1642 | } |
@@ -1654,4 +1665,4 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1654 | public uint itemtype; | 1665 | public uint itemtype; |
1655 | public ulong regionhandle; | 1666 | public ulong regionhandle; |
1656 | } | 1667 | } |
1657 | } | 1668 | } \ No newline at end of file |