mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix tooltip for spell scrolls on adventure map
This commit is contained in:
@@ -254,10 +254,13 @@ DLL_LINKAGE void ArtifactUtils::insertScrrollSpellName(std::string & description
|
|||||||
// However other language versions don't have name placeholder at all, so we have to be careful
|
// However other language versions don't have name placeholder at all, so we have to be careful
|
||||||
auto nameStart = description.find_first_of('[');
|
auto nameStart = description.find_first_of('[');
|
||||||
auto nameEnd = description.find_first_of(']', nameStart);
|
auto nameEnd = description.find_first_of(']', nameStart);
|
||||||
if(sid.getNum() >= 0)
|
|
||||||
{
|
|
||||||
if(nameStart != std::string::npos && nameEnd != std::string::npos)
|
if(nameStart != std::string::npos && nameEnd != std::string::npos)
|
||||||
|
{
|
||||||
|
if(sid.getNum() >= 0)
|
||||||
description = description.replace(nameStart, nameEnd - nameStart + 1, sid.toEntity(VLC->spells())->getNameTranslated());
|
description = description.replace(nameStart, nameEnd - nameStart + 1, sid.toEntity(VLC->spells())->getNameTranslated());
|
||||||
|
else
|
||||||
|
description = description.erase(nameStart, nameEnd - nameStart + 2); // erase "[spell name] " - including space
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -779,6 +779,7 @@ std::string CGArtifact::getPopupText(PlayerColor player) const
|
|||||||
if (settings["general"]["enableUiEnhancements"].Bool())
|
if (settings["general"]["enableUiEnhancements"].Bool())
|
||||||
{
|
{
|
||||||
std::string description = VLC->artifacts()->getById(getArtifact())->getDescriptionTranslated();
|
std::string description = VLC->artifacts()->getById(getArtifact())->getDescriptionTranslated();
|
||||||
|
if (getArtifact() == ArtifactID::SPELL_SCROLL)
|
||||||
ArtifactUtils::insertScrrollSpellName(description, SpellID::NONE); // erase text placeholder
|
ArtifactUtils::insertScrrollSpellName(description, SpellID::NONE); // erase text placeholder
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user