From ff6a348bb1975dd2e181d006abfff3c7e0ecdc72 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 15 Feb 2011 22:27:10 +0200 Subject: fixed slight error in server build --- src/tile.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/tile.cpp') 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): -- cgit v1.2.3