fixed slight error in server build
authorPerttu Ahola <celeron55@gmail.com>
Tue, 15 Feb 2011 20:27:10 +0000 (22:27 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 15 Feb 2011 20:27:10 +0000 (22:27 +0200)
src/CMakeLists.txt
src/tile.cpp

index 3fccce665458121187c2ab5ff6c697ba1226d7b9..1c684b0feaf369c47eab8b0a151f413133261aba 100644 (file)
@@ -172,7 +172,7 @@ else()
        
        if(BUILD_SERVER)
                set_target_properties(minetestserver PROPERTIES
-                               COMPILE_DEFINITIONS "-DSERVER")
+                               COMPILE_DEFINITIONS "SERVER")
        endif(BUILD_SERVER)
 
 endif()
index aa4b3d042463b473356d74c6743bb8fecff9203b..24cd9c014286f33edd3fca1ae2be16f344550a66 100644 (file)
@@ -20,14 +20,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "tile.h"
 #include "debug.h"
 #include "main.h" // for g_settings
+#include "filesys.h"
 
+/*
+       Gets the path to a texture by first checking if the texture exists
+       in texture_path and if not, using the data path.
+*/
 inline std::string getTexturePath(std::string filename)
 {
        std::string texture_path = g_settings.get("texture_path");
-       if(texture_path == "")
-               return porting::getDataPath(filename.c_str());
-       else
-               return texture_path + '/' + filename;
+       if(texture_path != "")
+       {
+               std::string fullpath = texture_path + '/' + filename;
+               if(fs::PathExists(fullpath))
+                       return fullpath;
+       }
+       
+       return porting::getDataPath(filename.c_str());
 }
 
 TextureSource::TextureSource(IrrlichtDevice *device):