mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Merge pull request #1481 from kambala-decapitator/owner-tooltip
display owner of ownable objects in tooltip
This commit is contained in:
commit
94f483c1e7
@ -328,7 +328,10 @@ boost::optional<std::string> CGObjectInstance::getRemovalSound() const
|
||||
|
||||
std::string CGObjectInstance::getHoverText(PlayerColor player) const
|
||||
{
|
||||
return getObjectName();
|
||||
auto text = getObjectName();
|
||||
if (tempOwner.isValidPlayer())
|
||||
text += "\n" + VLC->generaltexth->arraytxt[23 + tempOwner.getNum()];
|
||||
return text;
|
||||
}
|
||||
|
||||
std::string CGObjectInstance::getHoverText(const CGHeroInstance * hero) const
|
||||
|
@ -715,14 +715,10 @@ std::string CGMine::getObjectName() const
|
||||
|
||||
std::string CGMine::getHoverText(PlayerColor player) const
|
||||
{
|
||||
std::string hoverName = getObjectName(); // Sawmill
|
||||
std::string hoverName = CArmedInstance::getHoverText(player);
|
||||
|
||||
if (tempOwner != PlayerColor::NEUTRAL)
|
||||
{
|
||||
hoverName += "\n";
|
||||
hoverName += VLC->generaltexth->arraytxt[23 + tempOwner.getNum()]; // owned by Red Player
|
||||
hoverName += "\n(" + VLC->generaltexth->restypes[producedResource] + ")";
|
||||
}
|
||||
|
||||
if(stacksCount())
|
||||
{
|
||||
@ -2200,12 +2196,6 @@ void CGLighthouse::initObj(CRandomGenerator & rand)
|
||||
}
|
||||
}
|
||||
|
||||
std::string CGLighthouse::getHoverText(PlayerColor player) const
|
||||
{
|
||||
//TODO: owned by %s player
|
||||
return getObjectName();
|
||||
}
|
||||
|
||||
void CGLighthouse::giveBonusTo(PlayerColor player, bool onInit) const
|
||||
{
|
||||
GiveBonus gb(GiveBonus::PLAYER);
|
||||
|
@ -523,7 +523,6 @@ class DLL_LINKAGE CGLighthouse : public CGObjectInstance
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj(CRandomGenerator & rand) override;
|
||||
std::string getHoverText(PlayerColor player) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user