1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Win/loss condition texts use MetaString

This commit is contained in:
Ivan Savenko
2023-06-18 13:51:11 +03:00
parent 56d69e790b
commit d51fe62804
16 changed files with 230 additions and 180 deletions

View File

@ -1585,9 +1585,9 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
{
if (victoryLossCheckResult.loss() && cb->getPlayerStatus(playerID) == EPlayerStatus::INGAME) //enemy has lost
{
std::string str = CGI->generaltexth->translate(victoryLossCheckResult.messageToSelf);
boost::algorithm::replace_first(str, "%s", CGI->generaltexth->capColors[player.getNum()]);
showInfoDialog(str, std::vector<std::shared_ptr<CComponent>>(1, std::make_shared<CComponent>(CComponent::flag, player.getNum(), 0)));
MetaString message = victoryLossCheckResult.messageToSelf;
message.appendLocalString(EMetaText::COLOR, player.getNum());
showInfoDialog(message.toString(), std::vector<std::shared_ptr<CComponent>>(1, std::make_shared<CComponent>(CComponent::flag, player.getNum(), 0)));
}
}
}