aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-03 20:00:35 +0000
committerAdam Frisby2008-05-03 20:00:35 +0000
commit87b313792821cb842fd54b568302b6877c4e53f8 (patch)
tree446719156d1e8d8c12bc3bcd69546f04ba0d79ab /OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
parent* Refactor: Move MoveFolder() and PurgeFolder() into CachedUserInfo (which ar... (diff)
downloadopensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.zip
opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.gz
opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.bz2
opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.xz
* Cleaned up code in Terrain, Tree and Map modules.
* Fixed a bug with Terragen loader where it would do bad things on a non 256x256 sized terrain. Now loads the array correctly. * Moved MapImageModule.cs to Modules/World/WorldMap * Changed Location.RegionHandle to use Helpers.GetUlong instead of doing it ourselves.
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