Fix absence of images when compiled with RUN_IN_PLACE=0.
authorIlya Zhuravlev <zhuravlevilya@ya.ru>
Fri, 13 Dec 2013 16:35:57 +0000 (20:35 +0400)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 5 Jan 2014 10:43:40 +0000 (12:43 +0200)
builtin/mainmenu.lua
src/script/lua_api/l_mainmenu.cpp
src/script/lua_api/l_mainmenu.h

index f8556a38811bb13879c3090f9a24cc09445f647e..ecbcce1a029cbbe9523089dc897aff8f93ce5c94 100644 (file)
@@ -253,7 +253,7 @@ function menu.init()
                menu.favorites = engine.get_favorites("local")
        end
 
-       menu.defaulttexturedir = engine.get_texturepath() .. DIR_DELIM .. "base" ..
+       menu.defaulttexturedir = engine.get_texturepath_share() .. DIR_DELIM .. "base" ..
                                        DIR_DELIM .. "pack" .. DIR_DELIM
 end
 
@@ -1070,8 +1070,7 @@ function tabbuilder.tab_texture_packs()
        local no_screenshot = nil
        if not file_exists(screenfile) then
                screenfile = nil
-               no_screenshot = engine.get_texturepath()..DIR_DELIM..
-                                       "base"..DIR_DELIM.."pack"..DIR_DELIM.."no_screenshot.png"
+               no_screenshot = menu.defaulttexturedir .. "no_screenshot.png"
        end
 
        return  retval ..
index ba8a09747bee2f653a7956029bacec5017ae1959..abf2a8f81a991e59a48c4f8a09eee43de5627ab6 100644 (file)
@@ -704,6 +704,14 @@ int ModApiMainMenu::l_get_texturepath(lua_State *L)
        return 1;
 }
 
+int ModApiMainMenu::l_get_texturepath_share(lua_State *L)
+{
+       std::string gamepath
+                       = fs::RemoveRelativePathComponents(porting::path_share + DIR_DELIM + "textures");
+       lua_pushstring(L, gamepath.c_str());
+       return 1;
+}
+
 /******************************************************************************/
 int ModApiMainMenu::l_get_dirlist(lua_State *L)
 {
@@ -1032,6 +1040,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
        API_FCT(get_modpath);
        API_FCT(get_gamepath);
        API_FCT(get_texturepath);
+       API_FCT(get_texturepath_share);
        API_FCT(get_dirlist);
        API_FCT(create_dir);
        API_FCT(delete_dir);
@@ -1059,6 +1068,7 @@ void ModApiMainMenu::InitializeAsync(AsyncEngine& engine)
        ASYNC_API_FCT(get_modpath);
        ASYNC_API_FCT(get_gamepath);
        ASYNC_API_FCT(get_texturepath);
+       ASYNC_API_FCT(get_texturepath_share);
        ASYNC_API_FCT(get_dirlist);
        ASYNC_API_FCT(create_dir);
        ASYNC_API_FCT(delete_dir);
index e185f0a378c14fc5a23ac9001c3db3cc36b5297d..db11ae7942e159d30b672c480624fdf6f7444208 100644 (file)
@@ -111,6 +111,8 @@ private:
        
        static int l_get_texturepath(lua_State *L);
 
+       static int l_get_texturepath_share(lua_State *L);
+
        static int l_get_dirlist(lua_State *L);
 
        static int l_create_dir(lua_State *L);