1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-26 08:41:13 +02:00

Merge pull request #158 from vmarkovtsev/issue/2389

Merging, very good solution.
This commit is contained in:
DjWarmonger 2016-01-19 09:22:31 +01:00
commit e187dd7b78

View File

@ -186,19 +186,31 @@ std::string CComponent::getSubtitleInternal()
case artifact: return CGI->arth->artifacts[subtype]->Name();
case experience:
{
if (subtype == 1) //+1 level - tree of knowledge
if(subtype == 1) //+1 level - tree of knowledge
{
std::string level = CGI->generaltexth->allTexts[442];
boost::replace_first(level, "1", boost::lexical_cast<std::string>(val));
return level;
}
else
{
return boost::lexical_cast<std::string>(val); //amount of experience OR level required for seer hut;
}
}
case spell: return CGI->spellh->objects[subtype]->name;
case morale: return "";
case luck: return "";
case building: return CGI->townh->factions[subtype]->town->buildings[BuildingID(val)]->Name();
case building:
{
auto building = CGI->townh->factions[subtype]->town->buildings[BuildingID(val)];
if(!building)
{
logGlobal->errorStream() << boost::format("Town of faction %s has no building #%d")
% CGI->townh->factions[subtype]->town->faction->name % val;
return (boost::format("Missing building #%d") % val).str();
}
return building->Name();
}
case hero: return "";
case flag: return CGI->generaltexth->capColors[subtype];
}