* 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.
This commit is contained in:
Adam Frisby
2009-04-01 05:58:07 +00:00
parent 7ec85508ff
commit 5225e40f9e
4 changed files with 39 additions and 40 deletions

View File

@@ -74,15 +74,15 @@ namespace OpenSim.Data.NHibernate
private static double[,] parseTerrain(byte[] data)
{
double[,] terret = new double[256,256];
double[,] terret = new double[Constants.RegionSize, Constants.RegionSize];
terret.Initialize();
MemoryStream str = new MemoryStream(data);
BinaryReader br = new BinaryReader(str);
try {
for (int x = 0; x < 256; x++)
for (int x = 0; x < Constants.RegionSize; x++)
{
for (int y = 0; y < 256; y++)
for (int y = 0; y < Constants.RegionSize; y++)
{
terret[x, y] = br.ReadDouble();
}
@@ -97,13 +97,13 @@ namespace OpenSim.Data.NHibernate
private static byte[] serializeTerrain(double[,] val)
{
MemoryStream str = new MemoryStream((int)(65536 * sizeof (double)));
MemoryStream str = new MemoryStream((int) ((Constants.RegionSize*Constants.RegionSize)*sizeof (double)));
BinaryWriter bw = new BinaryWriter(str);
// TODO: COMPATIBILITY - Add byte-order conversions
for (int x = 0; x < 256; x++)
for (int x = 0; x < Constants.RegionSize; x++)
{
for (int y = 0; y < 256; y++)
for (int y = 0; y < Constants.RegionSize; y++)
{
double height = val[x, y];
if (height <= 0.0)

View File

@@ -882,10 +882,10 @@ namespace OpenSim.Data.Tests
private double[,] GenTerrain(double value)
{
double[,] terret = new double[256,256];
double[,] terret = new double[Constants.RegionSize, Constants.RegionSize];
terret.Initialize();
for (int x = 0; x < 256; x++)
for (int y = 0; y < 256; y++)
for (int x = 0; x < Constants.RegionSize; x++)
for (int y = 0; y < Constants.RegionSize; y++)
terret[x,y] = value;
return terret;
@@ -893,8 +893,8 @@ namespace OpenSim.Data.Tests
private bool CompareTerrain(double[,] one, double[,] two)
{
for (int x = 0; x < 256; x++)
for (int y = 0; y < 256; y++)
for (int x = 0; x < Constants.RegionSize; x++)
for (int y = 0; y < Constants.RegionSize; y++)
if (one[x,y] != two[x,y])
return false;