|
@@ -629,7 +629,6 @@ std::string CGMine::getObjectName() const
|
|
|
|
|
|
std::string CGMine::getHoverText(PlayerColor player) const
|
|
|
{
|
|
|
-
|
|
|
std::string hoverName = getObjectName(); // Sawmill
|
|
|
|
|
|
if (tempOwner != PlayerColor::NEUTRAL)
|
|
@@ -639,11 +638,12 @@ std::string CGMine::getHoverText(PlayerColor player) const
|
|
|
hoverName += "\n(" + VLC->generaltexth->restypes[producedResource] + ")";
|
|
|
}
|
|
|
|
|
|
- for (auto & slot : Slots()) // guarded by a few Pikeman
|
|
|
+ if(stacksCount())
|
|
|
{
|
|
|
hoverName += "\n";
|
|
|
- hoverName += getRoughAmount(slot.first);
|
|
|
- hoverName += getCreature(slot.first)->namePl;
|
|
|
+ hoverName += VLC->generaltexth->allTexts[202]; //Guarded by
|
|
|
+ hoverName += " ";
|
|
|
+ hoverName += getArmyDescription();
|
|
|
}
|
|
|
return hoverName;
|
|
|
}
|
|
@@ -1164,7 +1164,7 @@ std::string CGArtifact::getObjectName() const
|
|
|
return VLC->arth->artifacts[subID]->Name();
|
|
|
}
|
|
|
|
|
|
-void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|
|
+void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
|
|
|
{
|
|
|
if(!stacksCount())
|
|
|
{
|
|
@@ -1175,28 +1175,32 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|
|
case Obj::ARTIFACT:
|
|
|
{
|
|
|
iw.soundID = soundBase::treasure; //play sound only for non-scroll arts
|
|
|
- iw.components.push_back(Component(Component::ARTIFACT,subID,0,0));
|
|
|
+ iw.components.push_back(Component(Component::ARTIFACT, subID, 0, 0));
|
|
|
if(message.length())
|
|
|
- iw.text << message;
|
|
|
+ iw.text << message;
|
|
|
else
|
|
|
{
|
|
|
- if (VLC->arth->artifacts[subID]->EventText().size())
|
|
|
- iw.text << std::pair<ui8, ui32> (MetaString::ART_EVNTS, subID);
|
|
|
+ if(VLC->arth->artifacts[subID]->EventText().size())
|
|
|
+ iw.text << std::pair<ui8, ui32>(MetaString::ART_EVNTS, subID);
|
|
|
else //fix for mod artifacts with no event text
|
|
|
{
|
|
|
- iw.text.addTxt (MetaString::ADVOB_TXT, 183); //% has found treasure
|
|
|
- iw.text.addReplacement (h->name);
|
|
|
+ iw.text.addTxt(MetaString::ADVOB_TXT, 183); //% has found treasure
|
|
|
+ iw.text.addReplacement(h->name);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case Obj::SPELL_SCROLL:
|
|
|
{
|
|
|
int spellID = storedArtifact->getGivenSpellID();
|
|
|
- iw.components.push_back (Component(Component::SPELL, spellID,0,0));
|
|
|
- iw.text.addTxt (MetaString::ADVOB_TXT,135);
|
|
|
- iw.text.addReplacement(MetaString::SPELL_NAME, spellID);
|
|
|
+ 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.addReplacement(MetaString::SPELL_NAME, spellID);
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -1205,16 +1209,38 @@ void CGArtifact::onHeroVisit( const CGHeroInstance * h ) const
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(message.size())
|
|
|
- {
|
|
|
- BlockingDialog ynd(true,false);
|
|
|
- ynd.player = h->getOwner();
|
|
|
- ynd.text << message;
|
|
|
- cb->showBlockingDialog(&ynd);
|
|
|
- }
|
|
|
- else
|
|
|
+ switch(ID)
|
|
|
{
|
|
|
- blockingDialogAnswered(h, true);
|
|
|
+ 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);
|
|
|
+ ynd.player = h->getOwner();
|
|
|
+ ynd.text << message;
|
|
|
+ cb->showBlockingDialog(&ynd);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ blockingDialogAnswered(h, true);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|