aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-15 22:27:10 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-15 22:27:10 +0200
commitff6a348bb1975dd2e181d006abfff3c7e0ecdc72 (patch)
tree2f484cfaeca3015339c5603c1ca3556c3bf2d3d6
parent5cc686c038ade873a4faef12a8f3f41af9b288b4 (diff)
downloadminetest-ff6a348bb1975dd2e181d006abfff3c7e0ecdc72.tar.gz
minetest-ff6a348bb1975dd2e181d006abfff3c7e0ecdc72.tar.bz2
minetest-ff6a348bb1975dd2e181d006abfff3c7e0ecdc72.zip
fixed slight error in server build
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/tile.cpp17
2 files changed, 14 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3fccce665..1c684b0fe 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -172,7 +172,7 @@ else()
if(BUILD_SERVER)
set_target_properties(minetestserver PROPERTIES
- COMPILE_DEFINITIONS "-DSERVER")
+ COMPILE_DEFINITIONS "SERVER")
endif(BUILD_SERVER)
endif()
diff --git a/src/tile.cpp b/src/tile.cpp
index aa4b3d042..24cd9c014 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -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):