mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
CGArtifact: show yes/no dialog for guarded artifacts. Fix issue 2095
Also fix hover text for CGMine
This commit is contained in:
parent
75ca020890
commit
62bab27e7e
@ -629,7 +629,6 @@ std::string CGMine::getObjectName() const
|
|||||||
|
|
||||||
std::string CGMine::getHoverText(PlayerColor player) const
|
std::string CGMine::getHoverText(PlayerColor player) const
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string hoverName = getObjectName(); // Sawmill
|
std::string hoverName = getObjectName(); // Sawmill
|
||||||
|
|
||||||
if (tempOwner != PlayerColor::NEUTRAL)
|
if (tempOwner != PlayerColor::NEUTRAL)
|
||||||
@ -639,11 +638,12 @@ std::string CGMine::getHoverText(PlayerColor player) const
|
|||||||
hoverName += "\n(" + VLC->generaltexth->restypes[producedResource] + ")";
|
hoverName += "\n(" + VLC->generaltexth->restypes[producedResource] + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & slot : Slots()) // guarded by a few Pikeman
|
if(stacksCount())
|
||||||
{
|
{
|
||||||
hoverName += "\n";
|
hoverName += "\n";
|
||||||
hoverName += getRoughAmount(slot.first);
|
hoverName += VLC->generaltexth->allTexts[202]; //Guarded by
|
||||||
hoverName += getCreature(slot.first)->namePl;
|
hoverName += " ";
|
||||||
|
hoverName += getArmyDescription();
|
||||||
}
|
}
|
||||||
return hoverName;
|
return hoverName;
|
||||||
}
|
}
|
||||||
@ -1187,7 +1187,6 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
iw.text.addTxt(MetaString::ADVOB_TXT, 183); //% has found treasure
|
iw.text.addTxt(MetaString::ADVOB_TXT, 183); //% has found treasure
|
||||||
iw.text.addReplacement(h->name);
|
iw.text.addReplacement(h->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1195,9 +1194,14 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
{
|
{
|
||||||
int spellID = storedArtifact->getGivenSpellID();
|
int spellID = storedArtifact->getGivenSpellID();
|
||||||
iw.components.push_back(Component(Component::SPELL, spellID, 0, 0));
|
iw.components.push_back(Component(Component::SPELL, spellID, 0, 0));
|
||||||
|
if(message.length())
|
||||||
|
iw.text << message;
|
||||||
|
else
|
||||||
|
{
|
||||||
iw.text.addTxt(MetaString::ADVOB_TXT,135);
|
iw.text.addTxt(MetaString::ADVOB_TXT,135);
|
||||||
iw.text.addReplacement(MetaString::SPELL_NAME, spellID);
|
iw.text.addReplacement(MetaString::SPELL_NAME, spellID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
@ -1205,7 +1209,28 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(message.size())
|
switch(ID)
|
||||||
|
{
|
||||||
|
case Obj::ARTIFACT:
|
||||||
|
{
|
||||||
|
BlockingDialog ynd(true,false);
|
||||||
|
ynd.player = h->getOwner();
|
||||||
|
if(message.length())
|
||||||
|
ynd.text << message;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: Guard text is more complex in H3, see mantis issue 2325 for details
|
||||||
|
ynd.text.addTxt(MetaString::GENERAL_TXT, 420);
|
||||||
|
ynd.text.addReplacement("");
|
||||||
|
ynd.text.addReplacement(getArmyDescription());
|
||||||
|
ynd.text.addReplacement(MetaString::GENERAL_TXT, 43); // creatures
|
||||||
|
}
|
||||||
|
cb->showBlockingDialog(&ynd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Obj::SPELL_SCROLL:
|
||||||
|
{
|
||||||
|
if(message.length())
|
||||||
{
|
{
|
||||||
BlockingDialog ynd(true,false);
|
BlockingDialog ynd(true,false);
|
||||||
ynd.player = h->getOwner();
|
ynd.player = h->getOwner();
|
||||||
@ -1213,9 +1238,10 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
cb->showBlockingDialog(&ynd);
|
cb->showBlockingDialog(&ynd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
blockingDialogAnswered(h, true);
|
blockingDialogAnswered(h, true);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user