]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Terrain.cpp
Updating newdetail more often to avoid storing bad value, and added a newline at...
[lugaru.git] / Source / Terrain.cpp
index af56b86150c8deb9a76120fed91add01a81187cd..34da00ea94b2fd1d3071e1f755dee31de2fc2b3c 100644 (file)
@@ -21,6 +21,8 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 #include "Game.h"
 #include "Terrain.h"
 #include "Objects.h"
+#include "Utils/Folders.h"
+
 extern XYZ viewer;
 extern float viewdistance;
 extern float fadestart;
@@ -35,7 +37,6 @@ extern bool decals;
 extern float blurness;
 extern float targetblurness;
 extern Objects objects;
-extern ImageRec texture;
 extern bool visibleloading;
 extern bool skyboxtexture;
 extern int tutoriallevel;
@@ -397,7 +398,7 @@ void Terrain::UpdateVertexArray(int whichx, int whichy)
 }
 
 
-bool Terrain::load(const char *fileName)
+bool Terrain::load(const std::string& fileName)
 {
     static long i, j;
     static long x, y;
@@ -405,8 +406,12 @@ bool Terrain::load(const char *fileName)
 
     float temptexdetail = texdetail;
 
+    ImageRec texture;
+
     //Load Image
-    upload_image(ConvertFileName(fileName));
+    if (!load_image(Folders::getResourcePath(fileName).c_str(), texture)) {
+        return false;
+    }
 
     //Is it valid?
     if (texture.bpp > 24) {
@@ -640,7 +645,7 @@ bool Terrain::load(const char *fileName)
     patch_elements = (patch_size) * (patch_size) * 54;
     CalculateNormals();
 
-    return 1;
+    return true;
 }
 
 void Terrain::CalculateNormals()