diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 569c665e3..5a4c548b3 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -115,9 +115,6 @@ namespace MWDialogue topicId = mTranslationDataStorage.topicStandardForm(topicId); } - if (tok->isImplicitKeyword() && mTranslationDataStorage.hasTranslation()) - continue; - /* Start of tes3mp addition @@ -129,6 +126,9 @@ namespace MWDialogue End of tes3mp addition */ + if (tok->isImplicitKeyword() && mTranslationDataStorage.hasTranslation()) + continue; + if (mActorKnownTopics.count( topicId )) mKnownTopics.insert( topicId ); } diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 4dcff40d4..439809554 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -685,8 +685,13 @@ void LocalPlayer::addTopics() for (unsigned int i = 0; i < topicChanges.count; i++) { mwmp::Topic topic = topicChanges.topics.at(i); + std::string topicId = topic.topicId; - MWBase::Environment::get().getDialogueManager()->addTopic(topic.topicId); + // If we're using a translated version of Morrowind, translate this topic from English into our language + if (MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().hasTranslation()) + topicId = MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().getLocalizedTopicId(topicId); + + MWBase::Environment::get().getDialogueManager()->addTopic(topicId); if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue)) MWBase::Environment::get().getDialogueManager()->updateTopics(); @@ -1177,7 +1182,14 @@ void LocalPlayer::sendTopic(const std::string& topicId) topicChanges.topics.clear(); mwmp::Topic topic; - topic.topicId = topicId; + + // For translated versions of the game, make sure we translate the topic back into English first + if (MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().hasTranslation()) + topic.topicId = MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().topicID(topicId); + else + topic.topicId = topicId; + + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_TOPIC with topic %s", topic.topicId.c_str()); topicChanges.topics.push_back(topic); diff --git a/components/translation/translation.cpp b/components/translation/translation.cpp index 51947f6f9..83dfdaecc 100644 --- a/components/translation/translation.cpp +++ b/components/translation/translation.cpp @@ -117,4 +117,23 @@ namespace Translation !mTopicIDs.empty() || !mPhraseForms.empty(); } + + /* + Start of tes3mp addition + + Get the localized version of an English topic ID + */ + std::string Storage::getLocalizedTopicId(const std::string& englishTopicId) const + { + for (std::map::const_iterator it = mTopicIDs.begin(); it != mTopicIDs.end(); ++it) + { + if (Misc::StringUtils::ciEqual(englishTopicId, it->second)) + return it->first; + } + + return ""; + } + /* + End of tes3mp addition + */ } diff --git a/components/translation/translation.hpp b/components/translation/translation.hpp index 6a3f84ba1..f631a7188 100644 --- a/components/translation/translation.hpp +++ b/components/translation/translation.hpp @@ -24,6 +24,16 @@ namespace Translation bool hasTranslation() const; + /* + Start of tes3mp addition + + Get the localized version of an English topic ID + */ + std::string getLocalizedTopicId(const std::string& englishTopicId) const; + /* + End of tes3mp addition + */ + private: typedef std::map ContainerType;