aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
index 7cb4b00..fe36cf7 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
@@ -50,14 +50,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
50 BinaryReader bs = new BinaryReader(s); 50 BinaryReader bs = new BinaryReader(s);
51 51
52 bool eof = false; 52 bool eof = false;
53 if (ASCIIEncoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ") 53 if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
54 { 54 {
55 int w = 256;
56 int h = 256;
57
55 // Terragen file 58 // Terragen file
56 while (eof == false) 59 while (eof == false)
57 { 60 {
58 int w = 256; 61 string tmp = Encoding.ASCII.GetString(bs.ReadBytes(4));
59 int h = 256;
60 string tmp = ASCIIEncoding.ASCII.GetString(bs.ReadBytes(4));
61 switch (tmp) 62 switch (tmp)
62 { 63 {
63 case "SIZE": 64 case "SIZE":
@@ -79,12 +80,13 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
79 Int16 heightScale = bs.ReadInt16(); 80 Int16 heightScale = bs.ReadInt16();
80 Int16 baseHeight = bs.ReadInt16(); 81 Int16 baseHeight = bs.ReadInt16();
81 retval = new TerrainChannel(w, h); 82 retval = new TerrainChannel(w, h);
82 int x, y; 83 int x;
83 for (x = 0; x < w; x++) 84 for (x = 0; x < w; x++)
84 { 85 {
86 int y;
85 for (y = 0; y < h; y++) 87 for (y = 0; y < h; y++)
86 { 88 {
87 retval[x, y] = (double) baseHeight + (double) bs.ReadInt16() * (double) heightScale / 65536.0; 89 retval[x, y] = baseHeight + bs.ReadInt16() * (double) heightScale / 65536.0;
88 } 90 }
89 } 91 }
90 break; 92 break;
@@ -103,7 +105,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
103 105
104 public void SaveFile(string filename, ITerrainChannel map) 106 public void SaveFile(string filename, ITerrainChannel map)
105 { 107 {
106 char[] header = "TERRAGENTERRAIN".ToCharArray();
107 throw new NotImplementedException(); 108 throw new NotImplementedException();
108 } 109 }
109 110