diff options
author | Adam Frisby | 2009-04-01 05:58:07 +0000 |
---|---|---|
committer | Adam Frisby | 2009-04-01 05:58:07 +0000 |
commit | 5225e40f9e2cfdbc5a14099f45e794ed208838f5 (patch) | |
tree | 5669e6208ca03c860082ac7c08fc82923c473f49 /OpenSim/Data | |
parent | Finally clean up the Scene.Permissions and permissions module. (diff) | |
download | opensim-SC_OLD-5225e40f9e2cfdbc5a14099f45e794ed208838f5.zip opensim-SC_OLD-5225e40f9e2cfdbc5a14099f45e794ed208838f5.tar.gz opensim-SC_OLD-5225e40f9e2cfdbc5a14099f45e794ed208838f5.tar.bz2 opensim-SC_OLD-5225e40f9e2cfdbc5a14099f45e794ed208838f5.tar.xz |
* Removes some hard-coded magic numbers relating to RegionSize. We now use Constants.RegionSize as expected. (Working towards enlarged or smaller regionsizes that arent multiples of 256m)
* Adds minor functionality to MRM Scripting.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/NHibernate/Terrain.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/OpenSim/Data/NHibernate/Terrain.cs b/OpenSim/Data/NHibernate/Terrain.cs index 292b3b4..bd6f992 100644 --- a/OpenSim/Data/NHibernate/Terrain.cs +++ b/OpenSim/Data/NHibernate/Terrain.cs | |||
@@ -74,15 +74,15 @@ namespace OpenSim.Data.NHibernate | |||
74 | 74 | ||
75 | private static double[,] parseTerrain(byte[] data) | 75 | private static double[,] parseTerrain(byte[] data) |
76 | { | 76 | { |
77 | double[,] terret = new double[256,256]; | 77 | double[,] terret = new double[Constants.RegionSize, Constants.RegionSize]; |
78 | terret.Initialize(); | 78 | terret.Initialize(); |
79 | 79 | ||
80 | MemoryStream str = new MemoryStream(data); | 80 | MemoryStream str = new MemoryStream(data); |
81 | BinaryReader br = new BinaryReader(str); | 81 | BinaryReader br = new BinaryReader(str); |
82 | try { | 82 | try { |
83 | for (int x = 0; x < 256; x++) | 83 | for (int x = 0; x < Constants.RegionSize; x++) |
84 | { | 84 | { |
85 | for (int y = 0; y < 256; y++) | 85 | for (int y = 0; y < Constants.RegionSize; y++) |
86 | { | 86 | { |
87 | terret[x, y] = br.ReadDouble(); | 87 | terret[x, y] = br.ReadDouble(); |
88 | } | 88 | } |
@@ -97,13 +97,13 @@ namespace OpenSim.Data.NHibernate | |||
97 | 97 | ||
98 | private static byte[] serializeTerrain(double[,] val) | 98 | private static byte[] serializeTerrain(double[,] val) |
99 | { | 99 | { |
100 | MemoryStream str = new MemoryStream((int)(65536 * sizeof (double))); | 100 | MemoryStream str = new MemoryStream((int) ((Constants.RegionSize*Constants.RegionSize)*sizeof (double))); |
101 | BinaryWriter bw = new BinaryWriter(str); | 101 | BinaryWriter bw = new BinaryWriter(str); |
102 | 102 | ||
103 | // TODO: COMPATIBILITY - Add byte-order conversions | 103 | // TODO: COMPATIBILITY - Add byte-order conversions |
104 | for (int x = 0; x < 256; x++) | 104 | for (int x = 0; x < Constants.RegionSize; x++) |
105 | { | 105 | { |
106 | for (int y = 0; y < 256; y++) | 106 | for (int y = 0; y < Constants.RegionSize; y++) |
107 | { | 107 | { |
108 | double height = val[x, y]; | 108 | double height = val[x, y]; |
109 | if (height <= 0.0) | 109 | if (height <= 0.0) |
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 179692a..e7ce8af 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -882,10 +882,10 @@ namespace OpenSim.Data.Tests | |||
882 | 882 | ||
883 | private double[,] GenTerrain(double value) | 883 | private double[,] GenTerrain(double value) |
884 | { | 884 | { |
885 | double[,] terret = new double[256,256]; | 885 | double[,] terret = new double[Constants.RegionSize, Constants.RegionSize]; |
886 | terret.Initialize(); | 886 | terret.Initialize(); |
887 | for (int x = 0; x < 256; x++) | 887 | for (int x = 0; x < Constants.RegionSize; x++) |
888 | for (int y = 0; y < 256; y++) | 888 | for (int y = 0; y < Constants.RegionSize; y++) |
889 | terret[x,y] = value; | 889 | terret[x,y] = value; |
890 | 890 | ||
891 | return terret; | 891 | return terret; |
@@ -893,8 +893,8 @@ namespace OpenSim.Data.Tests | |||
893 | 893 | ||
894 | private bool CompareTerrain(double[,] one, double[,] two) | 894 | private bool CompareTerrain(double[,] one, double[,] two) |
895 | { | 895 | { |
896 | for (int x = 0; x < 256; x++) | 896 | for (int x = 0; x < Constants.RegionSize; x++) |
897 | for (int y = 0; y < 256; y++) | 897 | for (int y = 0; y < Constants.RegionSize; y++) |
898 | if (one[x,y] != two[x,y]) | 898 | if (one[x,y] != two[x,y]) |
899 | return false; | 899 | return false; |
900 | 900 | ||