From e62927ed71c557cd885fce03fbc34bb6020089a3 Mon Sep 17 00:00:00 2001 From: BlockMen Date: Thu, 12 Feb 2015 02:55:50 +0100 Subject: Fix gettext on MSVC --- src/gettext.cpp | 26 +++++++++++++------------- src/gettext.h | 7 +++++-- src/util/string.cpp | 23 +++++++++++++---------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/gettext.cpp b/src/gettext.cpp index 688a22570..fc7569418 100644 --- a/src/gettext.cpp +++ b/src/gettext.cpp @@ -26,24 +26,24 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #if USE_GETTEXT && defined(_MSC_VER) -#include +#include #include #include #include "filesys.h" -#define setlocale(category,localename) \ - setlocale(category,MSVC_LocaleLookup(localename)) +#define setlocale(category, localename) \ + setlocale(category, MSVC_LocaleLookup(localename)) -static std::map glb_supported_locales; +static std::map glb_supported_locales; /******************************************************************************/ BOOL CALLBACK UpdateLocaleCallback(LPTSTR pStr) { char* endptr = 0; - int LOCALEID = strtol(pStr,&endptr,16); + int LOCALEID = strtol(pStr, &endptr,16); wchar_t buffer[LOCALE_NAME_MAX_LENGTH]; - memset(buffer,0,sizeof(buffer)); + memset(buffer, 0, sizeof(buffer)); if (GetLocaleInfoW( LOCALEID, LOCALE_SISO639LANGNAME, @@ -52,7 +52,7 @@ BOOL CALLBACK UpdateLocaleCallback(LPTSTR pStr) std::wstring name = buffer; - memset(buffer,0,sizeof(buffer)); + memset(buffer, 0, sizeof(buffer)); GetLocaleInfoW( LOCALEID, LOCALE_SISO3166CTRYNAME, @@ -61,7 +61,7 @@ BOOL CALLBACK UpdateLocaleCallback(LPTSTR pStr) std::wstring country = buffer; - memset(buffer,0,sizeof(buffer)); + memset(buffer, 0, sizeof(buffer)); GetLocaleInfoW( LOCALEID, LOCALE_SENGLISHLANGUAGENAME, @@ -96,7 +96,7 @@ const char* MSVC_LocaleLookup(const char* raw_shortname) { } if (first_use) { - EnumSystemLocalesA(UpdateLocaleCallback,LCID_SUPPORTED | LCID_ALTERNATE_SORTS); + EnumSystemLocalesA(UpdateLocaleCallback, LCID_SUPPORTED | LCID_ALTERNATE_SORTS); first_use = false; } @@ -148,8 +148,8 @@ void init_gettext(const char *path, const std::string &configured_language) { if (current_language_var != configured_language) { STARTUPINFO startupinfo; PROCESS_INFORMATION processinfo; - memset(&startupinfo,0,sizeof(startupinfo)); - memset(&processinfo,0,sizeof(processinfo)); + memset(&startupinfo, 0, sizeof(startupinfo)); + memset(&processinfo, 0, sizeof(processinfo)); errorstream << "MSVC localization workaround active restating minetest in new environment!" << std::endl; std::string parameters = ""; @@ -169,7 +169,7 @@ void init_gettext(const char *path, const std::string &configured_language) { /** users may start by short name in commandline without extention **/ std::string appname = argv[0]; - if (appname.substr(appname.length() -4) != ".exe") { + if (appname.substr(appname.length() - 4) != ".exe") { appname += ".exe"; } @@ -260,7 +260,7 @@ void init_gettext(const char *path, const std::string &configured_language) { /* no matter what locale is used we need number format to be "C" */ /* to ensure formspec parameters are evaluated correct! */ - setlocale(LC_NUMERIC,"C"); + setlocale(LC_NUMERIC, "C"); infostream << "Message locale is now set to: " << setlocale(LC_ALL, 0) << std::endl; } diff --git a/src/gettext.h b/src/gettext.h index 8e6282887..dce45fa3a 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -41,16 +41,19 @@ void init_gettext(const char *path, const std::string &configured_language); extern const wchar_t *narrow_to_wide_c(const char *mbs); extern std::wstring narrow_to_wide(const std::string &mbs); - // You must free the returned string! inline const wchar_t *wgettext(const char *str) { return narrow_to_wide_c(gettext(str)); } +// Gettext under MSVC needs this strange way. Just don't ask... inline std::wstring wstrgettext(const std::string &text) { - return narrow_to_wide(gettext(text.c_str())); + const wchar_t *tmp = wgettext(text.c_str()); + std::wstring retval = (std::wstring)tmp; + delete[] tmp; + return retval; } inline std::string strgettext(const std::string &text) diff --git a/src/util/string.cpp b/src/util/string.cpp index b4908d62d..00499ff32 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -98,11 +98,13 @@ const wchar_t *narrow_to_wide_c(const char *mbs) { wchar_t *wcs = NULL; #if defined(_WIN32) - int wcl = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) mbs, -1, NULL, 0); - if (!wcl) - return NULL; - wcs = new wchar_t[wcl]; - MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) mbs, -1, (WCHAR *) wcs, wcl); + int nResult = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) mbs, -1, 0, 0); + if (nResult == 0) { + errorstream << "gettext: MultiByteToWideChar returned null" << std::endl; + } else { + wcs = new wchar_t[nResult]; + MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) mbs, -1, (WCHAR *) wcs, nResult); + } #else size_t wcl = mbstowcs(NULL, mbs, 0); if (wcl == (size_t) -1) @@ -120,12 +122,13 @@ const wchar_t *narrow_to_wide_c(const char *mbs) std::wstring narrow_to_wide(const std::string& mbs) { - const wchar_t *wcs = narrow_to_wide_c(mbs.c_str()); - if (!wcs) + size_t wcl = mbs.size(); + Buffer wcs(wcl + 1); + size_t l = mbstowcs(*wcs, mbs.c_str(), wcl); + if (l == (size_t)(-1)) return L""; - std::wstring wstr(wcs); - delete [] wcs; - return wstr; + wcs[l] = 0; + return *wcs; } #ifdef __ANDROID__ -- cgit v1.2.3 From 61588a43dd61b48383823b7fa948ece4d8dd357e Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 12 Feb 2015 22:03:24 +0100 Subject: Fix crash on passing false as value in table to table.copy(t) Fixes #2293. --- builtin/common/misc_helpers.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index deeba788e..d9ebc39c3 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -545,12 +545,11 @@ function table.copy(t, seen) seen = seen or {} seen[t] = n for k, v in pairs(t) do - n[type(k) ~= "table" and k or seen[k] or table.copy(k, seen)] = - type(v) ~= "table" and v or seen[v] or table.copy(v, seen) + n[(type(k) == "table" and (seen[k] or table.copy(k, seen))) or k] = + (type(v) == "table" and (seen[v] or table.copy(v, seen))) or v end return n end - -------------------------------------------------------------------------------- -- mainmenu only functions -------------------------------------------------------------------------------- -- cgit v1.2.3 From 9dbca41385750f656cef6af9ded58b6113916425 Mon Sep 17 00:00:00 2001 From: ngosang Date: Tue, 27 Jan 2015 01:17:04 +0100 Subject: Fix Exit to OS button focus in Pause Menu --- src/game.cpp | 2 +- src/guiFormSpecMenu.cpp | 7 +++++-- src/guiFormSpecMenu.h | 10 +++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index fe3e838b2..ba28aa789 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1157,7 +1157,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec, LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU"); create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst, NULL); - + (*cur_formspec)->setFocus(L"btn_continue"); (*cur_formspec)->doPause = true; } diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 20c9ecde7..3f285fa5e 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -97,6 +97,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev, m_form_src(fsrc), m_text_dst(tdst), m_formspec_version(0), + m_focused_element(L""), m_font(NULL) #ifdef __ANDROID__ ,m_JavaDialogFieldName(L"") @@ -1757,8 +1758,6 @@ void GUIFormSpecMenu::parseElement(parserData* data, std::string element) <getDynamicData(); } + //set focus + if (!m_focused_element.empty()) + mydata.focused_fieldname = m_focused_element; + //preserve focus gui::IGUIElement *focused_element = Environment->getFocus(); if (focused_element && focused_element->getParent() == this) { diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 6d6c07453..48cb5c553 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -246,13 +246,20 @@ public: m_allowclose = value; } - void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0)) { + void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0)) + { m_lock = lock; m_lockscreensize = basescreensize; } void removeChildren(); void setInitialFocus(); + + void setFocus(std::wstring elementname) + { + m_focused_element = elementname; + } + /* Remove and re-add (or reposition) stuff */ @@ -348,6 +355,7 @@ private: IFormSource *m_form_src; TextDest *m_text_dst; unsigned int m_formspec_version; + std::wstring m_focused_element; typedef struct { bool explicit_size; -- cgit v1.2.3 From 60fa5807b90498bf052bce1a7552f2ec794eb0d4 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 6 Jan 2015 21:46:00 +0100 Subject: README.txt: Simplify initial build steps by using git to fetch sources Also simplify wget steps and apt-get install zlib1g-dev libjsoncpp-dev --- README.txt | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/README.txt b/README.txt index 0999bd165..774dc6639 100644 --- a/README.txt +++ b/README.txt @@ -103,18 +103,32 @@ Compiling on GNU/Linux: ----------------------- Install dependencies. Here's an example for Debian/Ubuntu: -$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev +$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libjsoncpp-dev -Download source, extract (this is the URL to the latest of source repository, which might not work at all times): -$ wget https://github.com/minetest/minetest/tarball/master -O master.tar.gz +You can install git for easily keeping your copy up to date. +If you dont want git, read below on how to get the source without git. +This is an example for installing git on Debian/Ubuntu: +$ apt-get install git-core + +Download source (this is the URL to the latest of source repository, which might not work at all times) using git: +$ git clone --depth 1 https://github.com/minetest/minetest.git +$ cd minetest + +Download minetest_game (otherwise only the "Minimal development test" game is available) using git: +$ cd games/ +$ git clone --depth 1 https://github.com/minetest/minetest_game.git +$ cd .. + +Download source, without using git: +$ wget https://github.com/minetest/minetest/archive/master.tar.gz $ tar xf master.tar.gz -$ cd minetest-minetest-286edd4 (or similar) +$ cd minetest-master -Download minetest_game (otherwise only the "Minimal development test" game is available) +Download minetest_game, without using git: $ cd games/ -$ wget https://github.com/minetest/minetest_game/tarball/master -O minetest_game.tar.gz -$ tar xf minetest_game.tar.gz -$ mv minetest-minetest_game-* minetest_game +$ wget https://github.com/minetest/minetest_game/archive/master.tar.gz +$ tar xf master.tar.gz +$ mv minetest_game-master minetest_game $ cd .. Build a version that runs directly from the source directory: -- cgit v1.2.3 From 93e5ab367abe9f68cf1fe3ed8a198f563d9452af Mon Sep 17 00:00:00 2001 From: Markus Koschany Date: Tue, 20 Jan 2015 10:41:51 +0100 Subject: Fix FTBFS on GNU/Hurd platform Minetest fails to build on GNU/Hurd due to a name clash with OSX/Apple, both are defining the __MACH__ keyword. This commit fixes the issue. --- src/cguittfont/irrUString.h | 2 +- src/jthread/jevent.h | 4 ++-- src/jthread/jsemaphore.h | 4 ++-- src/jthread/pthread/jevent.cpp | 2 +- src/jthread/pthread/jsemaphore.cpp | 20 ++++++++++---------- src/porting.h | 8 ++++---- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/cguittfont/irrUString.h b/src/cguittfont/irrUString.h index c175c792a..eb7abe5a1 100644 --- a/src/cguittfont/irrUString.h +++ b/src/cguittfont/irrUString.h @@ -45,7 +45,7 @@ #define __BYTE_ORDER 0 #define __LITTLE_ENDIAN 0 #define __BIG_ENDIAN 1 -#elif __MACH__ +#elif defined(__MACH__) && defined(__APPLE__) #include #elif defined(__FreeBSD__) #include diff --git a/src/jthread/jevent.h b/src/jthread/jevent.h index f97e09ca0..9ea7ebde8 100644 --- a/src/jthread/jevent.h +++ b/src/jthread/jevent.h @@ -30,7 +30,7 @@ #ifdef _WIN32 #include -#elif __MACH__ +#elif defined(__MACH__) && defined(__APPLE__) #include #include #include @@ -43,7 +43,7 @@ class Event { #ifdef _WIN32 HANDLE hEvent; -#elif __MACH__ +#elif defined(__MACH__) && defined(__APPLE__) semaphore_t sem; #else sem_t sem; diff --git a/src/jthread/jsemaphore.h b/src/jthread/jsemaphore.h index 4ab006aea..32e9bc2f2 100644 --- a/src/jthread/jsemaphore.h +++ b/src/jthread/jsemaphore.h @@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #define MAX_SEMAPHORE_COUNT 1024 -#elif __MACH__ +#elif defined(__MACH__) && defined(__APPLE__) #include #include #include @@ -52,7 +52,7 @@ public: private: #if defined(WIN32) HANDLE m_hSemaphore; -#elif __MACH__ +#elif defined(__MACH__) && defined(__APPLE__) semaphore_t m_semaphore; int semcount; #else diff --git a/src/jthread/pthread/jevent.cpp b/src/jthread/pthread/jevent.cpp index 6a45a37d2..e1d40f4c1 100644 --- a/src/jthread/pthread/jevent.cpp +++ b/src/jthread/pthread/jevent.cpp @@ -29,7 +29,7 @@ #define UNUSED(expr) do { (void)(expr); } while (0) -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) #undef sem_t #define sem_t semaphore_t #undef sem_init diff --git a/src/jthread/pthread/jsemaphore.cpp b/src/jthread/pthread/jsemaphore.cpp index 16e001e92..15281ba64 100644 --- a/src/jthread/pthread/jsemaphore.cpp +++ b/src/jthread/pthread/jsemaphore.cpp @@ -20,13 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include "jthread/jsemaphore.h" -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) #include #endif #define UNUSED(expr) do { (void)(expr); } while (0) -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) #undef sem_t #undef sem_init #undef sem_wait @@ -44,7 +44,7 @@ JSemaphore::JSemaphore() { int sem_init_retval = sem_init(&m_semaphore,0,0); assert(sem_init_retval == 0); UNUSED(sem_init_retval); -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) semcount = 0; #endif } @@ -73,7 +73,7 @@ void JSemaphore::Post() { int sem_post_retval = sem_post(&m_semaphore); assert(sem_post_retval == 0); UNUSED(sem_post_retval); -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) pthread_mutex_lock(&semcount_mutex); semcount++; pthread_mutex_unlock(&semcount_mutex); @@ -84,7 +84,7 @@ void JSemaphore::Wait() { int sem_wait_retval = sem_wait(&m_semaphore); assert(sem_wait_retval == 0); UNUSED(sem_wait_retval); -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) pthread_mutex_lock(&semcount_mutex); semcount--; pthread_mutex_unlock(&semcount_mutex); @@ -92,7 +92,7 @@ void JSemaphore::Wait() { } bool JSemaphore::Wait(unsigned int time_ms) { -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) mach_timespec_t waittime; waittime.tv_sec = time_ms / 1000; waittime.tv_nsec = 1000000 * (time_ms % 1000); @@ -106,14 +106,14 @@ bool JSemaphore::Wait(unsigned int time_ms) { return false; } -#ifndef __MACH__ +#if !(defined(__MACH__) && defined(__APPLE__)) waittime.tv_nsec = ((time_ms % 1000) * 1000 * 1000) + (now.tv_usec * 1000); waittime.tv_sec = (time_ms / 1000) + (waittime.tv_nsec / (1000*1000*1000)) + now.tv_sec; waittime.tv_nsec %= 1000*1000*1000; #endif errno = 0; -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) int sem_wait_retval = semaphore_timedwait(m_semaphore, waittime); if (sem_wait_retval == KERN_OPERATION_TIMED_OUT) { errno = ETIMEDOUT; @@ -128,7 +128,7 @@ bool JSemaphore::Wait(unsigned int time_ms) { if (sem_wait_retval == 0) { -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) pthread_mutex_lock(&semcount_mutex); semcount--; pthread_mutex_unlock(&semcount_mutex); @@ -144,7 +144,7 @@ bool JSemaphore::Wait(unsigned int time_ms) { int JSemaphore::GetValue() { int retval = 0; -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) pthread_mutex_lock(&semcount_mutex); retval = semcount; pthread_mutex_unlock(&semcount_mutex); diff --git a/src/porting.h b/src/porting.h index 8387453e8..3d2677564 100644 --- a/src/porting.h +++ b/src/porting.h @@ -60,7 +60,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include //for uintptr_t - #if (defined(linux) || defined(__linux)) && !defined(_GNU_SOURCE) +#if (defined(linux) || defined(__linux) || defined(__GNU__)) && !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif @@ -228,7 +228,7 @@ void initIrrlicht(irr::IrrlichtDevice * ); #else // Posix #include #include -#ifdef __MACH__ +#if defined(__MACH__) && defined(__APPLE__) #include #include #endif @@ -258,7 +258,7 @@ void initIrrlicht(irr::IrrlichtDevice * ); { struct timespec ts; // from http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x -#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time +#if defined(__MACH__) && defined(__APPLE__) // OS X does not have clock_gettime, use clock_get_time clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); @@ -358,7 +358,7 @@ inline u32 getDeltaMs(u32 old_time_ms, u32 new_time_ms) inline void setThreadName(const char *name) { pthread_setname_np(name); } -#elif defined(_WIN32) +#elif defined(_WIN32) || defined(__GNU__) inline void setThreadName(const char* name) {} #else #warning "Unrecognized platform, thread names will not be available." -- cgit v1.2.3 From 9e9688fc613a74e81aa5ce544482b512071c4677 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Wed, 11 Feb 2015 02:27:43 -0500 Subject: Fix Android build of narrow_to_wide --- src/util/string.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/util/string.cpp b/src/util/string.cpp index 00499ff32..de669b473 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -62,20 +62,21 @@ int wctomb(char *s, wchar_t wc) int mbtowc(wchar_t *pwc, const char *s, size_t n) { - wchar_t *intermediate = narrow_to_wide(s); + const wchar_t *tmp = narrow_to_wide_c(s); - if (intermediate.length() > 0) { - *pwc = intermediate[0]; + if (tmp[0] != '\0') { + *pwc = tmp[0]; return 1; } else { return -1; } } + // You must free the returned string! const wchar_t *narrow_to_wide_c(const char *mbs) { size_t mbl = strlen(mbs); - wchar_t wcs = new wchar_t[mbl + 1]; + wchar_t *wcs = new wchar_t[mbl + 1]; for (size_t i = 0; i < mbl; i++) { if (((unsigned char) mbs[i] > 31) && -- cgit v1.2.3 From 7f078582094b6fef067294b4db7a58abc65ed2c6 Mon Sep 17 00:00:00 2001 From: Rui Date: Wed, 11 Feb 2015 13:42:58 +0900 Subject: Fix tab_mods.lua: default screenshot patch https://forum.minetest.net/viewtopic.php?f=6&t=11201 Fixed this bug. --- builtin/mainmenu/tab_mods.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mainmenu/tab_mods.lua b/builtin/mainmenu/tab_mods.lua index d16ecca8c..e00f580bb 100644 --- a/builtin/mainmenu/tab_mods.lua +++ b/builtin/mainmenu/tab_mods.lua @@ -57,7 +57,7 @@ local function get_formspec(tabview, name, tabdata) end if modscreenshot == nil then - modscreenshot = modstore.basetexturedir .. "no_screenshot.png" + modscreenshot = defaulttexturedir .. "no_screenshot.png" end retval = retval -- cgit v1.2.3 From c7249f59833c42faf5407108a25bd65bae893b95 Mon Sep 17 00:00:00 2001 From: Rui Date: Thu, 12 Feb 2015 19:26:26 +0900 Subject: Fix store.lua bug: default screenshot --- builtin/mainmenu/store.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mainmenu/store.lua b/builtin/mainmenu/store.lua index f0ddfce8f..999125d6e 100644 --- a/builtin/mainmenu/store.lua +++ b/builtin/mainmenu/store.lua @@ -391,7 +391,7 @@ function modstore.getscreenshot(ypos,listentry) listentry.details.screenshot_url == "") then if listentry.texturename == nil then - listentry.texturename = modstore.basetexturedir .. "no_screenshot.png" + listentry.texturename = defaulttexturedir .. "no_screenshot.png" end return "image[0,".. ypos .. ";3,2;" .. -- cgit v1.2.3 From 878e9f759481948af73e5129c5a79e44425a534e Mon Sep 17 00:00:00 2001 From: ngosang Date: Thu, 22 Jan 2015 17:09:29 +0100 Subject: Fix .zip extraction (mod store) --- src/script/lua_api/l_mainmenu.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 28c3d193d..0d8365106 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -859,19 +859,19 @@ int ModApiMainMenu::l_extract_zip(lua_State *L) unsigned int number_of_files = files_in_zip->getFileCount(); - for (unsigned int i=0; i < number_of_files; i++) { + for (unsigned int i=0; i < number_of_files; i++) { std::string fullpath = destination; fullpath += DIR_DELIM; fullpath += files_in_zip->getFullFileName(i).c_str(); + std::string fullpath_dir = fs::RemoveLastPathComponent(fullpath); - if (files_in_zip->isDirectory(i)) { - if (! fs::CreateAllDirs(fullpath) ) { + if (!files_in_zip->isDirectory(i)) { + if (!fs::PathExists(fullpath_dir) && !fs::CreateAllDirs(fullpath_dir)) { fs->removeFileArchive(fs->getFileArchiveCount()-1); lua_pushboolean(L,false); return 1; } - } - else { + io::IReadFile* toread = opened_zip->createAndOpenFile(i); FILE *targetfile = fopen(fullpath.c_str(),"wb"); @@ -883,7 +883,7 @@ int ModApiMainMenu::l_extract_zip(lua_State *L) } char read_buffer[1024]; - unsigned int total_read = 0; + long total_read = 0; while (total_read < toread->getSize()) { -- cgit v1.2.3 From 7f6fc148bd6f8337781efe59fd4f189fa94a2fda Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 11 Feb 2015 09:57:35 +0100 Subject: Fix issue #2279. ok @zeno- --- src/game.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index ba28aa789..a1e2b807a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3218,10 +3218,13 @@ void Game::updateCamera(VolatileRunFlags *flags, u32 busy_time, v3s16 old_camera_offset = camera->getOffset(); if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_CAMERA_MODE])) { - camera->toggleCameraMode(); GenericCAO *playercao = player->getCAO(); - assert(playercao != NULL); + // If playercao not loaded, don't change camera + if (playercao == NULL) + return; + + camera->toggleCameraMode(); playercao->setVisible(camera->getCameraMode() > CAMERA_MODE_FIRST); } -- cgit v1.2.3 From 2b635a892cf6f484c327307f24a91dca472f4fd4 Mon Sep 17 00:00:00 2001 From: ngosang Date: Wed, 21 Jan 2015 02:50:33 +0100 Subject: Minor fixes in translations --- builtin/mainmenu/tab_mods.lua | 2 +- builtin/mainmenu/tab_multiplayer.lua | 6 +++--- builtin/mainmenu/tab_simple_main.lua | 6 +++--- src/game.cpp | 2 +- src/guiKeyChangeMenu.cpp | 10 +++++----- src/guiPasswordChange.cpp | 12 ++++++------ 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/builtin/mainmenu/tab_mods.lua b/builtin/mainmenu/tab_mods.lua index e00f580bb..901f14553 100644 --- a/builtin/mainmenu/tab_mods.lua +++ b/builtin/mainmenu/tab_mods.lua @@ -96,7 +96,7 @@ local function get_formspec(tabview, name, tabdata) else --show dependencies - retval = retval .. ",Depends:," + retval = retval .. "," .. fgettext("Depends:") .. "," local toadd = modmgr.get_dependencies(selected_mod.path) diff --git a/builtin/mainmenu/tab_multiplayer.lua b/builtin/mainmenu/tab_multiplayer.lua index c44fd0144..734cb5d3e 100644 --- a/builtin/mainmenu/tab_multiplayer.lua +++ b/builtin/mainmenu/tab_multiplayer.lua @@ -59,9 +59,9 @@ local function get_formspec(tabview, name, tabdata) "text,align=right;" .. -- clients "text,align=center,padding=0.25;" .. -- "/" "text,align=right,padding=0.25;" .. -- clients_max - image_column("Creative mode", "creative") .. ",padding=1;" .. - image_column("Damage enabled", "damage") .. ",padding=0.25;" .. - image_column("PvP enabled", "pvp") .. ",padding=0.25;" .. + image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" .. + image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" .. + image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" .. "text,padding=1]" -- name else retval = retval .. "tablecolumns[text]" diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua index cab1702cf..87bd551c0 100644 --- a/builtin/mainmenu/tab_simple_main.lua +++ b/builtin/mainmenu/tab_simple_main.lua @@ -42,9 +42,9 @@ local function get_formspec(tabview, name, tabdata) "text,align=right;" .. -- clients "text,align=center,padding=0.25;" .. -- "/" "text,align=right,padding=0.25;" .. -- clients_max - image_column("Creative mode", "creative") .. ",padding=1;" .. - image_column("Damage enabled", "damage") .. ",padding=0.25;" .. - image_column("PvP enabled", "pvp") .. ",padding=0.25;" .. + image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" .. + image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" .. + image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" .. "text,padding=1]" -- name else retval = retval .. "tablecolumns[text]" diff --git a/src/game.cpp b/src/game.cpp index a1e2b807a..896973515 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1074,7 +1074,7 @@ static void show_deathscreen(GUIFormSpecMenu **cur_formspec, std::string(FORMSPEC_VERSION_STRING) + SIZE_TAG "bgcolor[#320000b4;true]" - "label[4.85,1.35;You died.]" + "label[4.85,1.35;" + gettext("You died.") + "]" "button_exit[4,3;3,0.5;btn_respawn;" + gettext("Respawn") + "]" ; diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index 9bc8118a1..4cd9f36d9 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -156,8 +156,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) } { - s32 option_x = offset.X + 10; - s32 option_y = offset.Y; + s32 option_x = offset.X; + s32 option_y = offset.Y + 5; u32 option_w = 180; { core::rect rect(0, 0, option_w, 30); @@ -171,9 +171,9 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) } { - s32 option_x = offset.X + 10; - s32 option_y = offset.Y; - u32 option_w = 220; + s32 option_x = offset.X; + s32 option_y = offset.Y + 5; + u32 option_w = 280; { core::rect rect(0, 0, option_w, 30); rect += topleft + v2s32(option_x, option_y); diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp index d9a5cc48b..0e19f571d 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -103,8 +103,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) */ s32 ypos = 50; { - core::rect rect(0, 0, 110, 20); - rect += topleft_client + v2s32(35, ypos+6); + core::rect rect(0, 0, 150, 20); + rect += topleft_client + v2s32(25, ypos+6); text = wgettext("Old Password"); Environment->addStaticText(text, rect, false, true, this, -1); delete[] text; @@ -119,8 +119,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) } ypos += 50; { - core::rect rect(0, 0, 110, 20); - rect += topleft_client + v2s32(35, ypos+6); + core::rect rect(0, 0, 150, 20); + rect += topleft_client + v2s32(25, ypos+6); text = wgettext("New Password"); Environment->addStaticText(text, rect, false, true, this, -1); delete[] text; @@ -134,8 +134,8 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) } ypos += 50; { - core::rect rect(0, 0, 110, 20); - rect += topleft_client + v2s32(35, ypos+6); + core::rect rect(0, 0, 150, 20); + rect += topleft_client + v2s32(25, ypos+6); text = wgettext("Confirm Password"); Environment->addStaticText(text, rect, false, true, this, -1); delete[] text; -- cgit v1.2.3 From ec0bf899ed737435e5ed26cf5f78a1e0c80be248 Mon Sep 17 00:00:00 2001 From: Jakub Vaněk Date: Thu, 12 Feb 2015 16:21:43 +0100 Subject: Update czech translation --- po/cs/minetest.po | 690 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 389 insertions(+), 301 deletions(-) diff --git a/po/cs/minetest.po b/po/cs/minetest.po index ce24e54ae..563275b01 100644 --- a/po/cs/minetest.po +++ b/po/cs/minetest.po @@ -1,24 +1,23 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# Czech translations for minetest. +# Copyright (C) 2011 celeron +# This file is distributed under the same license as the minetest. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: minetest\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-12-13 15:24+0100\n" -"PO-Revision-Date: 2013-12-04 11:23+0200\n" -"Last-Translator: Jakub Vaněk \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2015-02-12 13:13+0100\n" +"PO-Revision-Date: 2015-02-12 16:16+0100\n" +"Last-Translator: Jakub Vanek \n" +"Language-Team: Czech <>\n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 1.7-dev\n" -#: builtin/fstk/ui.lua:67 +#: builtin/fstk/ui.lua:67 builtin/mainmenu/store.lua:165 msgid "Ok" msgstr "OK" @@ -29,18 +28,18 @@ msgstr "Svět:" #: builtin/mainmenu/dlg_config_world.lua:30 #: builtin/mainmenu/dlg_config_world.lua:32 msgid "Hide Game" -msgstr "Skrýt interní" +msgstr "Skrýt vnitřní" #: builtin/mainmenu/dlg_config_world.lua:36 #: builtin/mainmenu/dlg_config_world.lua:38 msgid "Hide mp content" -msgstr "Skrýt obsah balíčku" +msgstr "Skrýt obsahy balíčků" #: builtin/mainmenu/dlg_config_world.lua:46 msgid "Mod:" -msgstr "Mody:" +msgstr "Mod:" -#: builtin/mainmenu/dlg_config_world.lua:48 +#: builtin/mainmenu/dlg_config_world.lua:48 builtin/mainmenu/tab_mods.lua:99 msgid "Depends:" msgstr "Závislosti:" @@ -82,7 +81,7 @@ msgstr "Seedové číslo" #: builtin/mainmenu/dlg_create_world.lua:56 msgid "Mapgen" -msgstr "Generátor světa" +msgstr "Generátor mapy" #: builtin/mainmenu/dlg_create_world.lua:59 msgid "Game" @@ -94,19 +93,19 @@ msgstr "Vytvořit" #: builtin/mainmenu/dlg_create_world.lua:68 msgid "You have no subgames installed." -msgstr "" +msgstr "Nemáte nainstalované žádné podhry." #: builtin/mainmenu/dlg_create_world.lua:69 msgid "Download one from minetest.net" -msgstr "" +msgstr "Stáhněte si jednu z minetest.net" #: builtin/mainmenu/dlg_create_world.lua:72 msgid "Warning: The minimal development test is meant for developers." -msgstr "" +msgstr "Varování: \"Minimal development test\" je zamýšlen pouze pro vývojáře." #: builtin/mainmenu/dlg_create_world.lua:73 msgid "Download a subgame, such as minetest_game, from minetest.net" -msgstr "" +msgstr "Stáhněte si z minetest.net podhru, například minetest_game." #: builtin/mainmenu/dlg_create_world.lua:97 msgid "A world named \"$1\" already exists" @@ -114,7 +113,7 @@ msgstr "Svět s názvem \"$1\" už existuje" #: builtin/mainmenu/dlg_create_world.lua:116 msgid "No worldname given or no game selected" -msgstr "Nebyla vybrána žádná hra" +msgstr "Nebyla vybrána podhra nebo název" #: builtin/mainmenu/dlg_delete_mod.lua:26 msgid "Are you sure you want to delete \"$1\"?" @@ -122,7 +121,7 @@ msgstr "Skutečně chcete odstranit \"$1\"?" #: builtin/mainmenu/dlg_delete_mod.lua:27 #: builtin/mainmenu/dlg_delete_world.lua:25 -#: builtin/mainmenu/tab_settings.lua:25 +#: builtin/mainmenu/tab_settings.lua:79 msgid "Yes" msgstr "Ano" @@ -156,16 +155,15 @@ msgstr "Přijmout" #: builtin/mainmenu/modmgr.lua:342 msgid "Install Mod: file: \"$1\"" -msgstr "Instalace Modu: ze souboru: \"$1\"" +msgstr "Instalace modu: ze souboru: \"$1\"" #: builtin/mainmenu/modmgr.lua:343 -#, fuzzy msgid "" "\n" "Install Mod: unsupported filetype \"$1\" or broken archive" msgstr "" "\n" -"Instalace Modu: nepodporovaný typ souboru \"$1\"" +"Instalace modu: špatný archiv nebo nepodporovaný typ souboru \"$1\"" #: builtin/mainmenu/modmgr.lua:363 msgid "Failed to install $1 to $2" @@ -173,60 +171,49 @@ msgstr "Selhala instalace $1 do $2" #: builtin/mainmenu/modmgr.lua:366 msgid "Install Mod: unable to find suitable foldername for modpack $1" -msgstr "" -"Install Mod: nenalezen vhodný adresář s příslušným názvem pro balíček modů $1" +msgstr "Instalace modu: nenalezen vhodný adresář s příslušným názvem pro balíček $1" #: builtin/mainmenu/modmgr.lua:386 msgid "Install Mod: unable to find real modname for: $1" -msgstr "Install Mod: Nenašel jsem skutečné jméno modu: $1" +msgstr "Instalace modu: nenašel jsem skutečné jméno modu: $1" #: builtin/mainmenu/store.lua:88 msgid "Unsorted" -msgstr "" +msgstr "Neřazené" -#: builtin/mainmenu/store.lua:99 builtin/mainmenu/store.lua:584 +#: builtin/mainmenu/store.lua:99 builtin/mainmenu/store.lua:580 msgid "Search" -msgstr "" - -#: builtin/mainmenu/store.lua:125 -#, fuzzy -msgid "Downloading" -msgstr "Stáhnout" +msgstr "Hledání" -#: builtin/mainmenu/store.lua:127 -msgid "please wait..." -msgstr "" +#: builtin/mainmenu/store.lua:126 +msgid "Downloading $1, please wait..." +msgstr "Stahuji $1, prosím čekejte..." -#: builtin/mainmenu/store.lua:159 +#: builtin/mainmenu/store.lua:160 msgid "Successfully installed:" -msgstr "" +msgstr "Úspěšně nainstalováno:" -#: builtin/mainmenu/store.lua:163 -#, fuzzy +#: builtin/mainmenu/store.lua:162 msgid "Shortname:" -msgstr "Název světa" +msgstr "Zkratka:" -#: builtin/mainmenu/store.lua:167 src/guiFormSpecMenu.cpp:2866 -msgid "ok" -msgstr "" - -#: builtin/mainmenu/store.lua:476 +#: builtin/mainmenu/store.lua:472 msgid "Rating" msgstr "Hodnocení" -#: builtin/mainmenu/store.lua:501 +#: builtin/mainmenu/store.lua:497 msgid "re-Install" -msgstr "přeinstalovat" +msgstr "Přeinstalovat" -#: builtin/mainmenu/store.lua:503 +#: builtin/mainmenu/store.lua:499 msgid "Install" msgstr "Instalovat" -#: builtin/mainmenu/store.lua:522 +#: builtin/mainmenu/store.lua:518 msgid "Close store" -msgstr "" +msgstr "Zavřít obchod" -#: builtin/mainmenu/store.lua:530 +#: builtin/mainmenu/store.lua:526 msgid "Page $1 of $2" msgstr "Strana $1 z $2" @@ -248,7 +235,7 @@ msgstr "Bývalí přispěvatelé" #: builtin/mainmenu/tab_mods.lua:30 msgid "Installed Mods:" -msgstr "Nainstalované Mody:" +msgstr "Nainstalované mody:" #: builtin/mainmenu/tab_mods.lua:39 msgid "Online mod repository" @@ -268,7 +255,7 @@ msgstr "Přejmenovat" #: builtin/mainmenu/tab_mods.lua:95 msgid "Uninstall selected modpack" -msgstr "Odinstalovat označený balíček modů" +msgstr "Odinstalovat označený balíček" #: builtin/mainmenu/tab_mods.lua:106 msgid "Uninstall selected mod" @@ -276,39 +263,53 @@ msgstr "Odinstalovat vybraný mod" #: builtin/mainmenu/tab_mods.lua:121 msgid "Select Mod File:" -msgstr "Vybrat Soubor s Modem:" +msgstr "Vybrat soubor s modem:" #: builtin/mainmenu/tab_mods.lua:165 msgid "Mods" msgstr "Mody" #: builtin/mainmenu/tab_multiplayer.lua:23 -msgid "Address/Port" -msgstr "Adresa/port" +msgid "Address / Port :" +msgstr "Adresa / Port :" -#: builtin/mainmenu/tab_multiplayer.lua:24 builtin/mainmenu/tab_server.lua:37 -#: builtin/mainmenu/tab_simple_main.lua:25 -msgid "Name/Password" -msgstr "Jméno/Heslo" +#: builtin/mainmenu/tab_multiplayer.lua:24 +msgid "Name / Password :" +msgstr "Jméno / Heslo :" #: builtin/mainmenu/tab_multiplayer.lua:29 #: builtin/mainmenu/tab_simple_main.lua:30 msgid "Public Serverlist" -msgstr "Veřejný seznam serverů" +msgstr "Seznam veřejných serverů" #: builtin/mainmenu/tab_multiplayer.lua:34 builtin/mainmenu/tab_server.lua:26 #: builtin/mainmenu/tab_singleplayer.lua:85 src/keycode.cpp:230 msgid "Delete" -msgstr "Vymazat" +msgstr "Smazat" #: builtin/mainmenu/tab_multiplayer.lua:38 #: builtin/mainmenu/tab_simple_main.lua:34 msgid "Connect" msgstr "Připojit" -#: builtin/mainmenu/tab_multiplayer.lua:252 +#: builtin/mainmenu/tab_multiplayer.lua:62 +#: builtin/mainmenu/tab_simple_main.lua:45 +msgid "Creative mode" +msgstr "Kreativní mód" + +#: builtin/mainmenu/tab_multiplayer.lua:63 +#: builtin/mainmenu/tab_simple_main.lua:46 +msgid "Damage enabled" +msgstr "Poškození povoleno" + +#: builtin/mainmenu/tab_multiplayer.lua:64 +#: builtin/mainmenu/tab_simple_main.lua:47 +msgid "PvP enabled" +msgstr "PvP povoleno" + +#: builtin/mainmenu/tab_multiplayer.lua:247 msgid "Client" -msgstr "Hra více hráčů" +msgstr "Klient" #: builtin/mainmenu/tab_server.lua:27 builtin/mainmenu/tab_singleplayer.lua:86 msgid "New" @@ -320,18 +321,18 @@ msgstr "Nastavit" #: builtin/mainmenu/tab_server.lua:29 msgid "Start Game" -msgstr "Začít hru" +msgstr "Spustit hru" #: builtin/mainmenu/tab_server.lua:30 builtin/mainmenu/tab_singleplayer.lua:89 msgid "Select World:" msgstr "Vyber svět:" -#: builtin/mainmenu/tab_server.lua:31 builtin/mainmenu/tab_simple_main.lua:63 +#: builtin/mainmenu/tab_server.lua:31 builtin/mainmenu/tab_simple_main.lua:75 #: builtin/mainmenu/tab_singleplayer.lua:90 msgid "Creative Mode" msgstr "Kreativní mód" -#: builtin/mainmenu/tab_server.lua:33 builtin/mainmenu/tab_simple_main.lua:65 +#: builtin/mainmenu/tab_server.lua:33 builtin/mainmenu/tab_simple_main.lua:77 #: builtin/mainmenu/tab_singleplayer.lua:92 msgid "Enable Damage" msgstr "Povolit poškození" @@ -340,13 +341,17 @@ msgstr "Povolit poškození" msgid "Public" msgstr "Veřejný" +#: builtin/mainmenu/tab_server.lua:37 builtin/mainmenu/tab_simple_main.lua:25 +msgid "Name/Password" +msgstr "Jméno/Heslo" + #: builtin/mainmenu/tab_server.lua:45 msgid "Bind Address" -msgstr "" +msgstr "Svázat adresu" #: builtin/mainmenu/tab_server.lua:47 msgid "Port" -msgstr "" +msgstr "Port" #: builtin/mainmenu/tab_server.lua:51 msgid "Server Port" @@ -354,140 +359,153 @@ msgstr "Port serveru" #: builtin/mainmenu/tab_server.lua:174 msgid "Server" -msgstr "Místní server" +msgstr "Server" + +#: builtin/mainmenu/tab_settings.lua:21 +msgid "No Filter" +msgstr "Žádný filtr" + +#: builtin/mainmenu/tab_settings.lua:22 +msgid "Bilinear Filter" +msgstr "Bilineární filtr" #: builtin/mainmenu/tab_settings.lua:23 +msgid "Trilinear Filter" +msgstr "Trilineární filtr" + +#: builtin/mainmenu/tab_settings.lua:32 +msgid "No Mipmap" +msgstr "Žádné Mipmapy" + +#: builtin/mainmenu/tab_settings.lua:33 +msgid "Mipmap" +msgstr "Mipmapa" + +#: builtin/mainmenu/tab_settings.lua:34 +msgid "Mipmap + Aniso. Filter" +msgstr "Mipmapa + Anizo. filtr" + +#: builtin/mainmenu/tab_settings.lua:77 msgid "Are you sure to reset your singleplayer world?" -msgstr "" +msgstr "Jste si jisti, že chcete resetovat místní svět?" -#: builtin/mainmenu/tab_settings.lua:27 +#: builtin/mainmenu/tab_settings.lua:81 msgid "No!!!" -msgstr "" +msgstr "Ne!!!" -#: builtin/mainmenu/tab_settings.lua:134 +#: builtin/mainmenu/tab_settings.lua:181 msgid "Smooth Lighting" -msgstr "Hladké osvětlení" +msgstr "Plynulé osvětlení" -#: builtin/mainmenu/tab_settings.lua:136 +#: builtin/mainmenu/tab_settings.lua:183 msgid "Enable Particles" -msgstr "Povolit Částice" +msgstr "Povolit částice" -#: builtin/mainmenu/tab_settings.lua:138 +#: builtin/mainmenu/tab_settings.lua:185 msgid "3D Clouds" -msgstr "3D Mraky" +msgstr "3D mraky" -#: builtin/mainmenu/tab_settings.lua:140 -#, fuzzy +#: builtin/mainmenu/tab_settings.lua:187 msgid "Fancy Trees" -msgstr "Pěkné stromy" +msgstr "Ozdobné stromy" -#: builtin/mainmenu/tab_settings.lua:142 +#: builtin/mainmenu/tab_settings.lua:189 msgid "Opaque Water" msgstr "Neprůhledná voda" -#: builtin/mainmenu/tab_settings.lua:144 -#, fuzzy +#: builtin/mainmenu/tab_settings.lua:191 msgid "Connected Glass" -msgstr "Připojit" - -#: builtin/mainmenu/tab_settings.lua:149 -msgid "Restart minetest for driver change to take effect" -msgstr "" +msgstr "Propojené sklo" -#: builtin/mainmenu/tab_settings.lua:151 -msgid "Mip-Mapping" -msgstr "Mip-Mapování" +#: builtin/mainmenu/tab_settings.lua:193 +msgid "Node Highlighting" +msgstr "Zvýraznění bloků" -#: builtin/mainmenu/tab_settings.lua:153 -msgid "Anisotropic Filtering" -msgstr "Anizotropní filtrování" +#: builtin/mainmenu/tab_settings.lua:196 +msgid "Texturing:" +msgstr "Texturování:" -#: builtin/mainmenu/tab_settings.lua:155 -msgid "Bi-Linear Filtering" -msgstr "Bilineární filtrování" +#: builtin/mainmenu/tab_settings.lua:201 +msgid "Rendering:" +msgstr "Renderování:" -#: builtin/mainmenu/tab_settings.lua:157 -msgid "Tri-Linear Filtering" -msgstr "Trilineární filtrování" +#: builtin/mainmenu/tab_settings.lua:205 +msgid "Restart minetest for driver change to take effect" +msgstr "Aby se změna ovladače projevila, restartujte Minetest." -#: builtin/mainmenu/tab_settings.lua:160 +#: builtin/mainmenu/tab_settings.lua:207 msgid "Shaders" msgstr "Shadery" -#: builtin/mainmenu/tab_settings.lua:164 +#: builtin/mainmenu/tab_settings.lua:212 msgid "Change keys" msgstr "Změnit nastavení kláves" -#: builtin/mainmenu/tab_settings.lua:167 -#, fuzzy +#: builtin/mainmenu/tab_settings.lua:215 msgid "Reset singleplayer world" -msgstr "Hra jednoho hráče" +msgstr "Reset místního světa" -#: builtin/mainmenu/tab_settings.lua:171 +#: builtin/mainmenu/tab_settings.lua:219 msgid "GUI scale factor" -msgstr "" +msgstr "Měřítko GUI" -#: builtin/mainmenu/tab_settings.lua:175 +#: builtin/mainmenu/tab_settings.lua:223 msgid "Scaling factor applied to menu elements: " -msgstr "" +msgstr "Měřítko aplikované na prvky menu: " -#: builtin/mainmenu/tab_settings.lua:181 +#: builtin/mainmenu/tab_settings.lua:229 msgid "Touch free target" -msgstr "" +msgstr "Středový kurzor" -#: builtin/mainmenu/tab_settings.lua:187 +#: builtin/mainmenu/tab_settings.lua:235 msgid "Touchthreshold (px)" -msgstr "" +msgstr "Dosah dotyku (px)" -#: builtin/mainmenu/tab_settings.lua:194 builtin/mainmenu/tab_settings.lua:208 -#, fuzzy +#: builtin/mainmenu/tab_settings.lua:242 builtin/mainmenu/tab_settings.lua:256 msgid "Bumpmapping" -msgstr "Mip-Mapování" +msgstr "Bump mapování" -#: builtin/mainmenu/tab_settings.lua:196 builtin/mainmenu/tab_settings.lua:209 +#: builtin/mainmenu/tab_settings.lua:244 builtin/mainmenu/tab_settings.lua:257 msgid "Generate Normalmaps" -msgstr "" +msgstr "Generovat normálové mapy" -#: builtin/mainmenu/tab_settings.lua:198 builtin/mainmenu/tab_settings.lua:210 +#: builtin/mainmenu/tab_settings.lua:246 builtin/mainmenu/tab_settings.lua:258 msgid "Parallax Occlusion" -msgstr "" +msgstr "Parallax Occlusion" -#: builtin/mainmenu/tab_settings.lua:200 builtin/mainmenu/tab_settings.lua:211 +#: builtin/mainmenu/tab_settings.lua:248 builtin/mainmenu/tab_settings.lua:259 msgid "Waving Water" -msgstr "" +msgstr "Vlnění vody" -#: builtin/mainmenu/tab_settings.lua:202 builtin/mainmenu/tab_settings.lua:212 +#: builtin/mainmenu/tab_settings.lua:250 builtin/mainmenu/tab_settings.lua:260 msgid "Waving Leaves" -msgstr "" +msgstr "Vlnění listů" -#: builtin/mainmenu/tab_settings.lua:204 builtin/mainmenu/tab_settings.lua:213 +#: builtin/mainmenu/tab_settings.lua:252 builtin/mainmenu/tab_settings.lua:261 msgid "Waving Plants" -msgstr "" +msgstr "Vlnění rostlin" -#: builtin/mainmenu/tab_settings.lua:255 +#: builtin/mainmenu/tab_settings.lua:287 msgid "To enable shaders the OpenGL driver needs to be used." -msgstr "Pro povolení shaderů je nutné používat OpenGL ovladač." +msgstr "Pro povolení shaderů musíte používat OpenGL ovladač." -#: builtin/mainmenu/tab_settings.lua:330 +#: builtin/mainmenu/tab_settings.lua:398 msgid "Settings" msgstr "Nastavení" -#: builtin/mainmenu/tab_simple_main.lua:67 +#: builtin/mainmenu/tab_simple_main.lua:79 msgid "Fly mode" -msgstr "" +msgstr "Létací režim" -#: builtin/mainmenu/tab_simple_main.lua:71 -#, fuzzy +#: builtin/mainmenu/tab_simple_main.lua:83 msgid "Start Singleplayer" -msgstr "Hra jednoho hráče" +msgstr "Start místní hry" -#: builtin/mainmenu/tab_simple_main.lua:72 -#, fuzzy +#: builtin/mainmenu/tab_simple_main.lua:84 msgid "Config mods" -msgstr "Nastavit" +msgstr "Nastavení modů" -#: builtin/mainmenu/tab_simple_main.lua:191 -#, fuzzy +#: builtin/mainmenu/tab_simple_main.lua:203 msgid "Main" msgstr "Hlavní nabídka" @@ -497,7 +515,7 @@ msgstr "Hrát" #: builtin/mainmenu/tab_singleplayer.lua:224 msgid "Singleplayer" -msgstr "Hra jednoho hráče" +msgstr "Místní hra" #: builtin/mainmenu/tab_texturepacks.lua:49 msgid "Select texture pack:" @@ -508,43 +526,168 @@ msgid "No information available" msgstr "Informace nejsou dostupné" #: builtin/mainmenu/tab_texturepacks.lua:114 -#, fuzzy msgid "Texturepacks" msgstr "Balíčky textur" -#: src/client.cpp:2726 +#: src/client.cpp:2788 +msgid "Loading textures..." +msgstr "Načítám textury..." + +#: src/client.cpp:2798 +msgid "Rebuilding shaders..." +msgstr "Sestavuji shadery..." + +#: src/client.cpp:2805 +msgid "Initializing nodes..." +msgstr "Inicializuji bloky..." + +#: src/client.cpp:2820 msgid "Item textures..." -msgstr "Textury předmětů..." +msgstr "Textury věcí..." + +#: src/client.cpp:2845 +msgid "Done!" +msgstr "Hotovo!" #: src/fontengine.cpp:70 src/fontengine.cpp:226 msgid "needs_fallback_font" msgstr "no" -#: src/game.cpp:1063 +#: src/game.cpp:1057 src/guiFormSpecMenu.cpp:2006 +msgid "Proceed" +msgstr "Pokračovat" + +#: src/game.cpp:1077 +msgid "You died." +msgstr "Zemřel jsi." + +#: src/game.cpp:1078 msgid "Respawn" -msgstr "Oživení" +msgstr "Znovu stvořit" + +#: src/game.cpp:1097 +msgid "" +"Default Controls:\n" +"No menu visible:\n" +"- single tap: button activate\n" +"- double tap: place/use\n" +"- slide finger: look around\n" +"Menu/Inventory visible:\n" +"- double tap (outside):\n" +" -->close\n" +"- touch stack, touch slot:\n" +" --> move stack\n" +"- touch&drag, tap 2nd finger\n" +" --> place single item to slot\n" +msgstr "" +"Výchozí ovládání:\n" +"Bez menu:\n" +"- klik: aktivace tlačítka\n" +"- dvojklik: položit/použít\n" +"- pohyb prstem: rozhlížení\n" +"Menu/Inventář zobrazen:\n" +"- dvojklik (mimo):\n" +" -->zavřít\n" +"- stisk hromádky, přihrádky :\n" +" --> přesunutí hromádky\n" +"- stisk a přesun, klik druhým prstem\n" +" --> umístit samostatnou věc do přihrádky\n" + +#: src/game.cpp:1111 +msgid "" +"Default Controls:\n" +"- WASD: move\n" +"- Space: jump/climb\n" +"- Shift: sneak/go down\n" +"- Q: drop item\n" +"- I: inventory\n" +"- Mouse: turn/look\n" +"- Mouse left: dig/punch\n" +"- Mouse right: place/use\n" +"- Mouse wheel: select item\n" +"- T: chat\n" +msgstr "" +"Výchozí ovládání:\n" +"- WASD: pohyb\n" +"- Mezera: skákání/šplhání\n" +"- Shift: plížení\n" +"- Q: zahodit věc\n" +"- I: inventář\n" +"- Myš: otáčení,rozhlížení\n" +"- Myš(levé tl.): kopat, štípat\n" +"- Myš(pravé tl.): položit, použít\n" +"- Myš(kolečko): vybrat přihrádku\n" +"- T: chat\n" + +#: src/game.cpp:1130 +msgid "Continue" +msgstr "Pokračovat" + +#: src/game.cpp:1134 +msgid "Change Password" +msgstr "Změnit heslo" + +#: src/game.cpp:1139 +msgid "Sound Volume" +msgstr "Hlasitost" -#: src/game.cpp:2250 +#: src/game.cpp:1141 +msgid "Change Keys" +msgstr "Změnit klávesy" + +#: src/game.cpp:1144 +msgid "Exit to Menu" +msgstr "Odejít do nabídky" + +#: src/game.cpp:1146 +msgid "Exit to OS" +msgstr "Ukončit hru" + +#: src/game.cpp:1809 +msgid "Shutting down..." +msgstr "Vypínání..." + +#: src/game.cpp:1858 +msgid "Loading..." +msgstr "Nahrávám..." + +#: src/game.cpp:1915 +msgid "Creating server..." +msgstr "Vytvářím server..." + +#: src/game.cpp:1952 +msgid "Creating client..." +msgstr "Vytvářím klienta..." + +#: src/game.cpp:2125 +msgid "Resolving address..." +msgstr "Překládám adresu..." + +#: src/game.cpp:2216 +msgid "Connecting to server..." +msgstr "Připojuji se k serveru..." + +#: src/game.cpp:2274 msgid "Item definitions..." -msgstr "Definice předmětů..." +msgstr "Definice věcí..." -#: src/game.cpp:2255 +#: src/game.cpp:2279 msgid "Node definitions..." msgstr "Definice bloků..." -#: src/game.cpp:2262 +#: src/game.cpp:2286 msgid "Media..." msgstr "Média..." -#: src/game.cpp:2267 +#: src/game.cpp:2291 msgid " KB/s" -msgstr "" +msgstr " KB/s" -#: src/game.cpp:2271 +#: src/game.cpp:2295 msgid " MB/s" -msgstr "" +msgstr " MB/s" -#: src/game.cpp:4220 +#: src/game.cpp:4210 msgid "" "\n" "Check debug.txt for details." @@ -552,18 +695,17 @@ msgstr "" "\n" "Pro detaily se podívejte do debug.txt." -#: src/guiFormSpecMenu.cpp:2055 -msgid "Proceed" -msgstr "Pokračovat" - -#: src/guiFormSpecMenu.cpp:2846 +#: src/guiFormSpecMenu.cpp:2797 msgid "Enter " -msgstr "" +msgstr "Zadejte " + +#: src/guiFormSpecMenu.cpp:2817 +msgid "ok" +msgstr "OK" #: src/guiKeyChangeMenu.cpp:125 msgid "Keybindings. (If this menu screws up, remove stuff from minetest.conf)" -msgstr "" -"Nastavení kláves. (Pokud tohle menu nebude v pořádku, odstraňte nastavení z " +msgstr "Nastavení kláves (Pokud tohle menu nebude v pořádku, odstraňte nastavení z " "minetest.conf)" #: src/guiKeyChangeMenu.cpp:165 @@ -572,7 +714,7 @@ msgstr "\"Použít\" = slézt dolů" #: src/guiKeyChangeMenu.cpp:180 msgid "Double tap \"jump\" to toggle fly" -msgstr "Dvě zmáčknutí klávesy \"skok\" zapnou létání" +msgstr "Dvojstisk klávesy \"skok\" zapne létání" #: src/guiKeyChangeMenu.cpp:296 msgid "Key already in use" @@ -592,11 +734,11 @@ msgstr "Vzad" #: src/guiKeyChangeMenu.cpp:399 src/keycode.cpp:229 msgid "Left" -msgstr "Vlevo" +msgstr "Doleva" #: src/guiKeyChangeMenu.cpp:400 src/keycode.cpp:229 msgid "Right" -msgstr "Vpravo" +msgstr "Doprava" #: src/guiKeyChangeMenu.cpp:401 msgid "Use" @@ -608,7 +750,7 @@ msgstr "Skok" #: src/guiKeyChangeMenu.cpp:403 msgid "Sneak" -msgstr "Plížení" +msgstr "Plížit se" #: src/guiKeyChangeMenu.cpp:404 msgid "Drop" @@ -636,11 +778,11 @@ msgstr "Létání" #: src/guiKeyChangeMenu.cpp:410 msgid "Toggle fast" -msgstr "Rychlý pohyb" +msgstr "Turbo" #: src/guiKeyChangeMenu.cpp:411 msgid "Toggle noclip" -msgstr "Noclip" +msgstr "Duch" #: src/guiKeyChangeMenu.cpp:412 msgid "Range select" @@ -650,25 +792,25 @@ msgstr "Změna dohledu" msgid "Print stacks" msgstr "Vypsat hromádky" -#: src/guiPasswordChange.cpp:106 +#: src/guiPasswordChange.cpp:108 msgid "Old Password" msgstr "Staré heslo" -#: src/guiPasswordChange.cpp:122 +#: src/guiPasswordChange.cpp:124 msgid "New Password" msgstr "Nové heslo" -#: src/guiPasswordChange.cpp:137 +#: src/guiPasswordChange.cpp:139 msgid "Confirm Password" msgstr "Potvrdit heslo" -#: src/guiPasswordChange.cpp:153 +#: src/guiPasswordChange.cpp:155 msgid "Change" msgstr "Změnit" -#: src/guiPasswordChange.cpp:162 +#: src/guiPasswordChange.cpp:164 msgid "Passwords do not match!" -msgstr "Hesla si neodpovídají!" +msgstr "Hesla se neshodují!" #: src/guiVolumeChange.cpp:106 msgid "Sound Volume: " @@ -740,7 +882,7 @@ msgstr "Shift" #: src/keycode.cpp:227 msgid "Convert" -msgstr "Převádět" +msgstr "Convert" #: src/keycode.cpp:227 msgid "Escape" @@ -748,7 +890,7 @@ msgstr "Esc" #: src/keycode.cpp:227 msgid "Final" -msgstr "Konečný" +msgstr "Final" #: src/keycode.cpp:227 msgid "Junja" @@ -760,7 +902,7 @@ msgstr "Kanji" #: src/keycode.cpp:227 msgid "Nonconvert" -msgstr "Nepřevádět" +msgstr "Nonconvert" #: src/keycode.cpp:228 msgid "End" @@ -812,7 +954,7 @@ msgstr "Pomoc" #: src/keycode.cpp:230 msgid "Insert" -msgstr "Vložit" +msgstr "Insert" #: src/keycode.cpp:230 msgid "Snapshot" @@ -966,165 +1108,111 @@ msgstr "PA1" msgid "Zoom" msgstr "Přiblížení" -#: src/main.cpp:1681 +#: src/main.cpp:1688 msgid "Main Menu" msgstr "Hlavní nabídka" -#: src/main.cpp:1719 +#: src/main.cpp:1726 msgid "Player name too long." -msgstr "" +msgstr "Jméno hráče je příliš dlouhé." -#: src/main.cpp:1757 +#: src/main.cpp:1764 msgid "Connection error (timed out?)" msgstr "Chyba spojení (vypršel čas?)" -#: src/main.cpp:1919 +#: src/main.cpp:1929 msgid "No world selected and no address provided. Nothing to do." -msgstr "" -"Nebyl vybrán žádný svět a nebyla poskytnuta žádná adresa. Nemám co dělat." +msgstr "Nebyl vybrán žádný svět a nebyla poskytnuta žádná adresa. Nemám co dělat." -#: src/main.cpp:1926 +#: src/main.cpp:1936 msgid "Provided world path doesn't exist: " -msgstr "" +msgstr "Uvedená cesta ke světu neexistuje: " -#: src/main.cpp:1935 +#: src/main.cpp:1945 msgid "Could not find or load game \"" msgstr "Hru nebylo možné nahrát nebo najít \"" -#: src/main.cpp:1953 +#: src/main.cpp:1963 msgid "Invalid gamespec." msgstr "Neplatná specifikace hry." -#~ msgid "Left click: Move all items, Right click: Move single item" -#~ msgstr "" -#~ "Levý klik: Přesunout všechny předměty, Pravý klik: Přesunout jeden předmět" - -#~ msgid "" -#~ "Default Controls:\n" -#~ "- WASD: move\n" -#~ "- Space: jump/climb\n" -#~ "- Shift: sneak/go down\n" -#~ "- Q: drop item\n" -#~ "- I: inventory\n" -#~ "- Mouse: turn/look\n" -#~ "- Mouse left: dig/punch\n" -#~ "- Mouse right: place/use\n" -#~ "- Mouse wheel: select item\n" -#~ "- T: chat\n" -#~ msgstr "" -#~ "Výchozí ovládání:\n" -#~ "- WASD: pohyb\n" -#~ "- Mezera: skákání/šplhání\n" -#~ "- Shift: plížení\n" -#~ "- Q: zahodit\n" -#~ "- I: inventář\n" -#~ "- Myš: otáčení,rozhlížení\n" -#~ "- Myš(levé tl.): kopat, štípat\n" -#~ "- Myš(pravé tl.): položit, použít\n" -#~ "- Myš(kolečko): vybrat předmět\n" -#~ "- T: chat\n" - -#~ msgid "Exit to OS" -#~ msgstr "Ukončit hru" - -#~ msgid "Exit to Menu" -#~ msgstr "Odejít do Nabídky" - -#~ msgid "Sound Volume" -#~ msgstr "Hlasitost" - -#~ msgid "Change Password" -#~ msgstr "Změnit heslo" - -#~ msgid "Continue" -#~ msgstr "Pokračovat" - -#~ msgid "You died." -#~ msgstr "Zemřel jsi." - -#~ msgid "Shutting down stuff..." -#~ msgstr "Vypínám to..." - -#~ msgid "Connecting to server..." -#~ msgstr "Připojuji se k serveru..." - -#~ msgid "Resolving address..." -#~ msgstr "Překládám adresu..." - -#~ msgid "Creating client..." -#~ msgstr "Vytvářím klienta..." - -#~ msgid "Creating server...." -#~ msgstr "Vytvářím server..." - -#~ msgid "Loading..." -#~ msgstr "Nahrávám..." +msgid "Downloading" +msgstr "Stahuji" -#~ msgid "Local install" -#~ msgstr "Místní instalace" +#~ msgid "Game Name" +#~ msgstr "Název hry" -#~ msgid "Add mod:" -#~ msgstr "Přidat mod:" +#~ msgid "Gamemgr: Unable to copy mod \"$1\" to game \"$2\"" +#~ msgstr "Gamemgr: Nepovedlo se zkopírovat mod \"$1\" do hry \"$2\"" -#~ msgid "MODS" -#~ msgstr "MODY" +#~ msgid "GAMES" +#~ msgstr "HRY" -#~ msgid "TEXTURE PACKS" -#~ msgstr "BALÍČKY TEXTUR" +#~ msgid "Games" +#~ msgstr "Hry" -#~ msgid "SINGLE PLAYER" -#~ msgstr "HRA JEDNOHO HRÁČE" +#~ msgid "Mods:" +#~ msgstr "Mody:" -#~ msgid "Finite Liquid" -#~ msgstr "Konečná voda" +#~ msgid "edit game" +#~ msgstr "upravit hru" -#~ msgid "Preload item visuals" -#~ msgstr "Přednačíst textury předmětů" +#~ msgid "new game" +#~ msgstr "nová hra" -#~ msgid "SETTINGS" -#~ msgstr "NASTAVENÍ" +#~ msgid "EDIT GAME" +#~ msgstr "UPRAVIT HRU" -#~ msgid "Password" -#~ msgstr "Heslo" +#~ msgid "Remove selected mod" +#~ msgstr "Odstranit vybraný mod" -#~ msgid "Name" -#~ msgstr "Jméno" +#~ msgid "<<-- Add mod" +#~ msgstr "<<-- Přidat mod" -#~ msgid "START SERVER" -#~ msgstr "MÍSTNÍ SERVER" +#~ msgid "CLIENT" +#~ msgstr "KLIENT" #~ msgid "Favorites:" #~ msgstr "Oblíbené:" -#~ msgid "CLIENT" -#~ msgstr "KLIENT" +#~ msgid "START SERVER" +#~ msgstr "MÍSTNÍ SERVER" -#~ msgid "<<-- Add mod" -#~ msgstr "<<-- Přidat mod" +#~ msgid "Name" +#~ msgstr "Jméno" -#~ msgid "Remove selected mod" -#~ msgstr "Odstranit vybraný mod" +#~ msgid "Password" +#~ msgstr "Heslo" -#~ msgid "EDIT GAME" -#~ msgstr "UPRAVIT HRU" +#~ msgid "SETTINGS" +#~ msgstr "NASTAVENÍ" -#~ msgid "new game" -#~ msgstr "nová hra" +#~ msgid "Preload item visuals" +#~ msgstr "Přednačíst textury předmětů" -#~ msgid "edit game" -#~ msgstr "upravit hru" +#~ msgid "Finite Liquid" +#~ msgstr "Konečná voda" -#~ msgid "Mods:" -#~ msgstr "Mody:" +#~ msgid "SINGLE PLAYER" +#~ msgstr "HRA JEDNOHO HRÁČE" -#~ msgid "Games" -#~ msgstr "Hry" +#~ msgid "TEXTURE PACKS" +#~ msgstr "BALÍČKY TEXTUR" -#~ msgid "GAMES" -#~ msgstr "HRY" +#~ msgid "MODS" +#~ msgstr "MODY" -#~ msgid "Gamemgr: Unable to copy mod \"$1\" to game \"$2\"" -#~ msgstr "Gamemgr: Nepovedlo se zkopírovat mod \"$1\" do hry \"$2\"" +#~ msgid "Add mod:" +#~ msgstr "Přidat mod:" -#~ msgid "Game Name" -#~ msgstr "Název hry" +#~ msgid "Local install" +#~ msgstr "Místní instalace" + +#~ msgid "Left click: Move all items, Right click: Move single item" +#~ msgstr "Levý klik: Přesunout všechny předměty, Pravý klik: Přesunout jeden předmět" + +#~ msgid "Anisotropic Filtering" +#~ msgstr "Anizotropní filtrování" + +#~ msgid "Mip-Mapping" +#~ msgstr "Mip-Mapování" -- cgit v1.2.3 From f92540e8adf70f09fa400d0b2abf97ef762b0759 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 12 Feb 2015 19:36:02 +0100 Subject: Add german and french translation for minetest.desktop This fixes #1573 --- misc/minetest.desktop | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/minetest.desktop b/misc/minetest.desktop index 36decb43f..896404789 100644 --- a/misc/minetest.desktop +++ b/misc/minetest.desktop @@ -2,6 +2,8 @@ Name=Minetest GenericName=Minetest Comment=Multiplayer infinite-world block sandbox +Comment[fr]=Jeu multijoueurs de type bac à sable avec des mondes infinis +Comment[de]=Mehrspieler-Sandkastenspiel mit unendlichen Blockwelten Exec=minetest Icon=minetest-icon Terminal=false -- cgit v1.2.3 From 4875213168ed877ab708e81d539923109977a5c8 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 17 Feb 2015 10:29:44 +0100 Subject: Grab GUIChatConsole::m_font, fixes segfault when changing font_size --- src/guiChatConsole.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index bdce7c872..8210e0bf4 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -99,7 +99,7 @@ GUIChatConsole::GUIChatConsole( { core::dimension2d dim = m_font->getDimension(L"M"); m_fontsize = v2u32(dim.Width, dim.Height); - dstream << "Font size: " << m_fontsize.X << " " << m_fontsize.Y << std::endl; + m_font->grab(); } m_fontsize.X = MYMAX(m_fontsize.X, 1); m_fontsize.Y = MYMAX(m_fontsize.Y, 1); @@ -109,7 +109,10 @@ GUIChatConsole::GUIChatConsole( } GUIChatConsole::~GUIChatConsole() -{} +{ + if (m_font) + m_font->drop(); +} void GUIChatConsole::openConsole(f32 height) { -- cgit v1.2.3 From 4208fdfd2273b715eeddb8b9877c2def8346d447 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Tue, 17 Feb 2015 20:09:36 +0100 Subject: Fix unused (and so, broken) enable_rollback_recording. This option must be reloaded at server loop but loaded when server starts, for data consistency (not a hot load variable) --- builtin/game/chatcommands.lua | 10 ++++++++++ minetest.conf.example | 1 + src/map.cpp | 4 ++-- src/script/lua_api/l_rollback.cpp | 10 ++++++++++ src/server.cpp | 13 ++++++------- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 2d94817e8..91b685fdf 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -570,6 +570,9 @@ core.register_chatcommand("rollback_check", { .. " seconds=86400=24h, limit=5)", privs = {rollback=true}, func = function(name, param) + if not core.setting_getbool("enable_rollback_recording") then + return false, "Rollback functions are disabled." + end local range, seconds, limit = param:match("(%d+) *(%d*) *(%d*)") range = tonumber(range) or 0 @@ -583,6 +586,10 @@ core.register_chatcommand("rollback_check", { local name = puncher:get_player_name() core.chat_send_player(name, "Checking " .. core.pos_to_string(pos) .. "...") local actions = core.rollback_get_node_actions(pos, range, seconds, limit) + if not actions then + core.chat_send_player(name, "Rollback functions are disabled") + return + end local num_actions = #actions if num_actions == 0 then core.chat_send_player(name, "Nobody has touched" @@ -614,6 +621,9 @@ core.register_chatcommand("rollback", { description = "revert actions of a player; default for is 60", privs = {rollback=true}, func = function(name, param) + if not core.setting_getbool("enable_rollback_recording") then + return false, "Rollback functions are disabled." + end local target_name, seconds = string.match(param, ":([^ ]+) *(%d*)") if not target_name then local player_name = nil diff --git a/minetest.conf.example b/minetest.conf.example index eb883fa8e..eefe3b7bc 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -337,6 +337,7 @@ # If true, disable cheat prevention in multiplayer #disable_anticheat = false # If true, actions are recorded for rollback +# This option is only read when server starts #enable_rollback_recording = false # Handling for deprecated lua api calls: # "legacy" = (try to) mimic old behaviour (default for release). diff --git a/src/map.cpp b/src/map.cpp index d8f018742..efa53ca08 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1863,11 +1863,11 @@ void Map::transformLiquids(std::map & modified_blocks) // Find out whether there is a suspect for this action std::string suspect; - if(m_gamedef->rollback()){ + if(m_gamedef->rollback()) { suspect = m_gamedef->rollback()->getSuspect(p0, 83, 1); } - if(!suspect.empty()){ + if(m_gamedef->rollback() && !suspect.empty()){ // Blame suspect RollbackScopeActor rollback_scope(m_gamedef->rollback(), suspect, true); // Get old node for rollback diff --git a/src/script/lua_api/l_rollback.cpp b/src/script/lua_api/l_rollback.cpp index f55a72d1b..5744e6813 100644 --- a/src/script/lua_api/l_rollback.cpp +++ b/src/script/lua_api/l_rollback.cpp @@ -44,6 +44,9 @@ int ModApiRollback::l_rollback_get_node_actions(lua_State *L) int limit = luaL_checknumber(L, 4); Server *server = getServer(L); IRollbackManager *rollback = server->getRollbackManager(); + if (rollback == NULL) { + return 0; + } std::list actions = rollback->getNodeActors(pos, range, seconds, limit); std::list::iterator iter = actions.begin(); @@ -80,6 +83,13 @@ int ModApiRollback::l_rollback_revert_actions_by(lua_State *L) int seconds = luaL_checknumber(L, 2); Server *server = getServer(L); IRollbackManager *rollback = server->getRollbackManager(); + + // If rollback is disabled, tell it's not a success. + if (rollback == NULL) { + lua_pushboolean(L, false); + lua_newtable(L); + return 2; + } std::list actions = rollback->getRevertActions(actor, seconds); std::list log; bool success = server->rollbackRevertActions(actions, &log); diff --git a/src/server.cpp b/src/server.cpp index 399c41b70..2d84ad032 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -244,9 +244,6 @@ Server::Server( std::string ban_path = m_path_world + DIR_DELIM "ipban.txt"; m_banmanager = new BanManager(ban_path); - // Create rollback manager - m_rollback = new RollbackManager(m_path_world, this); - ModConfiguration modconf(m_path_world); m_mods = modconf.getMods(); std::vector unsatisfied_mods = modconf.getUnsatisfiedMods(); @@ -354,6 +351,12 @@ Server::Server( // Initialize mapgens m_emerge->initMapgens(); + m_enable_rollback_recording = g_settings->getBool("enable_rollback_recording"); + if (m_enable_rollback_recording) { + // Create rollback manager + m_rollback = new RollbackManager(m_path_world, this); + } + // Give environment reference to scripting api m_script->initializeEnvironment(m_env); @@ -1108,10 +1111,6 @@ void Server::AsyncRunStep(bool initial_step) counter = 0.0; m_emerge->startThreads(); - - // Update m_enable_rollback_recording here too - m_enable_rollback_recording = - g_settings->getBool("enable_rollback_recording"); } } -- cgit v1.2.3 From bb603ff18ebc62fdd5799118eee318747f60744a Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 18 Feb 2015 11:45:23 +0200 Subject: Use fixed size for builtin menus on non-android platforms --- builtin/mainmenu/init.lua | 6 +++++- src/game.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index dfaa04d3c..d008ec8b0 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -139,7 +139,11 @@ local function init_globals() tv_main:add(tab_credits) tv_main:set_global_event_handler(main_event_handler) - tv_main:set_fixed_size(false) + if PLATFORM ~= "Android" then + tv_main:set_fixed_size(true) + else + tv_main:set_fixed_size(false) + end if not (PLATFORM == "Android") then tv_main:set_tab(core.setting_get("maintab_LAST")) diff --git a/src/game.cpp b/src/game.cpp index 896973515..8e88fbc8f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1043,7 +1043,11 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec, } } +#ifdef __ANDROID__ #define SIZE_TAG "size[11,5.5]" +#else +#define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop +#endif static void show_chat_menu(GUIFormSpecMenu **cur_formspec, InventoryManager *invmgr, IGameDef *gamedef, -- cgit v1.2.3 From 6f688c50ee12fa731cbd5e5846d4f1e74e8ad7b7 Mon Sep 17 00:00:00 2001 From: BlockMen Date: Sat, 14 Feb 2015 20:16:09 +0100 Subject: Fix font_size under windows --- src/constants.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/constants.h b/src/constants.h index 9a7bb9d86..53a2608bd 100644 --- a/src/constants.h +++ b/src/constants.h @@ -100,7 +100,13 @@ with this program; if not, write to the Free Software Foundation, Inc., /* GUI related things */ -#define TTF_DEFAULT_FONT_SIZE (14) + +// TODO: implement dpi-based scaling for windows and remove this hack +#if defined(_WIN32) + #define TTF_DEFAULT_FONT_SIZE (18) +#else + #define TTF_DEFAULT_FONT_SIZE (14) +#endif #define DEFAULT_FONT_SIZE (10) #endif -- cgit v1.2.3 From 678546308ef2cf4b45c557dc5c227354a216486f Mon Sep 17 00:00:00 2001 From: BlockMen Date: Wed, 18 Feb 2015 12:37:53 +0100 Subject: Increase default font_size --- minetest.conf.example | 6 +++--- src/constants.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index eefe3b7bc..88e2db8ab 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -252,16 +252,16 @@ #freetype = true # Path to TrueTypeFont or bitmap #font_path = fonts/liberationsans.ttf -#font_size = 13 +#font_size = 15 # Font shadow offset, if 0 then shadow will not be drawn #font_shadow = 1 # Font shadow alpha (opaqueness, between 0 and 255) #font_shadow_alpha = 128 #mono_font_path = fonts/liberationmono.ttf -#mono_font_size = 13 +#mono_font_size = 15 # This font will be used for certain languages #fallback_font_path = fonts/DroidSansFallbackFull.ttf -#fallback_font_size = 13 +#fallback_font_size = 15 #fallback_font_shadow = 1 #fallback_font_shadow_alpha = 128 # Override language. When no value is provided (default) system language is used. diff --git a/src/constants.h b/src/constants.h index 53a2608bd..d7163bf68 100644 --- a/src/constants.h +++ b/src/constants.h @@ -105,7 +105,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #if defined(_WIN32) #define TTF_DEFAULT_FONT_SIZE (18) #else - #define TTF_DEFAULT_FONT_SIZE (14) + #define TTF_DEFAULT_FONT_SIZE (15) #endif #define DEFAULT_FONT_SIZE (10) -- cgit v1.2.3 From 9ef2e5000f6df5a0c16e0343c6af59967150db42 Mon Sep 17 00:00:00 2001 From: fz72 Date: Tue, 17 Feb 2015 16:53:49 +0100 Subject: Fix map_seed not changed when creating a new world after login to another --- builtin/mainmenu/dlg_create_world.lua | 4 ++-- src/emerge.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 32e1fbf83..b42d119e0 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -90,6 +90,8 @@ local function create_world_buttonhandler(this, fields) local message = nil + core.setting_set("fixed_map_seed", fields["te_seed"]) + if not menudata.worldlist:uid_exists_raw(worldname) then core.setting_set("mg_name",fields["dd_mapgen"]) message = core.create_world(worldname,gameindex) @@ -97,8 +99,6 @@ local function create_world_buttonhandler(this, fields) message = fgettext("A world named \"$1\" already exists", worldname) end - core.setting_set("fixed_map_seed", fields["te_seed"]) - if message ~= nil then gamedata.errormessage = message else diff --git a/src/emerge.cpp b/src/emerge.cpp index c485caffa..a697bcb07 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -361,7 +361,10 @@ void EmergeManager::loadParamsFromSettings(Settings *settings) std::string seed_str; const char *setname = (settings == g_settings) ? "fixed_map_seed" : "seed"; - if (settings->getNoEx(setname, seed_str) && !seed_str.empty()) { + if (!settings->getNoEx("seed", seed_str)) { + g_settings->getNoEx(setname, seed_str); + } + if (!seed_str.empty()) { params.seed = read_seed(seed_str.c_str()); } else { params.seed = -- cgit v1.2.3 From 82bfa2ee7b90f678b687fb42405ca775c517be13 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 17 Feb 2015 01:37:14 +0100 Subject: Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist Client now informs about incompatible servers from the list, this permits to prevent the protocol movements. Server announces its supported protocol versions to master server --- builtin/common/misc_helpers.lua | 8 ++++-- builtin/mainmenu/common.lua | 56 ++++++++++++++++++++++++++++++++++-- builtin/mainmenu/tab_multiplayer.lua | 13 +++++++-- builtin/mainmenu/tab_simple_main.lua | 7 ++++- doc/menu_lua_api.txt | 12 ++++++-- src/script/lua_api/l_mainmenu.cpp | 28 ++++++++++++++++++ src/script/lua_api/l_mainmenu.h | 6 ++++ src/serverlist.cpp | 11 +++++-- 8 files changed, 129 insertions(+), 12 deletions(-) diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index d9ebc39c3..39fca7d1e 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -564,7 +564,7 @@ if INIT == "mainmenu" then return nil end - function fgettext(text, ...) + function fgettext_ne(text, ...) text = core.gettext(text) local arg = {n=select('#', ...), ...} if arg.n >= 1 then @@ -586,7 +586,11 @@ if INIT == "mainmenu" then end text = result end - return core.formspec_escape(text) + return text + end + + function fgettext(text, ...) + return core.formspec_escape(fgettext_ne(text, ...)) end end diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua index 549c0967b..f32d77f2a 100644 --- a/builtin/mainmenu/common.lua +++ b/builtin/mainmenu/common.lua @@ -16,9 +16,15 @@ --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------------- -- Global menu data ---------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- menudata = {} +-------------------------------------------------------------------------------- +-- Local cached values +-------------------------------------------------------------------------------- +local min_supp_proto = core.get_min_supp_proto() +local max_supp_proto = core.get_max_supp_proto() + -------------------------------------------------------------------------------- -- Menu helper functions -------------------------------------------------------------------------------- @@ -42,6 +48,25 @@ function image_column(tooltip, flagname) "1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_" .. flagname .. ".png") end +-------------------------------------------------------------------------------- +function order_favorite_list(list) + local res = {} + --orders the favorite list after support + for i=1,#list,1 do + local fav = list[i] + if is_server_protocol_compat(fav.proto_min, fav.proto_max) then + table.insert(res, fav) + end + end + for i=1,#list,1 do + local fav = list[i] + if not is_server_protocol_compat(fav.proto_min, fav.proto_max) then + table.insert(res, fav) + end + end + return res +end + -------------------------------------------------------------------------------- function render_favorite(spec,render_details) local text = "" @@ -68,6 +93,7 @@ function render_favorite(spec,render_details) end local details = "" + local grey_out = not is_server_protocol_compat(spec.proto_max, spec.proto_min) if spec.clients ~= nil and spec.clients_max ~= nil then local clients_color = '' @@ -87,11 +113,17 @@ function render_favorite(spec,render_details) clients_color = '#ffba97' -- 90-100%: orange end + if grey_out then + clients_color = '#aaaaaa' + end + details = details .. clients_color .. ',' .. render_client_count(spec.clients) .. ',' .. '/,' .. render_client_count(spec.clients_max) .. ',' + elseif grey_out then + details = details .. '#aaaaaa,?,/,?,' else details = details .. ',?,/,?,' end @@ -114,7 +146,7 @@ function render_favorite(spec,render_details) details = details .. "0," end - return details .. text + return details .. (grey_out and '#aaaaaa,' or ',') .. text end -------------------------------------------------------------------------------- @@ -195,7 +227,7 @@ function asyncOnlineFavourites() nil, function(result) if core.setting_getbool("public_serverlist") then - menudata.favorites = result + menudata.favorites = order_favorite_list(result) core.event_handler("Refresh") end end @@ -225,3 +257,21 @@ function text2textlist(xpos,ypos,width,height,tl_name,textlen,text,transparency) return retval end + +-------------------------------------------------------------------------------- +function is_server_protocol_compat(proto_min, proto_max) + return not ((min_supp_proto > (proto_max or 24)) or (max_supp_proto < (proto_min or 13))) +end +-------------------------------------------------------------------------------- +function is_server_protocol_compat_or_error(proto_min, proto_max) + if not is_server_protocol_compat(proto_min, proto_max) then + gamedata.errormessage = fgettext_ne("Protocol version mismatch, server " .. + ((proto_min ~= proto_max) and "supports protocols between $1 and $2" or "enforces protocol version $1") .. + ", we " .. + ((min_supp_proto ~= max_supp_proto) and "support protocols between version $3 and $4." or "only support protocol version $3"), + proto_min or 13, proto_max or 24, min_supp_proto, max_supp_proto) + return false + end + + return true +end diff --git a/builtin/mainmenu/tab_multiplayer.lua b/builtin/mainmenu/tab_multiplayer.lua index 734cb5d3e..f9ac78f17 100644 --- a/builtin/mainmenu/tab_multiplayer.lua +++ b/builtin/mainmenu/tab_multiplayer.lua @@ -62,6 +62,7 @@ local function get_formspec(tabview, name, tabdata) image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" .. image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" .. image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" .. + "color,span=1;" .. "text,padding=1]" -- name else retval = retval .. "tablecolumns[text]" @@ -88,7 +89,6 @@ end -------------------------------------------------------------------------------- local function main_button_handler(tabview, fields, name, tabdata) - if fields["te_name"] ~= nil then gamedata.playername = fields["te_name"] core.setting_set("name", fields["te_name"]) @@ -98,6 +98,10 @@ local function main_button_handler(tabview, fields, name, tabdata) local event = core.explode_table_event(fields["favourites"]) if event.type == "DCL" then if event.row <= #menudata.favorites then + if not is_server_protocol_compat_or_error(menudata.favorites[event.row].proto_min, + menudata.favorites[event.row].proto_max) then + return true + end gamedata.address = menudata.favorites[event.row].address gamedata.port = menudata.favorites[event.row].port gamedata.playername = fields["te_name"] @@ -189,7 +193,7 @@ local function main_button_handler(tabview, fields, name, tabdata) local current_favourite = core.get_table_index("favourites") if current_favourite == nil then return end core.delete_favorite(current_favourite) - menudata.favorites = core.get_favorites() + menudata.favorites = order_favorite_list(core.get_favorites()) tabdata.fav_selected = nil core.setting_set("address","") @@ -214,6 +218,11 @@ local function main_button_handler(tabview, fields, name, tabdata) gamedata.servername = menudata.favorites[fav_idx].name gamedata.serverdescription = menudata.favorites[fav_idx].description + + if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min, + menudata.favorites[fav_idx].proto_max)then + return true + end else gamedata.servername = "" gamedata.serverdescription = "" diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua index 87bd551c0..b9a6b650f 100644 --- a/builtin/mainmenu/tab_simple_main.lua +++ b/builtin/mainmenu/tab_simple_main.lua @@ -45,6 +45,7 @@ local function get_formspec(tabview, name, tabdata) image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" .. image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" .. image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" .. + "color,span=1;" .. "text,padding=1]" -- name else retval = retval .. "tablecolumns[text]" @@ -87,7 +88,6 @@ local function get_formspec(tabview, name, tabdata) end -------------------------------------------------------------------------------- - local function main_button_handler(tabview, fields, name, tabdata) if fields["btn_start_singleplayer"] then @@ -159,6 +159,11 @@ local function main_button_handler(tabview, fields, name, tabdata) gamedata.servername = menudata.favorites[fav_idx].name gamedata.serverdescription = menudata.favorites[fav_idx].description + + if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min, + menudata.favorites[fav_idx].proto_max) then + return true + end else gamedata.servername = "" gamedata.serverdescription = "" diff --git a/doc/menu_lua_api.txt b/doc/menu_lua_api.txt index 5c0f90df6..f76124a0d 100644 --- a/doc/menu_lua_api.txt +++ b/doc/menu_lua_api.txt @@ -197,9 +197,11 @@ core.delete_world(index) Helpers: core.gettext(string) -> string ^ look up the translation of a string in the gettext message catalog -fgettext(string, ...) -> string +fgettext_ne(string, ...) ^ call core.gettext(string), replace "$1"..."$9" with the given -^ extra arguments, call core.formspec_escape and return the result +^ extra arguments and return the result +fgettext(string, ...) -> string +^ same as fgettext_ne(), but calls core.formspec_escape before returning result core.parse_json(string[, nullvalue]) -> something (possible in async calls) ^ see core.parse_json (lua_api.txt) dump(obj, dumped={}) @@ -211,6 +213,12 @@ string:trim() core.is_yes(arg) (possible in async calls) ^ returns whether arg can be interpreted as yes +Version compat: +core.get_min_supp_proto() +^ returns the minimum supported network protocol version +core.get_max_supp_proto() +^ returns the maximum supported network protocol version + Async: core.handle_async(async_job,parameters,finished) ^ execute a function asynchronously diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 0d8365106..2bed2a255 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -472,6 +472,7 @@ int ModApiMainMenu::l_get_favorites(lua_State *L) for (unsigned int i = 0; i < servers.size(); i++) { + lua_pushnumber(L,index); lua_newtable(L); @@ -509,6 +510,18 @@ int ModApiMainMenu::l_get_favorites(lua_State *L) lua_settable(L, top_lvl2); } + if (servers[i]["proto_min"].asString().size()) { + lua_pushstring(L,"proto_min"); + lua_pushinteger(L,servers[i]["proto_min"].asInt()); + lua_settable(L, top_lvl2); + } + + if (servers[i]["proto_max"].asString().size()) { + lua_pushstring(L,"proto_max"); + lua_pushinteger(L,servers[i]["proto_max"].asInt()); + lua_settable(L, top_lvl2); + } + if (servers[i]["password"].asString().size()) { lua_pushstring(L,"password"); lua_pushboolean(L,servers[i]["password"].asBool()); @@ -1082,6 +1095,19 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L) return 1; } +/******************************************************************************/ +int ModApiMainMenu::l_get_min_supp_proto(lua_State *L) +{ + lua_pushinteger(L, CLIENT_PROTOCOL_VERSION_MIN); + return 1; +} + +int ModApiMainMenu::l_get_max_supp_proto(lua_State *L) +{ + lua_pushinteger(L, CLIENT_PROTOCOL_VERSION_MAX); + return 1; +} + /******************************************************************************/ int ModApiMainMenu::l_do_async_callback(lua_State *L) { @@ -1142,6 +1168,8 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(gettext); API_FCT(get_video_drivers); API_FCT(get_screen_info); + API_FCT(get_min_supp_proto); + API_FCT(get_max_supp_proto); API_FCT(do_async_callback); } diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index ff61dd97a..8b21a93aa 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -137,6 +137,12 @@ private: static int l_get_video_drivers(lua_State *L); + //version compatibility + static int l_get_min_supp_proto(lua_State *L); + + static int l_get_max_supp_proto(lua_State *L); + + // async static int l_do_async_callback(lua_State *L); diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 472a6b85c..a3353340e 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include "porting.h" #include "log.h" +#include "network/networkprotocol.h" #include "json/json.h" #include "convert_json.h" #include "httpfetch.h" @@ -67,8 +68,11 @@ std::vector getLocal() std::vector getOnline() { - Json::Value root = fetchJsonValue( - (g_settings->get("serverlist_url") + "/list").c_str(), NULL); + std::ostringstream geturl; + geturl << g_settings->get("serverlist_url") << + "/list?proto_version_min=" << CLIENT_PROTOCOL_VERSION_MIN << + "&proto_version_max=" << CLIENT_PROTOCOL_VERSION_MAX; + Json::Value root = fetchJsonValue(geturl.str(), NULL); std::vector server_list; @@ -205,9 +209,12 @@ void sendAnnounce(const std::string &action, server["address"] = g_settings->get("server_address"); } if (action != "delete") { + bool strict_checking = g_settings->getBool("strict_protocol_version_checking"); server["name"] = g_settings->get("server_name"); server["description"] = g_settings->get("server_description"); server["version"] = minetest_version_simple; + server["proto_min"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MIN; + server["proto_max"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MAX; server["url"] = g_settings->get("server_url"); server["creative"] = g_settings->getBool("creative_mode"); server["damage"] = g_settings->getBool("enable_damage"); -- cgit v1.2.3 From 45ff8569d7655b480456884745db4a23a07aa722 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 18 Feb 2015 16:26:23 +0100 Subject: Fix serverlist include --- src/serverlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index a3353340e..6732e5ac9 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include "porting.h" #include "log.h" -#include "network/networkprotocol.h" +#include "clientserver.h" #include "json/json.h" #include "convert_json.h" #include "httpfetch.h" -- cgit v1.2.3 From b0df67d9c062a08a93d24c304bdbc72b0ced0898 Mon Sep 17 00:00:00 2001 From: Novatux Date: Wed, 18 Feb 2015 16:48:58 +0100 Subject: Add modname convention checking Fixes #2037 --- builtin/mainmenu/dlg_config_world.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua index a15e4c11f..4d13faea8 100644 --- a/builtin/mainmenu/dlg_config_world.lua +++ b/builtin/mainmenu/dlg_config_world.lua @@ -16,6 +16,9 @@ --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------------- +local function modname_valid(name) + return not name:find("[^a-z0-9_]") +end local function get_formspec(data) @@ -195,10 +198,12 @@ local function handle_buttons(this, fields) for i,mod in ipairs(rawlist) do if not mod.is_modpack and mod.typ ~= "game_mod" then - if mod.enabled then - worldfile:set("load_mod_"..mod.name, "true") + if modname_valid(mod.name) then + worldfile:set("load_mod_"..mod.name, tostring(mod.enabled)) else - worldfile:set("load_mod_"..mod.name, "false") + if mod.enabled then + gamedata.errormessage = fgettext_ne("Failed to enable mod \"$1\" as it contains disallowed characters. Only chararacters [a-z0-9_] are allowed.", mod.name) + end end mods["load_mod_"..mod.name] = nil end -- cgit v1.2.3 From 7993a403f2c17a215e4895ba1848aaf69bb61980 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 18 Feb 2015 19:50:37 +0200 Subject: Bump version to 0.4.12 --- CMakeLists.txt | 4 ++-- build/android/Makefile | 2 +- doc/lua_api.txt | 2 +- doc/menu_lua_api.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c64b2e76..98d9aee0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,14 +12,14 @@ set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing set(VERSION_MAJOR 0) set(VERSION_MINOR 4) -set(VERSION_PATCH 11) +set(VERSION_PATCH 12) set(VERSION_PATCH_ORIG ${VERSION_PATCH}) if(VERSION_EXTRA) set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA}) else() # Comment the following line during release - set(VERSION_PATCH ${VERSION_PATCH}-dev) + #set(VERSION_PATCH ${VERSION_PATCH}-dev) endif() set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") diff --git a/build/android/Makefile b/build/android/Makefile index 68625b6a7..6027982ed 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -26,7 +26,7 @@ GAMES_TO_COPY = minetest_game # Android Version code # Increase for each build! ################################################################################ -ANDROID_VERSION_CODE = 5 +ANDROID_VERSION_CODE = 6 ################################################################################ # toolchain config for arm old processors diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 586c520fc..d2d885880 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Modding API Reference 0.4.11 +Minetest Lua Modding API Reference 0.4.12 ========================================= * More information at * Developer Wiki: diff --git a/doc/menu_lua_api.txt b/doc/menu_lua_api.txt index f76124a0d..e5ba46d4c 100644 --- a/doc/menu_lua_api.txt +++ b/doc/menu_lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Mainmenu API Reference 0.4.11 +Minetest Lua Mainmenu API Reference 0.4.12 ======================================== Introduction -- cgit v1.2.3 From b12f569fc6b78c1e657bc0cfd8518b997d5f83c7 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sat, 14 Mar 2015 19:57:21 +0100 Subject: Releasing android --- build/android/AndroidManifest.xml.template | 2 +- build/android/Makefile | 2 +- .../net/minetest/minetest/MinetestAssetCopy.java | 456 +++++++++++++++++++++ .../net/minetest/minetest/MinetestTextEntry.java | 91 ++++ .../net/minetest/minetest/MtNativeActivity.java | 93 +++++ .../org/minetest/minetest/MinetestAssetCopy.java | 456 --------------------- .../org/minetest/minetest/MinetestTextEntry.java | 91 ---- .../org/minetest/minetest/MtNativeActivity.java | 93 ----- src/porting_android.cpp | 6 +- 9 files changed, 645 insertions(+), 645 deletions(-) create mode 100644 build/android/src/net/minetest/minetest/MinetestAssetCopy.java create mode 100644 build/android/src/net/minetest/minetest/MinetestTextEntry.java create mode 100644 build/android/src/net/minetest/minetest/MtNativeActivity.java delete mode 100644 build/android/src/org/minetest/minetest/MinetestAssetCopy.java delete mode 100644 build/android/src/org/minetest/minetest/MinetestTextEntry.java delete mode 100644 build/android/src/org/minetest/minetest/MtNativeActivity.java diff --git a/build/android/AndroidManifest.xml.template b/build/android/AndroidManifest.xml.template index a0ca7993c..0f75ca648 100644 --- a/build/android/AndroidManifest.xml.template +++ b/build/android/AndroidManifest.xml.template @@ -1,6 +1,6 @@ diff --git a/build/android/Makefile b/build/android/Makefile index 6027982ed..ef9376df3 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -26,7 +26,7 @@ GAMES_TO_COPY = minetest_game # Android Version code # Increase for each build! ################################################################################ -ANDROID_VERSION_CODE = 6 +ANDROID_VERSION_CODE = 10 ################################################################################ # toolchain config for arm old processors diff --git a/build/android/src/net/minetest/minetest/MinetestAssetCopy.java b/build/android/src/net/minetest/minetest/MinetestAssetCopy.java new file mode 100644 index 000000000..5776e77b5 --- /dev/null +++ b/build/android/src/net/minetest/minetest/MinetestAssetCopy.java @@ -0,0 +1,456 @@ +package net.minetest.minetest; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.util.Vector; +import java.util.Iterator; +import java.lang.Object; + +import android.app.Activity; +import android.content.res.AssetFileDescriptor; + +import android.os.AsyncTask; +import android.os.Bundle; +import android.os.Environment; +import android.util.Log; +import android.view.Display; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.graphics.Rect; +import android.graphics.Paint; +import android.text.TextPaint; + +public class MinetestAssetCopy extends Activity +{ + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + setContentView(R.layout.assetcopy); + + m_ProgressBar = (ProgressBar) findViewById(R.id.progressBar1); + m_Filename = (TextView) findViewById(R.id.textView1); + + Display display = getWindowManager().getDefaultDisplay(); + m_ProgressBar.getLayoutParams().width = (int) (display.getWidth() * 0.8); + m_ProgressBar.invalidate(); + + /* check if there's already a copy in progress and reuse in case it is*/ + MinetestAssetCopy prevActivity = + (MinetestAssetCopy) getLastNonConfigurationInstance(); + if(prevActivity!= null) { + m_AssetCopy = prevActivity.m_AssetCopy; + } + else { + m_AssetCopy = new copyAssetTask(); + m_AssetCopy.execute(); + } + } + + /* preserve asset copy background task to prevent restart of copying */ + /* this way of doing it is not recommended for latest android version */ + /* but the recommended way isn't available on android 2.x */ + public Object onRetainNonConfigurationInstance() + { + return this; + } + + ProgressBar m_ProgressBar; + TextView m_Filename; + + copyAssetTask m_AssetCopy; + + private class copyAssetTask extends AsyncTask + { + private long getFullSize(String filename) + { + long size = 0; + try { + InputStream src = getAssets().open(filename); + byte[] buf = new byte[4096]; + + int len = 0; + while ((len = src.read(buf)) > 0) + { + size += len; + } + } + catch (IOException e) + { + e.printStackTrace(); + } + return size; + } + + @Override + protected String doInBackground(String... files) + { + m_foldernames = new Vector(); + m_filenames = new Vector(); + m_tocopy = new Vector(); + m_asset_size_unknown = new Vector(); + String baseDir = + Environment.getExternalStorageDirectory().getAbsolutePath() + + "/"; + + + // prepare temp folder + File TempFolder = new File(baseDir + "Minetest/tmp/"); + + if (!TempFolder.exists()) + { + TempFolder.mkdir(); + } + else { + File[] todel = TempFolder.listFiles(); + + for(int i=0; i < todel.length; i++) + { + Log.v("MinetestAssetCopy","deleting: " + todel[i].getAbsolutePath()); + todel[i].delete(); + } + } + + // add a .nomedia file + try { + OutputStream dst = new FileOutputStream(baseDir + "Minetest/.nomedia"); + dst.close(); + } catch (IOException e) { + Log.e("MinetestAssetCopy","Failed to create .nomedia file"); + e.printStackTrace(); + } + + + // build lists from prepared data + BuildFolderList(); + BuildFileList(); + + // scan filelist + ProcessFileList(); + + // doing work + m_copy_started = true; + m_ProgressBar.setMax(m_tocopy.size()); + + for (int i = 0; i < m_tocopy.size(); i++) + { + try + { + String filename = m_tocopy.get(i); + publishProgress(i); + + boolean asset_size_unknown = false; + long filesize = -1; + + if (m_asset_size_unknown.contains(filename)) + { + File testme = new File(baseDir + "/" + filename); + + if(testme.exists()) + { + filesize = testme.length(); + } + asset_size_unknown = true; + } + + InputStream src; + try + { + src = getAssets().open(filename); + } catch (IOException e) { + Log.e("MinetestAssetCopy","Copying file: " + filename + " FAILED (not in assets)"); + e.printStackTrace(); + continue; + } + + // Transfer bytes from in to out + byte[] buf = new byte[1*1024]; + int len = src.read(buf, 0, 1024); + + /* following handling is crazy but we need to deal with */ + /* compressed assets.Flash chips limited livetime due to */ + /* write operations, we can't allow large files to destroy */ + /* users flash. */ + if (asset_size_unknown) + { + if ( (len > 0) && (len < buf.length) && (len == filesize)) + { + src.close(); + continue; + } + + if (len == buf.length) + { + src.close(); + long size = getFullSize(filename); + if ( size == filesize) + { + continue; + } + src = getAssets().open(filename); + len = src.read(buf, 0, 1024); + } + } + if (len > 0) + { + int total_filesize = 0; + OutputStream dst; + try + { + dst = new FileOutputStream(baseDir + "/" + filename); + } catch (IOException e) { + Log.e("MinetestAssetCopy","Copying file: " + baseDir + + "/" + filename + " FAILED (couldn't open output file)"); + e.printStackTrace(); + src.close(); + continue; + } + dst.write(buf, 0, len); + total_filesize += len; + + while ((len = src.read(buf)) > 0) + { + dst.write(buf, 0, len); + total_filesize += len; + } + + dst.close(); + Log.v("MinetestAssetCopy","Copied file: " + + m_tocopy.get(i) + " (" + total_filesize + + " bytes)"); + } + else if (len < 0) + { + Log.e("MinetestAssetCopy","Copying file: " + + m_tocopy.get(i) + " failed, size < 0"); + } + src.close(); + } + catch (IOException e) + { + Log.e("MinetestAssetCopy","Copying file: " + + m_tocopy.get(i) + " failed"); + e.printStackTrace(); + } + } + return ""; + } + + + /** + * update progress bar + */ + protected void onProgressUpdate(Integer... progress) + { + + if (m_copy_started) + { + boolean shortened = false; + String todisplay = m_tocopy.get(progress[0]); + m_ProgressBar.setProgress(progress[0]); + + // make sure our text doesn't exceed our layout width + Rect bounds = new Rect(); + Paint textPaint = m_Filename.getPaint(); + textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds); + + while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) { + if (todisplay.length() < 2) { + break; + } + todisplay = todisplay.substring(1); + textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds); + shortened = true; + } + + if (! shortened) { + m_Filename.setText(todisplay); + } + else { + m_Filename.setText(".." + todisplay); + } + } + else + { + boolean shortened = false; + String todisplay = m_Foldername; + String full_text = "scanning " + todisplay + " ..."; + // make sure our text doesn't exceed our layout width + Rect bounds = new Rect(); + Paint textPaint = m_Filename.getPaint(); + textPaint.getTextBounds(full_text, 0, full_text.length(), bounds); + + while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) { + if (todisplay.length() < 2) { + break; + } + todisplay = todisplay.substring(1); + full_text = "scanning " + todisplay + " ..."; + textPaint.getTextBounds(full_text, 0, full_text.length(), bounds); + shortened = true; + } + + if (! shortened) { + m_Filename.setText(full_text); + } + else { + m_Filename.setText("scanning .." + todisplay + " ..."); + } + } + } + + /** + * check al files and folders in filelist + */ + protected void ProcessFileList() + { + String FlashBaseDir = + Environment.getExternalStorageDirectory().getAbsolutePath(); + + Iterator itr = m_filenames.iterator(); + + while (itr.hasNext()) + { + String current_path = (String) itr.next(); + String FlashPath = FlashBaseDir + "/" + current_path; + + if (isAssetFolder(current_path)) + { + /* store information and update gui */ + m_Foldername = current_path; + publishProgress(0); + + /* open file in order to check if it's a folder */ + File current_folder = new File(FlashPath); + if (!current_folder.exists()) + { + if (!current_folder.mkdirs()) + { + Log.e("MinetestAssetCopy","\t failed create folder: " + + FlashPath); + } + else + { + Log.v("MinetestAssetCopy","\t created folder: " + + FlashPath); + } + } + + continue; + } + + /* if it's not a folder it's most likely a file */ + boolean refresh = true; + + File testme = new File(FlashPath); + + long asset_filesize = -1; + long stored_filesize = -1; + + if (testme.exists()) + { + try + { + AssetFileDescriptor fd = getAssets().openFd(current_path); + asset_filesize = fd.getLength(); + fd.close(); + } + catch (IOException e) + { + refresh = true; + m_asset_size_unknown.add(current_path); + Log.e("MinetestAssetCopy","Failed to open asset file \"" + + FlashPath + "\" for size check"); + } + + stored_filesize = testme.length(); + + if (asset_filesize == stored_filesize) + { + refresh = false; + } + + } + + if (refresh) + { + m_tocopy.add(current_path); + } + } + } + + /** + * read list of folders prepared on package build + */ + protected void BuildFolderList() + { + try + { + InputStream is = getAssets().open("index.txt"); + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + String line = reader.readLine(); + while (line != null) + { + m_foldernames.add(line); + line = reader.readLine(); + } + is.close(); + } catch (IOException e1) + { + Log.e("MinetestAssetCopy","Error on processing index.txt"); + e1.printStackTrace(); + } + } + + /** + * read list of asset files prepared on package build + */ + protected void BuildFileList() + { + long entrycount = 0; + try + { + InputStream is = getAssets().open("filelist.txt"); + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + String line = reader.readLine(); + while (line != null) + { + m_filenames.add(line); + line = reader.readLine(); + entrycount ++; + } + is.close(); + } + catch (IOException e1) + { + Log.e("MinetestAssetCopy","Error on processing filelist.txt"); + e1.printStackTrace(); + } + } + + protected void onPostExecute (String result) + { + finish(); + } + + protected boolean isAssetFolder(String path) + { + return m_foldernames.contains(path); + } + + boolean m_copy_started = false; + String m_Foldername = "media"; + Vector m_foldernames; + Vector m_filenames; + Vector m_tocopy; + Vector m_asset_size_unknown; + } +} diff --git a/build/android/src/net/minetest/minetest/MinetestTextEntry.java b/build/android/src/net/minetest/minetest/MinetestTextEntry.java new file mode 100644 index 000000000..68dc73274 --- /dev/null +++ b/build/android/src/net/minetest/minetest/MinetestTextEntry.java @@ -0,0 +1,91 @@ +package net.minetest.minetest; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.text.InputType; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnKeyListener; +import android.widget.EditText; + +public class MinetestTextEntry extends Activity { + public AlertDialog mTextInputDialog; + public EditText mTextInputWidget; + + private final int MultiLineTextInput = 1; + private final int SingleLineTextInput = 2; + private final int SingleLinePasswordInput = 3; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Bundle b = getIntent().getExtras(); + String acceptButton = b.getString("EnterButton"); + String hint = b.getString("hint"); + String current = b.getString("current"); + int editType = b.getInt("editType"); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + mTextInputWidget = new EditText(this); + mTextInputWidget.setHint(hint); + mTextInputWidget.setText(current); + mTextInputWidget.setMinWidth(300); + if (editType == SingleLinePasswordInput) { + mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_VARIATION_PASSWORD); + } + else { + mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT); + } + + + builder.setView(mTextInputWidget); + + if (editType == MultiLineTextInput) { + builder.setPositiveButton(acceptButton, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) + { pushResult(mTextInputWidget.getText().toString()); } + }); + } + + builder.setOnCancelListener(new DialogInterface.OnCancelListener() { + public void onCancel(DialogInterface dialog) { + cancelDialog(); + } + }); + + mTextInputWidget.setOnKeyListener(new OnKeyListener() { + @Override + public boolean onKey(View view, int KeyCode, KeyEvent event) { + if ( KeyCode == KeyEvent.KEYCODE_ENTER){ + + pushResult(mTextInputWidget.getText().toString()); + return true; + } + return false; + } + }); + + mTextInputDialog = builder.create(); + mTextInputDialog.show(); + } + + public void pushResult(String text) { + Intent resultData = new Intent(); + resultData.putExtra("text", text); + setResult(Activity.RESULT_OK,resultData); + mTextInputDialog.dismiss(); + finish(); + } + + public void cancelDialog() { + setResult(Activity.RESULT_CANCELED); + mTextInputDialog.dismiss(); + finish(); + } +} diff --git a/build/android/src/net/minetest/minetest/MtNativeActivity.java b/build/android/src/net/minetest/minetest/MtNativeActivity.java new file mode 100644 index 000000000..2bfcef93c --- /dev/null +++ b/build/android/src/net/minetest/minetest/MtNativeActivity.java @@ -0,0 +1,93 @@ +package net.minetest.minetest; + +import android.app.NativeActivity; +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.WindowManager; + +public class MtNativeActivity extends NativeActivity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + m_MessagReturnCode = -1; + m_MessageReturnValue = ""; + + } + + @Override + public void onDestroy() { + super.onDestroy(); + } + + + public void copyAssets() { + Intent intent = new Intent(this, MinetestAssetCopy.class); + startActivity(intent); + } + + public void showDialog(String acceptButton, String hint, String current, + int editType) { + + Intent intent = new Intent(this, MinetestTextEntry.class); + Bundle params = new Bundle(); + params.putString("acceptButton", acceptButton); + params.putString("hint", hint); + params.putString("current", current); + params.putInt("editType", editType); + intent.putExtras(params); + startActivityForResult(intent, 101); + m_MessageReturnValue = ""; + m_MessagReturnCode = -1; + } + + public static native void putMessageBoxResult(String text); + + /* ugly code to workaround putMessageBoxResult not beeing found */ + public int getDialogState() { + return m_MessagReturnCode; + } + + public String getDialogValue() { + m_MessagReturnCode = -1; + return m_MessageReturnValue; + } + + public float getDensity() { + return getResources().getDisplayMetrics().density; + } + + public int getDisplayWidth() { + return getResources().getDisplayMetrics().widthPixels; + } + + public int getDisplayHeight() { + return getResources().getDisplayMetrics().heightPixels; + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, + Intent data) { + if (requestCode == 101) { + if (resultCode == RESULT_OK) { + String text = data.getStringExtra("text"); + m_MessagReturnCode = 0; + m_MessageReturnValue = text; + } + else { + m_MessagReturnCode = 1; + } + } + } + + static { + System.loadLibrary("openal"); + System.loadLibrary("ogg"); + System.loadLibrary("vorbis"); + System.loadLibrary("ssl"); + System.loadLibrary("crypto"); + } + + private int m_MessagReturnCode; + private String m_MessageReturnValue; +} diff --git a/build/android/src/org/minetest/minetest/MinetestAssetCopy.java b/build/android/src/org/minetest/minetest/MinetestAssetCopy.java deleted file mode 100644 index 45dc6373a..000000000 --- a/build/android/src/org/minetest/minetest/MinetestAssetCopy.java +++ /dev/null @@ -1,456 +0,0 @@ -package org.minetest.minetest; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.util.Vector; -import java.util.Iterator; -import java.lang.Object; - -import android.app.Activity; -import android.content.res.AssetFileDescriptor; - -import android.os.AsyncTask; -import android.os.Bundle; -import android.os.Environment; -import android.util.Log; -import android.view.Display; -import android.widget.ProgressBar; -import android.widget.TextView; -import android.graphics.Rect; -import android.graphics.Paint; -import android.text.TextPaint; - -public class MinetestAssetCopy extends Activity -{ - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - - setContentView(R.layout.assetcopy); - - m_ProgressBar = (ProgressBar) findViewById(R.id.progressBar1); - m_Filename = (TextView) findViewById(R.id.textView1); - - Display display = getWindowManager().getDefaultDisplay(); - m_ProgressBar.getLayoutParams().width = (int) (display.getWidth() * 0.8); - m_ProgressBar.invalidate(); - - /* check if there's already a copy in progress and reuse in case it is*/ - MinetestAssetCopy prevActivity = - (MinetestAssetCopy) getLastNonConfigurationInstance(); - if(prevActivity!= null) { - m_AssetCopy = prevActivity.m_AssetCopy; - } - else { - m_AssetCopy = new copyAssetTask(); - m_AssetCopy.execute(); - } - } - - /* preserve asset copy background task to prevent restart of copying */ - /* this way of doing it is not recommended for latest android version */ - /* but the recommended way isn't available on android 2.x */ - public Object onRetainNonConfigurationInstance() - { - return this; - } - - ProgressBar m_ProgressBar; - TextView m_Filename; - - copyAssetTask m_AssetCopy; - - private class copyAssetTask extends AsyncTask - { - private long getFullSize(String filename) - { - long size = 0; - try { - InputStream src = getAssets().open(filename); - byte[] buf = new byte[4096]; - - int len = 0; - while ((len = src.read(buf)) > 0) - { - size += len; - } - } - catch (IOException e) - { - e.printStackTrace(); - } - return size; - } - - @Override - protected String doInBackground(String... files) - { - m_foldernames = new Vector(); - m_filenames = new Vector(); - m_tocopy = new Vector(); - m_asset_size_unknown = new Vector(); - String baseDir = - Environment.getExternalStorageDirectory().getAbsolutePath() - + "/"; - - - // prepare temp folder - File TempFolder = new File(baseDir + "Minetest/tmp/"); - - if (!TempFolder.exists()) - { - TempFolder.mkdir(); - } - else { - File[] todel = TempFolder.listFiles(); - - for(int i=0; i < todel.length; i++) - { - Log.v("MinetestAssetCopy","deleting: " + todel[i].getAbsolutePath()); - todel[i].delete(); - } - } - - // add a .nomedia file - try { - OutputStream dst = new FileOutputStream(baseDir + "Minetest/.nomedia"); - dst.close(); - } catch (IOException e) { - Log.e("MinetestAssetCopy","Failed to create .nomedia file"); - e.printStackTrace(); - } - - - // build lists from prepared data - BuildFolderList(); - BuildFileList(); - - // scan filelist - ProcessFileList(); - - // doing work - m_copy_started = true; - m_ProgressBar.setMax(m_tocopy.size()); - - for (int i = 0; i < m_tocopy.size(); i++) - { - try - { - String filename = m_tocopy.get(i); - publishProgress(i); - - boolean asset_size_unknown = false; - long filesize = -1; - - if (m_asset_size_unknown.contains(filename)) - { - File testme = new File(baseDir + "/" + filename); - - if(testme.exists()) - { - filesize = testme.length(); - } - asset_size_unknown = true; - } - - InputStream src; - try - { - src = getAssets().open(filename); - } catch (IOException e) { - Log.e("MinetestAssetCopy","Copying file: " + filename + " FAILED (not in assets)"); - e.printStackTrace(); - continue; - } - - // Transfer bytes from in to out - byte[] buf = new byte[1*1024]; - int len = src.read(buf, 0, 1024); - - /* following handling is crazy but we need to deal with */ - /* compressed assets.Flash chips limited livetime due to */ - /* write operations, we can't allow large files to destroy */ - /* users flash. */ - if (asset_size_unknown) - { - if ( (len > 0) && (len < buf.length) && (len == filesize)) - { - src.close(); - continue; - } - - if (len == buf.length) - { - src.close(); - long size = getFullSize(filename); - if ( size == filesize) - { - continue; - } - src = getAssets().open(filename); - len = src.read(buf, 0, 1024); - } - } - if (len > 0) - { - int total_filesize = 0; - OutputStream dst; - try - { - dst = new FileOutputStream(baseDir + "/" + filename); - } catch (IOException e) { - Log.e("MinetestAssetCopy","Copying file: " + baseDir + - "/" + filename + " FAILED (couldn't open output file)"); - e.printStackTrace(); - src.close(); - continue; - } - dst.write(buf, 0, len); - total_filesize += len; - - while ((len = src.read(buf)) > 0) - { - dst.write(buf, 0, len); - total_filesize += len; - } - - dst.close(); - Log.v("MinetestAssetCopy","Copied file: " + - m_tocopy.get(i) + " (" + total_filesize + - " bytes)"); - } - else if (len < 0) - { - Log.e("MinetestAssetCopy","Copying file: " + - m_tocopy.get(i) + " failed, size < 0"); - } - src.close(); - } - catch (IOException e) - { - Log.e("MinetestAssetCopy","Copying file: " + - m_tocopy.get(i) + " failed"); - e.printStackTrace(); - } - } - return ""; - } - - - /** - * update progress bar - */ - protected void onProgressUpdate(Integer... progress) - { - - if (m_copy_started) - { - boolean shortened = false; - String todisplay = m_tocopy.get(progress[0]); - m_ProgressBar.setProgress(progress[0]); - - // make sure our text doesn't exceed our layout width - Rect bounds = new Rect(); - Paint textPaint = m_Filename.getPaint(); - textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds); - - while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) { - if (todisplay.length() < 2) { - break; - } - todisplay = todisplay.substring(1); - textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds); - shortened = true; - } - - if (! shortened) { - m_Filename.setText(todisplay); - } - else { - m_Filename.setText(".." + todisplay); - } - } - else - { - boolean shortened = false; - String todisplay = m_Foldername; - String full_text = "scanning " + todisplay + " ..."; - // make sure our text doesn't exceed our layout width - Rect bounds = new Rect(); - Paint textPaint = m_Filename.getPaint(); - textPaint.getTextBounds(full_text, 0, full_text.length(), bounds); - - while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) { - if (todisplay.length() < 2) { - break; - } - todisplay = todisplay.substring(1); - full_text = "scanning " + todisplay + " ..."; - textPaint.getTextBounds(full_text, 0, full_text.length(), bounds); - shortened = true; - } - - if (! shortened) { - m_Filename.setText(full_text); - } - else { - m_Filename.setText("scanning .." + todisplay + " ..."); - } - } - } - - /** - * check al files and folders in filelist - */ - protected void ProcessFileList() - { - String FlashBaseDir = - Environment.getExternalStorageDirectory().getAbsolutePath(); - - Iterator itr = m_filenames.iterator(); - - while (itr.hasNext()) - { - String current_path = (String) itr.next(); - String FlashPath = FlashBaseDir + "/" + current_path; - - if (isAssetFolder(current_path)) - { - /* store information and update gui */ - m_Foldername = current_path; - publishProgress(0); - - /* open file in order to check if it's a folder */ - File current_folder = new File(FlashPath); - if (!current_folder.exists()) - { - if (!current_folder.mkdirs()) - { - Log.e("MinetestAssetCopy","\t failed create folder: " + - FlashPath); - } - else - { - Log.v("MinetestAssetCopy","\t created folder: " + - FlashPath); - } - } - - continue; - } - - /* if it's not a folder it's most likely a file */ - boolean refresh = true; - - File testme = new File(FlashPath); - - long asset_filesize = -1; - long stored_filesize = -1; - - if (testme.exists()) - { - try - { - AssetFileDescriptor fd = getAssets().openFd(current_path); - asset_filesize = fd.getLength(); - fd.close(); - } - catch (IOException e) - { - refresh = true; - m_asset_size_unknown.add(current_path); - Log.e("MinetestAssetCopy","Failed to open asset file \"" + - FlashPath + "\" for size check"); - } - - stored_filesize = testme.length(); - - if (asset_filesize == stored_filesize) - { - refresh = false; - } - - } - - if (refresh) - { - m_tocopy.add(current_path); - } - } - } - - /** - * read list of folders prepared on package build - */ - protected void BuildFolderList() - { - try - { - InputStream is = getAssets().open("index.txt"); - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - - String line = reader.readLine(); - while (line != null) - { - m_foldernames.add(line); - line = reader.readLine(); - } - is.close(); - } catch (IOException e1) - { - Log.e("MinetestAssetCopy","Error on processing index.txt"); - e1.printStackTrace(); - } - } - - /** - * read list of asset files prepared on package build - */ - protected void BuildFileList() - { - long entrycount = 0; - try - { - InputStream is = getAssets().open("filelist.txt"); - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - - String line = reader.readLine(); - while (line != null) - { - m_filenames.add(line); - line = reader.readLine(); - entrycount ++; - } - is.close(); - } - catch (IOException e1) - { - Log.e("MinetestAssetCopy","Error on processing filelist.txt"); - e1.printStackTrace(); - } - } - - protected void onPostExecute (String result) - { - finish(); - } - - protected boolean isAssetFolder(String path) - { - return m_foldernames.contains(path); - } - - boolean m_copy_started = false; - String m_Foldername = "media"; - Vector m_foldernames; - Vector m_filenames; - Vector m_tocopy; - Vector m_asset_size_unknown; - } -} diff --git a/build/android/src/org/minetest/minetest/MinetestTextEntry.java b/build/android/src/org/minetest/minetest/MinetestTextEntry.java deleted file mode 100644 index db175a483..000000000 --- a/build/android/src/org/minetest/minetest/MinetestTextEntry.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.minetest.minetest; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.os.Bundle; -import android.text.InputType; -import android.util.Log; -import android.view.KeyEvent; -import android.view.View; -import android.view.View.OnKeyListener; -import android.widget.EditText; - -public class MinetestTextEntry extends Activity { - public AlertDialog mTextInputDialog; - public EditText mTextInputWidget; - - private final int MultiLineTextInput = 1; - private final int SingleLineTextInput = 2; - private final int SingleLinePasswordInput = 3; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Bundle b = getIntent().getExtras(); - String acceptButton = b.getString("EnterButton"); - String hint = b.getString("hint"); - String current = b.getString("current"); - int editType = b.getInt("editType"); - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - mTextInputWidget = new EditText(this); - mTextInputWidget.setHint(hint); - mTextInputWidget.setText(current); - mTextInputWidget.setMinWidth(300); - if (editType == SingleLinePasswordInput) { - mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_VARIATION_PASSWORD); - } - else { - mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT); - } - - - builder.setView(mTextInputWidget); - - if (editType == MultiLineTextInput) { - builder.setPositiveButton(acceptButton, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) - { pushResult(mTextInputWidget.getText().toString()); } - }); - } - - builder.setOnCancelListener(new DialogInterface.OnCancelListener() { - public void onCancel(DialogInterface dialog) { - cancelDialog(); - } - }); - - mTextInputWidget.setOnKeyListener(new OnKeyListener() { - @Override - public boolean onKey(View view, int KeyCode, KeyEvent event) { - if ( KeyCode == KeyEvent.KEYCODE_ENTER){ - - pushResult(mTextInputWidget.getText().toString()); - return true; - } - return false; - } - }); - - mTextInputDialog = builder.create(); - mTextInputDialog.show(); - } - - public void pushResult(String text) { - Intent resultData = new Intent(); - resultData.putExtra("text", text); - setResult(Activity.RESULT_OK,resultData); - mTextInputDialog.dismiss(); - finish(); - } - - public void cancelDialog() { - setResult(Activity.RESULT_CANCELED); - mTextInputDialog.dismiss(); - finish(); - } -} diff --git a/build/android/src/org/minetest/minetest/MtNativeActivity.java b/build/android/src/org/minetest/minetest/MtNativeActivity.java deleted file mode 100644 index ba7d62169..000000000 --- a/build/android/src/org/minetest/minetest/MtNativeActivity.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.minetest.minetest; - -import android.app.NativeActivity; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.view.WindowManager; - -public class MtNativeActivity extends NativeActivity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - m_MessagReturnCode = -1; - m_MessageReturnValue = ""; - - } - - @Override - public void onDestroy() { - super.onDestroy(); - } - - - public void copyAssets() { - Intent intent = new Intent(this, MinetestAssetCopy.class); - startActivity(intent); - } - - public void showDialog(String acceptButton, String hint, String current, - int editType) { - - Intent intent = new Intent(this, MinetestTextEntry.class); - Bundle params = new Bundle(); - params.putString("acceptButton", acceptButton); - params.putString("hint", hint); - params.putString("current", current); - params.putInt("editType", editType); - intent.putExtras(params); - startActivityForResult(intent, 101); - m_MessageReturnValue = ""; - m_MessagReturnCode = -1; - } - - public static native void putMessageBoxResult(String text); - - /* ugly code to workaround putMessageBoxResult not beeing found */ - public int getDialogState() { - return m_MessagReturnCode; - } - - public String getDialogValue() { - m_MessagReturnCode = -1; - return m_MessageReturnValue; - } - - public float getDensity() { - return getResources().getDisplayMetrics().density; - } - - public int getDisplayWidth() { - return getResources().getDisplayMetrics().widthPixels; - } - - public int getDisplayHeight() { - return getResources().getDisplayMetrics().heightPixels; - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, - Intent data) { - if (requestCode == 101) { - if (resultCode == RESULT_OK) { - String text = data.getStringExtra("text"); - m_MessagReturnCode = 0; - m_MessageReturnValue = text; - } - else { - m_MessagReturnCode = 1; - } - } - } - - static { - System.loadLibrary("openal"); - System.loadLibrary("ogg"); - System.loadLibrary("vorbis"); - System.loadLibrary("ssl"); - System.loadLibrary("crypto"); - } - - private int m_MessagReturnCode; - private String m_MessageReturnValue; -} diff --git a/src/porting_android.cpp b/src/porting_android.cpp index 96c9385a6..6871ce465 100644 --- a/src/porting_android.cpp +++ b/src/porting_android.cpp @@ -71,10 +71,10 @@ void android_main(android_app *app) /* TODO this doesn't work as expected, no idea why but there's a workaround */ /* for it right now */ extern "C" { - JNIEXPORT void JNICALL Java_org_minetest_MtNativeActivity_putMessageBoxResult( + JNIEXPORT void JNICALL Java_net_minetest_MtNativeActivity_putMessageBoxResult( JNIEnv * env, jclass thiz, jstring text) { - errorstream << "Java_org_minetest_MtNativeActivity_putMessageBoxResult got: " + errorstream << "Java_net_minetest_MtNativeActivity_putMessageBoxResult got: " << std::string((const char*)env->GetStringChars(text,0)) << std::endl; } @@ -138,7 +138,7 @@ void initAndroid() exit(-1); } - nativeActivity = findClass("org/minetest/minetest/MtNativeActivity"); + nativeActivity = findClass("net/minetest/minetest/MtNativeActivity"); if (nativeActivity == 0) { errorstream << "porting::initAndroid unable to find java native activity class" << -- cgit v1.2.3 From a740a48f62261073190a92e9b60256da13817923 Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Mon, 2 Mar 2015 13:16:01 +1000 Subject: Fix narrow_to_wide_c (ANDROID) * Ensure converted string is NUL terminated * Restore logic to that used prior to 9e2a9b5 --- src/util/string.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/util/string.cpp b/src/util/string.cpp index de669b473..a29bce94b 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -78,16 +78,18 @@ const wchar_t *narrow_to_wide_c(const char *mbs) size_t mbl = strlen(mbs); wchar_t *wcs = new wchar_t[mbl + 1]; - for (size_t i = 0; i < mbl; i++) { + size_t i, dest_i = 0; + for (i = 0; i < mbl; i++) { if (((unsigned char) mbs[i] > 31) && ((unsigned char) mbs[i] < 127)) { - wcs[i] = wide_chars[(unsigned char) mbs[i] - 32]; + wcs[dest_i++] = wide_chars[(unsigned char) mbs[i] - 32]; } //handle newline else if (mbs[i] == '\n') { - wcs[i] = L'\n'; + wcs[dest_i++] = L'\n'; } } + wcs[dest_i] = '\0'; return wcs; } -- cgit v1.2.3 From 0429ec4cfde636dd8dda3d1a0dcf6e175c821196 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sun, 15 Mar 2015 11:01:15 +0100 Subject: Android: update makefile and backport language fix from master --- build/android/Makefile | 11 +++-- src/game.cpp | 4 +- src/gettext.h | 16 +++--- src/util/string.cpp | 129 ++++++++++++++++++++++++------------------------- src/util/string.h | 8 +-- 5 files changed, 88 insertions(+), 80 deletions(-) diff --git a/build/android/Makefile b/build/android/Makefile index ef9376df3..f53f7f9f5 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -26,7 +26,8 @@ GAMES_TO_COPY = minetest_game # Android Version code # Increase for each build! ################################################################################ -ANDROID_VERSION_CODE = 10 +# Play Store actual version (15/03/15): 10 +ANDROID_VERSION_CODE = 11 ################################################################################ # toolchain config for arm old processors @@ -743,9 +744,13 @@ $(ROOT)/jni/src/android_version.h : >> ${ROOT}/jni/src/android_version.h; \ export GITHASH=$$(git rev-parse --short=8 HEAD); \ if [ "x$$GITHASH" = "x" ] ; then \ - export GITHASH=gUnknown; \ + export GITHASH=""; \ fi; \ - echo "#define CMAKE_VERSION_GITHASH \"$$GITHASH\"" \ + export GITTAG=$$(git describe --abbrev=0 --tags); \ + if [ "x$$GITTAG" = "x" ] ; then \ + export GITTAG=""; \ + fi; \ + echo "#define CMAKE_VERSION_GITHASH \"$$GITTAG-$$GITHASH-Android\"" \ >> ${ROOT}/jni/src/android_version.h; \ echo "#define CMAKE_VERSION_STRING STR(VERSION_MAJOR)\".\"STR(VERSION_MINOR)\ \".\"STR(VERSION_PATCH)" \ diff --git a/src/game.cpp b/src/game.cpp index 8e88fbc8f..7fb99ef3e 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -4117,7 +4117,9 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime) fps_timings->last_time = time; } - +// Note: This will free (using delete[])! \p msg. If you want to use it later, +// pass a copy of it to this function +// Note: \p msg must be allocated using new (not malloc()) void Game::showOverlayMessage(const wchar_t *msg, float dtime, int percent, bool draw_clouds) { diff --git a/src/gettext.h b/src/gettext.h index dce45fa3a..8235efa8a 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -23,31 +23,31 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" // for USE_GETTEXT #if USE_GETTEXT -#include + #include #else -#define gettext(String) String + #define gettext(String) String #endif #define _(String) gettext(String) -#define gettext_noop(String) String -#define N_(String) gettext_noop (String) +#define gettext_noop(String) (String) +#define N_(String) gettext_noop((String)) #ifdef _MSC_VER -void init_gettext(const char *path, const std::string &configured_language, int argc, char** argv); +void init_gettext(const char *path, const std::string &configured_language, + int argc, char** argv); #else void init_gettext(const char *path, const std::string &configured_language); #endif -extern const wchar_t *narrow_to_wide_c(const char *mbs); -extern std::wstring narrow_to_wide(const std::string &mbs); +extern wchar_t *narrow_to_wide_c(const char *str); // You must free the returned string! +// The returned string is allocated using new inline const wchar_t *wgettext(const char *str) { return narrow_to_wide_c(gettext(str)); } -// Gettext under MSVC needs this strange way. Just don't ask... inline std::wstring wstrgettext(const std::string &text) { const wchar_t *tmp = wgettext(text.c_str()); diff --git a/src/util/string.cpp b/src/util/string.cpp index a29bce94b..956a1ac44 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -22,9 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "numeric.h" #include "log.h" -#include "../sha1.h" -#include "../base64.h" -#include "../hex.h" +#include "sha1.h" +#include "base64.h" +#include "hex.h" #include "../porting.h" #include @@ -32,12 +32,35 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +static bool parseHexColorString(const std::string &value, video::SColor &color); +static bool parseNamedColorString(const std::string &value, video::SColor &color); + + +// You must free the returned string! +// The returned string is allocated using new +wchar_t *narrow_to_wide_c(const char *str) +{ + wchar_t* nstr = 0; #if defined(_WIN32) -#include // MultiByteToWideChar + int nResult = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) str, -1, 0, 0); + if (nResult == 0) { + errorstream<<"gettext: MultiByteToWideChar returned null"< 0) { + *pwc = intermediate[0]; return 1; - } else { + } + else { return -1; } } -// You must free the returned string! -const wchar_t *narrow_to_wide_c(const char *mbs) -{ - size_t mbl = strlen(mbs); - wchar_t *wcs = new wchar_t[mbl + 1]; - - size_t i, dest_i = 0; - for (i = 0; i < mbl; i++) { - if (((unsigned char) mbs[i] > 31) && - ((unsigned char) mbs[i] < 127)) { - wcs[dest_i++] = wide_chars[(unsigned char) mbs[i] - 32]; +std::wstring narrow_to_wide(const std::string &mbs) { + size_t wcl = mbs.size(); + + std::wstring retval = L""; + + for (unsigned int i = 0; i < wcl; i++) { + if (((unsigned char) mbs[i] >31) && + ((unsigned char) mbs[i] < 127)) { + + retval += wide_chars[(unsigned char) mbs[i] -32]; } //handle newline else if (mbs[i] == '\n') { - wcs[dest_i++] = L'\n'; + retval += L'\n'; } } - wcs[dest_i] = '\0'; - return wcs; -} - -#else - -// You must free the returned string! -const wchar_t *narrow_to_wide_c(const char *mbs) -{ - wchar_t *wcs = NULL; -#if defined(_WIN32) - int nResult = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) mbs, -1, 0, 0); - if (nResult == 0) { - errorstream << "gettext: MultiByteToWideChar returned null" << std::endl; - } else { - wcs = new wchar_t[nResult]; - MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) mbs, -1, (WCHAR *) wcs, nResult); - } -#else - size_t wcl = mbstowcs(NULL, mbs, 0); - if (wcl == (size_t) -1) - return NULL; - wcs = new wchar_t[wcl + 1]; - size_t l = mbstowcs(wcs, mbs, wcl); - assert(l != (size_t) -1); // Should never happen if the last call worked - wcs[l] = '\0'; -#endif - - return wcs; + return retval; } -#endif +#else // not Android -std::wstring narrow_to_wide(const std::string& mbs) +std::wstring narrow_to_wide(const std::string &mbs) { size_t wcl = mbs.size(); Buffer wcs(wcl + 1); - size_t l = mbstowcs(*wcs, mbs.c_str(), wcl); - if (l == (size_t)(-1)) + size_t len = mbstowcs(*wcs, mbs.c_str(), wcl); + if (len == (size_t)(-1)) return L""; - wcs[l] = 0; + wcs[len] = 0; return *wcs; } +#endif + #ifdef __ANDROID__ -std::string wide_to_narrow(const std::wstring& wcs) { + +std::string wide_to_narrow(const std::wstring &wcs) { size_t mbl = wcs.size()*4; std::string retval = ""; @@ -160,17 +158,18 @@ std::string wide_to_narrow(const std::wstring& wcs) { return retval; } -#else -std::string wide_to_narrow(const std::wstring& wcs) + +#else // not Android + +std::string wide_to_narrow(const std::wstring &wcs) { - size_t mbl = wcs.size()*4; + size_t mbl = wcs.size() * 4; SharedBuffer mbs(mbl+1); - size_t l = wcstombs(*mbs, wcs.c_str(), mbl); - if(l == (size_t)(-1)) { + size_t len = wcstombs(*mbs, wcs.c_str(), mbl); + if (len == (size_t)(-1)) return "Character conversion failed!"; - } else - mbs[l] = 0; + mbs[len] = 0; return *mbs; } @@ -183,7 +182,7 @@ std::string wide_to_narrow(const std::wstring& wcs) // compatibility with password-less players). std::string translatePassword(std::string playername, std::wstring password) { - if(password.length() == 0) + if (password.length() == 0) return ""; std::string slt = playername + wide_to_narrow(password); diff --git a/src/util/string.h b/src/util/string.h index 388184ca4..dc520e3a8 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -36,11 +36,13 @@ struct FlagDesc { u32 flag; }; + // You must free the returned string! -const wchar_t *narrow_to_wide_c(const char *mbs); +// The returned string is allocated using new +wchar_t *narrow_to_wide_c(const char *str); -std::wstring narrow_to_wide(const std::string& mbs); -std::string wide_to_narrow(const std::wstring& wcs); +std::wstring narrow_to_wide(const std::string &mbs); +std::string wide_to_narrow(const std::wstring &wcs); std::string translatePassword(std::string playername, std::wstring password); std::string urlencode(std::string str); std::string urldecode(std::string str); -- cgit v1.2.3 From 0c0248a19cd356eb51240c5ba8ffd17b6f7d89f4 Mon Sep 17 00:00:00 2001 From: est31 Date: Mon, 16 Mar 2015 17:32:30 +0100 Subject: Android: Fix auto-entry of server address and port in mainmenu Fixes #2497. --- builtin/mainmenu/tab_simple_main.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/mainmenu/tab_simple_main.lua b/builtin/mainmenu/tab_simple_main.lua index b9a6b650f..995c72132 100644 --- a/builtin/mainmenu/tab_simple_main.lua +++ b/builtin/mainmenu/tab_simple_main.lua @@ -98,12 +98,12 @@ local function main_button_handler(tabview, fields, name, tabdata) end if fields["favourites"] ~= nil then - local event = core.explode_textlist_event(fields["favourites"]) + local event = core.explode_table_event(fields["favourites"]) if event.type == "CHG" then - if event.index <= #menudata.favorites then - local address = menudata.favorites[event.index].address - local port = menudata.favorites[event.index].port + if event.row <= #menudata.favorites then + local address = menudata.favorites[event.row].address + local port = menudata.favorites[event.row].port if address ~= nil and port ~= nil then @@ -111,7 +111,7 @@ local function main_button_handler(tabview, fields, name, tabdata) core.setting_set("remote_port",port) end - tabdata.fav_selected = event.index + tabdata.fav_selected = event.row end end return true -- cgit v1.2.3 From 315b00d15081d1f56f0e2de22a4ff1a393ab7f22 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 16 Mar 2015 20:37:07 +0100 Subject: Bump android version code --- build/android/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/android/Makefile b/build/android/Makefile index f53f7f9f5..bfc24bc85 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -26,8 +26,8 @@ GAMES_TO_COPY = minetest_game # Android Version code # Increase for each build! ################################################################################ -# Play Store actual version (15/03/15): 10 -ANDROID_VERSION_CODE = 11 +# Play Store actual version (16/03/15): 11 +ANDROID_VERSION_CODE = 12 ################################################################################ # toolchain config for arm old processors -- cgit v1.2.3