don't allow language fallback for q88500

This commit is contained in:
Martin Michelsen
2024-06-28 14:10:06 -07:00
parent 528593651b
commit 2ff9df19c8
3 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -461,17 +461,22 @@ bool Quest::has_version_any_language(Version v) const {
return ((it != this->versions.end()) && ((it->first & 0xFF00) == k));
}
shared_ptr<const VersionedQuest> Quest::version(Version v, uint8_t language) const {
shared_ptr<const VersionedQuest> Quest::version(Version v, uint8_t language, bool allow_language_fallback) const {
// Return the requested version, if it exists
try {
return this->versions.at(this->versions_key(v, language));
} catch (const out_of_range&) {
}
if (!allow_language_fallback) {
return nullptr;
}
// Return the English version, if it exists
try {
return this->versions.at(this->versions_key(v, 1));
} catch (const out_of_range&) {
}
// Return the first language, if it exists
auto it = this->versions.lower_bound(this->versions_key(v, 0));
if ((it == this->versions.end()) || ((it->first & 0xFF00) != this->versions_key(v, 0))) {
+1 -1
View File
@@ -123,7 +123,7 @@ public:
void add_version(std::shared_ptr<const VersionedQuest> vq);
bool has_version(Version v, uint8_t language) const;
bool has_version_any_language(Version v) const;
std::shared_ptr<const VersionedQuest> version(Version v, uint8_t language) const;
std::shared_ptr<const VersionedQuest> version(Version v, uint8_t language, bool allow_language_fallback = true) const;
static uint32_t versions_key(Version v, uint8_t language);
+1 -1
View File
@@ -405,7 +405,7 @@ void on_login_complete(shared_ptr<Client> c) {
default:
q_language = 1; // English (US Plus v1.2 + customizations)
}
auto vq = q->version(is_ep3(c->version()) ? Version::GC_V3 : c->version(), q_language);
auto vq = q->version(is_ep3(c->version()) ? Version::GC_V3 : c->version(), q_language, false);
if (vq) {
c->config.set_flag(Client::Flag::HAS_SEND_FUNCTION_CALL);
c->config.set_flag(Client::Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);