forked from teamnwah/openmw-tes3coop
[Client] Make topic sync work with localized versions of the game
This commit is contained in:
parent
34a452d775
commit
d8cd57a8be
4 changed files with 46 additions and 5 deletions
|
@ -115,9 +115,6 @@ namespace MWDialogue
|
||||||
topicId = mTranslationDataStorage.topicStandardForm(topicId);
|
topicId = mTranslationDataStorage.topicStandardForm(topicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok->isImplicitKeyword() && mTranslationDataStorage.hasTranslation())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Start of tes3mp addition
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
@ -129,6 +126,9 @@ namespace MWDialogue
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (tok->isImplicitKeyword() && mTranslationDataStorage.hasTranslation())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (mActorKnownTopics.count( topicId ))
|
if (mActorKnownTopics.count( topicId ))
|
||||||
mKnownTopics.insert( topicId );
|
mKnownTopics.insert( topicId );
|
||||||
}
|
}
|
||||||
|
|
|
@ -685,8 +685,13 @@ void LocalPlayer::addTopics()
|
||||||
for (unsigned int i = 0; i < topicChanges.count; i++)
|
for (unsigned int i = 0; i < topicChanges.count; i++)
|
||||||
{
|
{
|
||||||
mwmp::Topic topic = topicChanges.topics.at(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))
|
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue))
|
||||||
MWBase::Environment::get().getDialogueManager()->updateTopics();
|
MWBase::Environment::get().getDialogueManager()->updateTopics();
|
||||||
|
@ -1177,7 +1182,14 @@ void LocalPlayer::sendTopic(const std::string& topicId)
|
||||||
topicChanges.topics.clear();
|
topicChanges.topics.clear();
|
||||||
|
|
||||||
mwmp::Topic topic;
|
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);
|
topicChanges.topics.push_back(topic);
|
||||||
|
|
||||||
|
|
|
@ -117,4 +117,23 @@ namespace Translation
|
||||||
!mTopicIDs.empty() ||
|
!mTopicIDs.empty() ||
|
||||||
!mPhraseForms.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<std::string, std::string>::const_iterator it = mTopicIDs.begin(); it != mTopicIDs.end(); ++it)
|
||||||
|
{
|
||||||
|
if (Misc::StringUtils::ciEqual(englishTopicId, it->second))
|
||||||
|
return it->first;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,16 @@ namespace Translation
|
||||||
|
|
||||||
bool hasTranslation() const;
|
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:
|
private:
|
||||||
typedef std::map<std::string, std::string> ContainerType;
|
typedef std::map<std::string, std::string> ContainerType;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue