From 9e02a639e563ef45788ae24adf568be028e041be Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 10 Dec 2008 16:50:11 +0000
Subject: * Apply the other patch from
 http://opensimulator.org/mantis/view.php?id=2315 * This means that LL RAW
 terrains (one source being the upload/download buttons on the estate dialog
 in the viewer) are now imported the 'right' way around rather than being
 flipped on the y axis * Existing RAW terrains before this patch will need to
 be flipped with the "terrain flip y" command from the console after import *
 More details on the mailing lists soon. -This line, and those below, will be
 ignored--

M    OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
M    OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
M    OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs


---
 OpenSim/Framework/Communications/Cache/CachedUserInfo.cs     |  3 ++-
 .../Communications/Cache/UserProfileCacheService.cs          |  3 ++-
 .../Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs   | 12 ++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index c8656d5..d3e715f 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -329,10 +329,11 @@ namespace OpenSim.Framework.Communications.Cache
 
         /// <summary>
         /// Create a folder in this agent's inventory.
+        /// </summary>
         ///
         /// If the inventory service has not yet delievered the inventory
         /// for this user then the request will be queued.
-        /// </summary>
+        /// 
         /// <param name="parentID"></param>
         /// <returns></returns>
         public bool CreateFolder(string folderName, UUID folderID, ushort folderType, UUID parentID)
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index b4f3e9f..46df2b7 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -224,11 +224,12 @@ namespace OpenSim.Framework.Communications.Cache
 
         /// <summary>
         /// Handle a client request to update the inventory folder
+        /// </summary>
         ///
         /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
         /// so this will work to rename an existing folder.  Needless to say, to rely on this is very confusing,
         /// and needs to be changed.
-        /// </summary>
+        ///  
         /// <param name="remoteClient"></param>
         /// <param name="folderID"></param>
         /// <param name="type"></param>
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
index 5f13d01..88dd3a7 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
@@ -88,23 +88,23 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
             FileStream s = file.Open(FileMode.Open, FileAccess.Read);
             BinaryReader bs = new BinaryReader(s);
 
-            int currFileYOffset = 0;
+            int currFileYOffset = fileHeight - 1;
 
             // if our region isn't on the first Y section of the areas to be landscaped, then
             // advance to our section of the file
-            while (currFileYOffset < offsetY)
+            while (currFileYOffset > offsetY)
             {
                 // read a whole strip of regions
                 int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
                 bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
-                currFileYOffset++;
+                currFileYOffset--;
             }
 
             // got to the Y start offset within the file of our region
             // so read the file bits associated with our region
             int y;
             // for each Y within our Y offset
-            for (y = 0; y < sectionHeight; y++)
+            for (y = sectionHeight - 1; y >= 0; y--)
             {
                 int currFileXOffset = 0;
 
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
                 int x;
                 for (x = 0; x < retval.Width; x++)
                 {
-                    retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
+                    retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
                     bs.ReadBytes(11); // Advance the stream to next bytes.
                 }
             }
@@ -183,7 +183,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
             {
                 for (int x = 0; x < map.Width; x++)
                 {
-                    double t = map[x, y];
+                    double t = map[x, (map.Height - 1) - y];
                     int index = 0;
 
                     // The lookup table is pre-sorted, so we either find an exact match or
-- 
cgit v1.1