From: dirk husemann <hud@zurich.ibm.com>

these two patches fixe the terrain load exception that occurs when
restarting OpenSim on PPC32 by making terrain loading endian clean.

it does NOT fix the client crash exception. need to hunt that one down.
ThreadPoolClientBranch
Sean Dague 2008-02-11 12:38:51 +00:00
parent 59b224a901
commit c654df5dfd
2 changed files with 6 additions and 4 deletions

View File

@ -374,12 +374,13 @@ namespace OpenSim.Framework.Data.MySQL
int rev = 0; int rev = 0;
if (row.Read()) if (row.Read())
{ {
byte[] heightmap = (byte[]) row["Heightfield"]; MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]);
BinaryReader br = new BinaryReader(str);
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
{ {
for (int y = 0; y < 256; y++) for (int y = 0; y < 256; y++)
{ {
terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); terret[x, y] = br.ReadDouble();
} }
} }
rev = (int) row["Revision"]; rev = (int) row["Revision"];

View File

@ -436,12 +436,13 @@ namespace OpenSim.Framework.Data.SQLite
if (row.Read()) if (row.Read())
{ {
// TODO: put this into a function // TODO: put this into a function
byte[] heightmap = (byte[]) row["Heightfield"]; MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]);
BinaryReader br = new BinaryReader(str);
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
{ {
for (int y = 0; y < 256; y++) for (int y = 0; y < 256; y++)
{ {
terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); terret[x, y] = br.ReadDouble();
} }
} }
rev = (int) row["Revision"]; rev = (int) row["Revision"];