mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Replaced initializer list for portability
This commit is contained in:
parent
6f3d70e6e4
commit
05d2946280
1 changed files with 44 additions and 39 deletions
|
|
@ -5,45 +5,6 @@
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "steamshim/steamshim_child.h"
|
#include "steamshim/steamshim_child.h"
|
||||||
|
|
||||||
/* Language map */
|
|
||||||
static const std::map<std::string, std::string> langToCode = {
|
|
||||||
{"brazilian", "pt_BR"},
|
|
||||||
{"bulgarian", "bg"},
|
|
||||||
{"czech", "cz"},
|
|
||||||
{"danish", "da"},
|
|
||||||
{"dutch", "nl"},
|
|
||||||
{"english", "en"},
|
|
||||||
{"finnish", "fi"},
|
|
||||||
{"french", "fr"},
|
|
||||||
{"german", "de"},
|
|
||||||
{"greek", "el"},
|
|
||||||
{"hungarian", "hu"},
|
|
||||||
{"italian", "it"},
|
|
||||||
{"japanese", "ja"},
|
|
||||||
{"koreana", "ko"},
|
|
||||||
{"korean", "ko"},
|
|
||||||
{"norwegian", "no"},
|
|
||||||
{"polish", "pl"},
|
|
||||||
{"portuguese", "pt"},
|
|
||||||
{"romanian", "ro"},
|
|
||||||
{"russian", "ru"},
|
|
||||||
{"schinese", "zh_CN"},
|
|
||||||
{"spanish", "es"},
|
|
||||||
{"swedish", "sv"},
|
|
||||||
{"tchinese", "zh_TW"},
|
|
||||||
{"thai", "th"},
|
|
||||||
{"turkish", "tr"},
|
|
||||||
{"ukrainian", "uk"},
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string steamToIsoLang(const char *steamLang)
|
|
||||||
{
|
|
||||||
auto it = langToCode.find(steamLang);
|
|
||||||
if (it != langToCode.end())
|
|
||||||
return it->second;
|
|
||||||
return "en";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Achievements */
|
/* Achievements */
|
||||||
static const char *const achievementNames[] = {
|
static const char *const achievementNames[] = {
|
||||||
"SaveWorld",
|
"SaveWorld",
|
||||||
|
|
@ -51,6 +12,50 @@ static const char *const achievementNames[] = {
|
||||||
};
|
};
|
||||||
#define NUM_ACHIEVEMENTS (sizeof(achievementNames) / sizeof(achievementNames[0]))
|
#define NUM_ACHIEVEMENTS (sizeof(achievementNames) / sizeof(achievementNames[0]))
|
||||||
|
|
||||||
|
/* Language map */
|
||||||
|
static inline std::map<std::string, std::string> gen_langToCode()
|
||||||
|
{
|
||||||
|
std::map<std::string, std::string> map;
|
||||||
|
map["brazilian"] = "pt_BR";
|
||||||
|
map["brazilian"] = "pt_BR";
|
||||||
|
map["bulgarian"] = "bg";
|
||||||
|
map["czech"] = "cz";
|
||||||
|
map["danish"] = "da";
|
||||||
|
map["dutch"] = "nl";
|
||||||
|
map["english"] = "en";
|
||||||
|
map["finnish"] = "fi";
|
||||||
|
map["french"] = "fr";
|
||||||
|
map["german"] = "de";
|
||||||
|
map["greek"] = "el";
|
||||||
|
map["hungarian"] = "hu";
|
||||||
|
map["italian"] = "it";
|
||||||
|
map["japanese"] = "ja";
|
||||||
|
map["koreana"] = "ko";
|
||||||
|
map["korean"] = "ko";
|
||||||
|
map["norwegian"] = "no";
|
||||||
|
map["polish"] = "pl";
|
||||||
|
map["portuguese"] = "pt";
|
||||||
|
map["romanian"] = "ro";
|
||||||
|
map["russian"] = "ru";
|
||||||
|
map["schinese"] = "zh_CN";
|
||||||
|
map["spanish"] = "es";
|
||||||
|
map["swedish"] = "sv";
|
||||||
|
map["tchinese"] = "zh_TW";
|
||||||
|
map["thai"] = "th";
|
||||||
|
map["turkish"] = "tr";
|
||||||
|
map["ukrainian"] = "uk";
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
static const std::map<std::string, std::string> langToCode = gen_langToCode();
|
||||||
|
|
||||||
|
static std::string steamToIsoLang(const char *steamLang)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::string>::const_iterator it = langToCode.find(steamLang);
|
||||||
|
if (it != langToCode.end())
|
||||||
|
return it->second;
|
||||||
|
return "en";
|
||||||
|
}
|
||||||
|
|
||||||
/* SteamPrivate */
|
/* SteamPrivate */
|
||||||
struct SteamPrivate
|
struct SteamPrivate
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue