1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Merge pull request #2971 from Nordsoft91/translations

Multi-language support for network game and for VMAPs
This commit is contained in:
Nordsoft91
2023-10-02 20:41:42 +02:00
committed by GitHub
71 changed files with 1190 additions and 448 deletions

View File

@@ -1030,15 +1030,13 @@ si32 CGHeroInstance::manaLimit() const
std::string CGHeroInstance::getNameTranslated() const
{
if (!nameCustom.empty())
return nameCustom;
return VLC->generaltexth->translate(getNameTextID());
}
std::string CGHeroInstance::getNameTextID() const
{
if (!nameCustom.empty())
return nameCustom;
if (!nameCustomTextId.empty())
return nameCustomTextId;
if (type)
return type->getNameTextID();
@@ -1049,16 +1047,13 @@ std::string CGHeroInstance::getNameTextID() const
std::string CGHeroInstance::getBiographyTranslated() const
{
if (!biographyCustom.empty())
return biographyCustom;
return VLC->generaltexth->translate(getBiographyTextID());
}
std::string CGHeroInstance::getBiographyTextID() const
{
if (!biographyCustom.empty())
return biographyCustom;
if (!biographyCustomTextId.empty())
return biographyCustomTextId;
if (type)
return type->getBiographyTextID();
@@ -1520,7 +1515,7 @@ void CGHeroInstance::updateFrom(const JsonNode & data)
void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler)
{
handler.serializeString("biography", biographyCustom);
handler.serializeString("biography", biographyCustomTextId);
handler.serializeInt("experience", exp, 0);
if(!handler.saving && exp != UNINITIALIZED_EXPERIENCE) //do not gain levels if experience is not initialized
@@ -1531,7 +1526,7 @@ void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler)
}
}
handler.serializeString("name", nameCustom);
handler.serializeString("name", nameCustomTextId);
handler.serializeInt("gender", gender, 0);
{