mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Better integration of wog commanders translation
This commit is contained in:
@@ -393,7 +393,7 @@ CStackWindow::CommanderMainSection::CommanderMainSection(CStackWindow * owner, i
|
||||
|
||||
auto getSkillDescription = [this](int skillIndex) -> std::string
|
||||
{
|
||||
return CGI->generaltexth->znpc00[152 + (12 * skillIndex) + (parent->info->commander->secondarySkills[skillIndex] * 2)];
|
||||
return parent->getCommanderSkillDescription(skillIndex, parent->info->commander->secondarySkills[skillIndex]);
|
||||
};
|
||||
|
||||
for(int index = ECommander::ATTACK; index <= ECommander::SPELL_POWER; ++index)
|
||||
@@ -905,14 +905,30 @@ std::string CStackWindow::generateStackExpDescription()
|
||||
return expText;
|
||||
}
|
||||
|
||||
std::string CStackWindow::getCommanderSkillDescription(int skillIndex, int skillLevel)
|
||||
{
|
||||
constexpr std::array skillNames = {
|
||||
"attack",
|
||||
"defence",
|
||||
"health",
|
||||
"damage",
|
||||
"speed",
|
||||
"magic"
|
||||
};
|
||||
|
||||
std::string textID = TextIdentifier("vcmi", "commander", "skill", skillNames.at(skillIndex), skillLevel).get();
|
||||
|
||||
return CGI->generaltexth->translate(textID);
|
||||
}
|
||||
|
||||
void CStackWindow::setSelection(si32 newSkill, std::shared_ptr<CCommanderSkillIcon> newIcon)
|
||||
{
|
||||
auto getSkillDescription = [this](int skillIndex, bool selected) -> std::string
|
||||
{
|
||||
if(selected)
|
||||
return CGI->generaltexth->znpc00[152 + (12 * skillIndex) + ((info->commander->secondarySkills[skillIndex] + 1) * 2)]; //upgrade description
|
||||
return getCommanderSkillDescription(skillIndex, info->commander->secondarySkills[skillIndex] + 1); //upgrade description
|
||||
else
|
||||
return CGI->generaltexth->znpc00[152 + (12 * skillIndex) + (info->commander->secondarySkills[skillIndex] * 2)];
|
||||
return getCommanderSkillDescription(skillIndex, info->commander->secondarySkills[skillIndex]);
|
||||
};
|
||||
|
||||
auto getSkillImage = [this](int skillIndex)
|
||||
|
@@ -189,6 +189,7 @@ class CStackWindow : public CWindowObject
|
||||
void init();
|
||||
|
||||
std::string generateStackExpDescription();
|
||||
std::string getCommanderSkillDescription(int skillIndex, int skillLevel);
|
||||
|
||||
public:
|
||||
// for battles
|
||||
|
@@ -139,8 +139,7 @@ CGeneralTextHandler::CGeneralTextHandler():
|
||||
// pseudo-array, that don't have H3 file with same name
|
||||
seerEmpty (*this, "core.seerhut.empty" ),
|
||||
seerNames (*this, "core.seerhut.names" ),
|
||||
capColors (*this, "vcmi.capitalColors" ),
|
||||
znpc00 (*this, "vcmi.znpc00" ) // technically - wog
|
||||
capColors (*this, "vcmi.capitalColors" )
|
||||
{
|
||||
readToVector("core.vcdesc", "DATA/VCDESC.TXT" );
|
||||
readToVector("core.lcdesc", "DATA/LCDESC.TXT" );
|
||||
@@ -293,11 +292,6 @@ CGeneralTextHandler::CGeneralTextHandler():
|
||||
scenariosCountPerCampaign.push_back(region);
|
||||
}
|
||||
}
|
||||
if (VLC->engineSettings()->getBoolean(EGameSettings::MODULE_COMMANDERS))
|
||||
{
|
||||
if(CResourceHandler::get()->existsResource(TextPath::builtin("DATA/ZNPC00.TXT")))
|
||||
readToVector("vcmi.znpc00", "DATA/ZNPC00.TXT" );
|
||||
}
|
||||
}
|
||||
|
||||
int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t count) const
|
||||
|
@@ -73,8 +73,6 @@ public:
|
||||
|
||||
//sec skills
|
||||
LegacyTextContainer levels;
|
||||
//commanders
|
||||
LegacyTextContainer znpc00; //more or less useful content of that file
|
||||
|
||||
std::vector<std::string> findStringsWithPrefix(const std::string & prefix);
|
||||
|
||||
|
Reference in New Issue
Block a user