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

Merge pull request #4614 from dydzio0614/hero-description-movement-points

Add status bar movement points info for own hero on adventure map or hero list
This commit is contained in:
Ivan Savenko 2024-09-18 15:46:51 +03:00 committed by GitHub
commit e7779a0b90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;