From de6927322999931686774cf6f1a06108a00fa24b Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 14 Jul 2012 15:57:21 +0200 Subject: [PATCH] Localise scripts + silene debug spam in options menu --- Aquaria/DSQ.h | 6 +++--- Aquaria/Mod.cpp | 6 +++--- Aquaria/ScriptInterface.cpp | 7 ++++--- Aquaria/UserSettings.cpp | 24 ++++++++++++------------ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 1787b83..cd56d0e 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -258,15 +258,15 @@ public: void recache(); - std::string getBaseModPath(); + const std::string& getBaseModPath() const; bool isActive(); bool isDebugMenu(); bool hasWorldMap(); bool isEditorBlocked(); - std::string getPath(); - std::string getName(); + const std::string& getPath() const; + const std::string& getName() const; void shutdown(); bool isShuttingDown(); diff --git a/Aquaria/Mod.cpp b/Aquaria/Mod.cpp index 85a0a91..0f8b78c 100644 --- a/Aquaria/Mod.cpp +++ b/Aquaria/Mod.cpp @@ -82,7 +82,7 @@ bool Mod::loadModXML(TiXmlDocument *d, std::string modName) return d->LoadFile(baseModPath + modName + ".xml"); } -std::string Mod::getBaseModPath() +const std::string& Mod::getBaseModPath() const { refreshBaseModPath(); @@ -154,12 +154,12 @@ void Mod::load(const std::string &p) particleManager->loadParticleBank(dsq->particleBank1, dsq->particleBank2); } -std::string Mod::getPath() +const std::string& Mod::getPath() const { return path; } -std::string Mod::getName() +const std::string& Mod::getName() const { return name; } diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 974ffe5..488b558 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -700,16 +700,17 @@ static bool findFile_helper(const char *rawname, std::string &fname) return false; if (dsq->mod.isActive()) { - fname += dsq->mod.getPath(); + fname = dsq->mod.getPath(); if(fname[fname.length() - 1] != '/') fname += '/'; fname += rawname; + fname = localisePath(fname, dsq->mod.getPath()); fname = core->adjustFilenameCase(fname); if (exists(fname)) return true; } - - fname = core->adjustFilenameCase(rawname); + fname = localisePath(rawname); + fname = core->adjustFilenameCase(fname); return exists(fname); } diff --git a/Aquaria/UserSettings.cpp b/Aquaria/UserSettings.cpp index f90af3c..b3d126b 100644 --- a/Aquaria/UserSettings.cpp +++ b/Aquaria/UserSettings.cpp @@ -535,6 +535,18 @@ void UserSettings::load(bool doApply, const std::string &overrideFile) //clearInputCodeMap(); + if (system.locale.empty()) + { + std::string loc = getSystemLocale(); + debugLog("Using autodetected system locale: " + loc); + setUsedLocale(loc); + } + else + { + debugLog("Using user config locale: " + system.locale); + setUsedLocale(system.locale); + } + if (doApply) apply(); } @@ -574,18 +586,6 @@ void UserSettings::apply() core->settings.prebufferSounds = audio.prebuffer; - if (system.locale.empty()) - { - std::string loc = getSystemLocale(); - debugLog("Using autodetected system locale: " + loc); - setUsedLocale(loc); - } - else - { - debugLog("Using user config locale: " + system.locale); - setUsedLocale(system.locale); - } - #endif }