diff options
author | Kevin Cozens | 2011-01-26 20:53:21 -0500 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-01-28 21:19:53 +0000 |
commit | 9798b044fe92df6bd1b3f18c04937bd99a4d98cb (patch) | |
tree | 0fad6c8fccf80e395f150f776330bd29f7c1ac7f /OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |
parent | Make the new style stuff compatible with the older revision (diff) | |
download | opensim-SC_OLD-9798b044fe92df6bd1b3f18c04937bd99a4d98cb.zip opensim-SC_OLD-9798b044fe92df6bd1b3f18c04937bd99a4d98cb.tar.gz opensim-SC_OLD-9798b044fe92df6bd1b3f18c04937bd99a4d98cb.tar.bz2 opensim-SC_OLD-9798b044fe92df6bd1b3f18c04937bd99a4d98cb.tar.xz |
Added loading and saving of terrain files using Terragen format (Mantis #1564)
Terrain files can now be loaded and saved using the Terragen (.ter) format.
Selection of the terrain file loader to use is now based on the extension
of the filename being loaded and the data is loaded using a memory stream
instead of writing it to a file and then loading it from the file.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index b0563c5..01f04d9 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -555,37 +555,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
555 | 555 | ||
556 | try | 556 | try |
557 | { | 557 | { |
558 | MemoryStream terrainStream = new MemoryStream(terrainData); | ||
559 | terr.LoadFromStream(filename, terrainStream); | ||
560 | terrainStream.Close(); | ||
558 | 561 | ||
559 | string localfilename = "terrain.raw"; | 562 | FileInfo x = new FileInfo(filename); |
560 | 563 | remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear."); | |
561 | if (terrainData.Length == 851968) | ||
562 | { | ||
563 | localfilename = Path.Combine(Util.dataDir(),"terrain.raw"); // It's a .LLRAW | ||
564 | } | ||
565 | |||
566 | if (terrainData.Length == 196662) // 24-bit 256x256 Bitmap | ||
567 | localfilename = Path.Combine(Util.dataDir(), "terrain.bmp"); | ||
568 | |||
569 | if (terrainData.Length == 256 * 256 * 4) // It's a .R32 | ||
570 | localfilename = Path.Combine(Util.dataDir(), "terrain.r32"); | ||
571 | |||
572 | if (terrainData.Length == 256 * 256 * 8) // It's a .R64 | ||
573 | localfilename = Path.Combine(Util.dataDir(), "terrain.r64"); | ||
574 | |||
575 | if (File.Exists(localfilename)) | ||
576 | { | ||
577 | File.Delete(localfilename); | ||
578 | } | ||
579 | |||
580 | FileStream input = new FileStream(localfilename, FileMode.CreateNew); | ||
581 | input.Write(terrainData, 0, terrainData.Length); | ||
582 | input.Close(); | ||
583 | |||
584 | FileInfo x = new FileInfo(localfilename); | ||
585 | |||
586 | terr.LoadFromFile(localfilename); | ||
587 | remoteClient.SendAlertMessage("Your terrain was loaded as a ." + x.Extension + " file. It may take a few moments to appear."); | ||
588 | |||
589 | } | 564 | } |
590 | catch (IOException e) | 565 | catch (IOException e) |
591 | { | 566 | { |