aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
ModeNameSize
-rw-r--r--CMakeLists.txt639logplain
-rw-r--r--s_async.cpp7797logplain
-rw-r--r--s_async.h4053logplain
-rw-r--r--s_base.cpp9040logplain
-rw-r--r--s_base.h3644logplain
-rw-r--r--s_client.cpp4848logplain
-rw-r--r--s_client.h1656logplain
-rw-r--r--s_entity.cpp7930logplain
-rw-r--r--s_entity.h1554logplain
-rw-r--r--s_env.cpp7320logplain
-rw-r--r--s_env.h1505logplain
-rw-r--r--s_internal.h2878logplain
-rw-r--r--s_inventory.cpp7745logplain
-rw-r--r--s_inventory.h2342logplain
-rw-r--r--s_item.cpp7582logplain
-rw-r--r--s_item.h1952logplain
-rw-r--r--s_mainmenu.cpp2665logplain
-rw-r--r--s_mainmenu.h1454logplain
-rw-r--r--s_node.cpp7340logplain
-rw-r--r--s_node.h1955logplain
-rw-r--r--s_nodemeta.cpp8155logplain
-rw-r--r--s_nodemeta.h2220logplain
-rw-r--r--s_player.cpp5481logplain
-rw-r--r--s_player.h1829logplain
-rw-r--r--s_security.cpp17561logplain
-rw-r--r--s_security.h2599logplain
-rw-r--r--s_server.cpp4532logplain
-rw-r--r--s_server.h1559logplain
>/* NULL is used to read locale only so we need to return it too */ if (raw_shortname == NULL) return NULL; std::string shortname(raw_shortname); if (shortname == "C") return "C"; if (shortname == "") return ""; static std::string last_raw_value = ""; static std::string last_full_name = ""; static bool first_use = true; if (last_raw_value == shortname) { return last_full_name.c_str(); } if (first_use) { EnumSystemLocalesA(UpdateLocaleCallback, LCID_SUPPORTED | LCID_ALTERNATE_SORTS); first_use = false; } last_raw_value = shortname; if (glb_supported_locales.find(utf8_to_wide(shortname)) != glb_supported_locales.end()) { last_full_name = wide_to_utf8( glb_supported_locales[utf8_to_wide(shortname)]); return last_full_name.c_str(); } /* empty string is system default */ errorstream << "MSVC_LocaleLookup: unsupported locale: \"" << shortname << "\" switching to system default!" << std::endl; return ""; } #endif /******************************************************************************/ void init_gettext(const char *path, const std::string &configured_language, int argc, char *argv[]) { #if USE_GETTEXT // First, try to set user override environment if (!configured_language.empty()) { #ifndef _WIN32 // Add user specified locale to environment setenv("LANGUAGE", configured_language.c_str(), 1); // Reload locale with changed environment setlocale(LC_ALL, ""); #elif defined(_MSC_VER) std::string current_language; const char *env_lang = getenv("LANGUAGE"); if (env_lang) current_language = env_lang; _putenv(("LANGUAGE=" + configured_language).c_str()); SetEnvironmentVariableA("LANGUAGE", configured_language.c_str()); #ifndef SERVER // Hack to force gettext to see the right environment if (current_language != configured_language) { errorstream << "MSVC localization workaround active. " "Restarting " PROJECT_NAME_C " in a new environment!" << std::endl; std::string parameters; for (unsigned int i = 1; i < argc; i++) { if (!parameters.empty()) parameters += ' '; parameters += argv[i]; } const char *ptr_parameters = NULL; if (!parameters.empty()) ptr_parameters = parameters.c_str(); // Allow calling without an extension std::string app_name = argv[0]; if (app_name.compare(app_name.size() - 4, 4, ".exe") != 0) app_name += ".exe"; STARTUPINFO startup_info = {0}; PROCESS_INFORMATION process_info = {0}; bool success = CreateProcess(app_name.c_str(), (char *)ptr_parameters, NULL, NULL, false, DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &startup_info, &process_info); if (success) { exit(0); // NOTREACHED } else { char buffer[1024];