mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Refactoring of hoverText from objects:
- removed hoverText field - split getHoverText() method into 3: - - getObjectName() for generic name - - getHoverText(Player) for player-specific text - - getHoverText(Hero) for hero-specific strings
This commit is contained in:
@ -375,19 +375,18 @@ static std::string & visitedTxt(const bool visited)
|
||||
return VLC->generaltexth->allTexts[id];
|
||||
}
|
||||
|
||||
const std::string & CRewardableObject::getHoverText() const
|
||||
std::string CRewardableObject::getHoverText(PlayerColor player) const
|
||||
{
|
||||
const CGHeroInstance *h = cb->getSelectedHero(cb->getCurrentPlayer());
|
||||
hoverName = VLC->objtypeh->getObjectName(ID);
|
||||
if(visitMode != VISIT_UNLIMITED)
|
||||
{
|
||||
bool visited = wasVisited(cb->getCurrentPlayer());
|
||||
if (h)
|
||||
visited |= wasVisited(h);
|
||||
return getObjectName() + " " + visitedTxt(wasVisited(player));
|
||||
return getObjectName();
|
||||
}
|
||||
|
||||
hoverName += " " + visitedTxt(visited);
|
||||
}
|
||||
return hoverName;
|
||||
std::string CRewardableObject::getHoverText(const CGHeroInstance * hero) const
|
||||
{
|
||||
if(visitMode != VISIT_UNLIMITED)
|
||||
return getObjectName() + " " + visitedTxt(wasVisited(hero));
|
||||
return getObjectName();
|
||||
}
|
||||
|
||||
void CRewardableObject::setPropertyDer(ui8 what, ui32 val)
|
||||
|
Reference in New Issue
Block a user