1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-10 09:50:17 +02:00

Add status bar movement points info for own hero on adventure map or hero list

This commit is contained in:
Dydzio 2024-09-17 21:38:28 +02:00
parent 92d0779897
commit 7979f62f82
5 changed files with 24 additions and 1 deletions

View File

@ -20,6 +20,7 @@
"vcmi.adventureMap.playerAttacked" : "Player has been attacked: %s",
"vcmi.adventureMap.moveCostDetails" : "Movement points - Cost: %TURNS turns + %POINTS points, Remaining points: %REMAINING",
"vcmi.adventureMap.moveCostDetailsNoTurns" : "Movement points - Cost: %POINTS points, Remaining points: %REMAINING",
"vcmi.adventureMap.movementPointsHeroInfo" : "(Movement points: %REMAINING / %POINTS)",
"vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Sorry, replay opponent turn is not implemented yet!",
"vcmi.capitalColors.0" : "Red",

View File

@ -20,6 +20,7 @@
"vcmi.adventureMap.playerAttacked" : "Gracz został zaatakowany: %s",
"vcmi.adventureMap.moveCostDetails" : "Punkty ruchu - Koszt: %TURNS tury + %POINTS punkty, Pozostałe punkty: %REMAINING",
"vcmi.adventureMap.moveCostDetailsNoTurns" : "Punkty ruchu - Koszt: %POINTS punkty, Pozostałe punkty: %REMAINING",
"vcmi.adventureMap.movementPointsHeroInfo" : "(Punkty ruchu: %REMAINING / %POINTS)",
"vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Wybacz, powtórka ruchu wroga nie została jeszcze zaimplementowana!",
"vcmi.capitalColors.0" : "Czerwony",

View File

@ -263,7 +263,7 @@ void CHeroList::CHeroItem::showTooltip()
std::string CHeroList::CHeroItem::getHoverText()
{
return boost::str(boost::format(CGI->generaltexth->allTexts[15]) % hero->getNameTranslated() % hero->getClassNameTranslated());
return boost::str(boost::format(CGI->generaltexth->allTexts[15]) % hero->getNameTranslated() % hero->getClassNameTranslated()) + hero->getMovementPointsTextIfOwner(hero->getOwner());
}
void CHeroList::CHeroItem::gesture(bool on, const Point & initialPosition, const Point & finalPosition)

View File

@ -566,6 +566,25 @@ std::string CGHeroInstance::getObjectName() const
return VLC->objtypeh->getObjectName(ID, 0);
}
std::string CGHeroInstance::getHoverText(PlayerColor player) const
{
std::string hoverText = CArmedInstance::getHoverText(player) + getMovementPointsTextIfOwner(player);
return hoverText;
}
std::string CGHeroInstance::getMovementPointsTextIfOwner(PlayerColor player) const
{
std::string output = "";
if(player == getOwner())
{
output += " " + VLC->generaltexth->translate("vcmi.adventureMap.movementPointsHeroInfo");
boost::replace_first(output, "%POINTS", std::to_string(movementPointsLimit(!boat)));
boost::replace_first(output, "%REMAINING", std::to_string(movementPointsRemaining()));
}
return output;
}
ui8 CGHeroInstance::maxlevelsToMagicSchool() const
{
return type->heroClass->isMagicHero() ? 3 : 4;

View File

@ -297,6 +297,8 @@ public:
void pickRandomObject(CRandomGenerator & rand) override;
void onHeroVisit(const CGHeroInstance * h) const override;
std::string getObjectName() const override;
std::string getHoverText(PlayerColor player) const override;
std::string getMovementPointsTextIfOwner(PlayerColor player) const;
void afterAddToMap(CMap * map) override;
void afterRemoveFromMap(CMap * map) override;