mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixes to masterlist parser and generator.
This commit is contained in:
@@ -565,17 +565,13 @@ namespace YAML {
|
||||
}
|
||||
|
||||
inline Emitter& operator << (Emitter& out, const boss::MessageContent& rhs) {
|
||||
if (rhs.Language() == boss::g_lang_any)
|
||||
out << rhs.Str();
|
||||
else {
|
||||
out << BeginMap;
|
||||
out << BeginMap;
|
||||
|
||||
out << Key << "lang" << Value << boss::GetLangString(rhs.Language());
|
||||
out << Key << "lang" << Value << boss::GetLangString(rhs.Language());
|
||||
|
||||
out << Key << "str" << Value << rhs.Str();
|
||||
out << Key << "str" << Value << rhs.Str();
|
||||
|
||||
out << EndMap;
|
||||
}
|
||||
out << EndMap;
|
||||
}
|
||||
|
||||
inline Emitter& operator << (Emitter& out, const boss::Message& rhs) {
|
||||
@@ -588,7 +584,10 @@ namespace YAML {
|
||||
else
|
||||
out << Key << "type" << Value << "error";
|
||||
|
||||
out << Key << "content" << Value << rhs.Content();
|
||||
if (rhs.Content().size() == 1 && rhs.Content().front().Language() == boss::g_lang_any)
|
||||
out << Key << "content" << Value << rhs.Content().front().Str();
|
||||
else
|
||||
out << Key << "content" << Value << rhs.Content();
|
||||
|
||||
if (!rhs.Condition().empty())
|
||||
out << Key << "condition" << Value << rhs.Condition();
|
||||
|
||||
@@ -167,8 +167,9 @@ namespace YAML {
|
||||
std::vector<boss::MessageContent> content;
|
||||
if (node["content"].IsSequence())
|
||||
content = node["content"].as< std::vector<boss::MessageContent> >();
|
||||
else
|
||||
content.push_back(node["content"].as<std::string>());
|
||||
else {
|
||||
content.push_back(boss::MessageContent(node["content"].as<std::string>()));
|
||||
}
|
||||
|
||||
//Check now that at least one item in content is English if there are multiple items.
|
||||
if (content.size() > 1) {
|
||||
@@ -177,9 +178,8 @@ namespace YAML {
|
||||
if (it->Language() == boss::g_lang_english)
|
||||
found = true;
|
||||
}
|
||||
//Commented out because the auto-converted masterlist has localisations as separate messages and so will always fail.
|
||||
// if (!found)
|
||||
// return false;
|
||||
if (!found)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string condition;
|
||||
|
||||
Reference in New Issue
Block a user