aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-03-30 09:03:38 +0000
committerAdam Frisby2008-03-30 09:03:38 +0000
commitfadd19f3140107d7c09e7a82a97dfb490146ccb9 (patch)
tree3ce4581ef1af79d451f0b24ce50128f09482f386 /OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
parentThis update has good news and bad news, first the bad. (diff)
downloadopensim-SC_OLD-fadd19f3140107d7c09e7a82a97dfb490146ccb9.zip
opensim-SC_OLD-fadd19f3140107d7c09e7a82a97dfb490146ccb9.tar.gz
opensim-SC_OLD-fadd19f3140107d7c09e7a82a97dfb490146ccb9.tar.bz2
opensim-SC_OLD-fadd19f3140107d7c09e7a82a97dfb490146ccb9.tar.xz
**Big ass update warning**
* Renamed plugin console message, to send a message to a plugin, use either "plugin <message>", or any unrecognised message will be sent ("plugin" sends explicitly) This replaces the old "script <message>". * Terrain commands - "terrain <command>" now works again. "Script terrain <command>" does not. Many of the commands have now been reimplemented, eg load-tile. However some have new syntax. * New console command handler, you can now use things like "terrain help" or "terrain save help". See TerrainModule.cs for an example of how to use the new "Commander" class. * Commander class - advanced processing of console input and also enables a script API to be generated from registered console commands.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
index ba430b7..fc81376 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
@@ -57,6 +57,43 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
57 return retval; 57 return retval;
58 } 58 }
59 59
60 public override string ToString()
61 {
62 return "RAW32";
63 }
64
65 public ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight)
66 {
67 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
68
69 FileInfo file = new FileInfo(filename);
70 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
71 BinaryReader bs = new BinaryReader(s);
72
73 // Advance to our section of the file
74 if (fileStartY * sectionHeight > 0)
75 bs.ReadBytes(fileStartY * sectionHeight);
76
77 int x, y;
78 for (y = 0; y < retval.Height; y++)
79 {
80 // Advance the stream if we aren't at the start of the section in the file
81 if (fileStartX * sectionWidth > 0)
82 bs.ReadBytes(fileStartX * sectionHeight);
83
84 for (x = 0; x < retval.Width; x++)
85 {
86 // Read a strip and continue
87 retval[x, y] = bs.ReadSingle();
88 }
89 }
90
91 bs.Close();
92 s.Close();
93
94 return retval;
95 }
96
60 public void SaveFile(string filename, ITerrainChannel map) 97 public void SaveFile(string filename, ITerrainChannel map)
61 { 98 {
62 FileInfo file = new FileInfo(filename); 99 FileInfo file = new FileInfo(filename);