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

- fix for text on kingdom overview (#1172 + some other similar cases)

- removed unused code from text handler
This commit is contained in:
Ivan Savenko 2013-01-12 19:28:38 +00:00
parent 055e922e4d
commit 2f83b211ca
3 changed files with 5 additions and 41 deletions

View File

@ -137,12 +137,7 @@ std::string InfoBoxAbstractHeroData::getValueText()
case HERO_PRIMARY_SKILL:
return boost::lexical_cast<std::string>(getValue());
case HERO_SPECIAL:
{
std::string text = CGI->generaltexth->jktexts[5];
size_t begin = text.find('{');
size_t end = text.find('}', begin);
return text.substr(begin, end-begin);
}
return CGI->generaltexth->jktexts[5];
case HERO_SECONDARY_SKILL:
{
si64 value = getValue();
@ -164,12 +159,7 @@ std::string InfoBoxAbstractHeroData::getNameText()
case HERO_MANA:
return CGI->generaltexth->allTexts[387];
case HERO_EXPERIENCE:
{
std::string text = CGI->generaltexth->jktexts[6];
size_t begin = text.find('{');
size_t end = text.find('}', begin);
return text.substr(begin, end-begin);
}
return CGI->generaltexth->jktexts[6];
case HERO_SPECIAL:
return CGI->heroh->heroes[getSubID()]->specName;
case HERO_SECONDARY_SKILL:
@ -902,16 +892,14 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart *
artButtons = new CHighlightableButtonsGroup(0);
for (size_t it = 0; it<3; it++)
{
int stringID[3] = {259, 261, 262};
std::map<int,std::string> tooltip;
tooltip[0] = CGI->generaltexth->overview[13+it];
std::string overlay = CGI->generaltexth->overview[8+it];
artButtons->addButton(tooltip, overlay, "OVBUTN3",364+it*112, 46, it);
size_t begin = overlay.find('{');
size_t end = overlay.find('}', begin);
overlay = overlay.substr(begin+1, end - begin);
artButtons->buttons[it]->addTextOverlay(overlay, FONT_SMALL, Colors::YELLOW);
artButtons->buttons[it]->addTextOverlay(CGI->generaltexth->allTexts[stringID[it]], FONT_SMALL, Colors::YELLOW);
}
artButtons->onChange += boost::bind(&CTabbedInt::setActive, artsTabs, _1);
artButtons->onChange += boost::bind(&CHeroItem::onArtChange, this, _1);

View File

@ -324,27 +324,6 @@ void CGeneralTextHandler::load()
}
}
std::string CGeneralTextHandler::getTitle(const std::string & text)
{
std::string ret;
int i=0;
while ((text[i++]!='{'));
while ((text[i]!='}') && (i<text.length()))
ret+=text[i++];
return ret;
}
std::string CGeneralTextHandler::getDescr(const std::string & text)
{
std::string ret;
int i=0;
while ((text[i++]!='}'));
i+=2;
while ((text[i]!='"') && (i<text.length()))
ret+=text[i++];
return ret;
}
CGeneralTextHandler::CGeneralTextHandler()
{

View File

@ -104,9 +104,6 @@ public:
std::vector <std::string> campaignMapNames;
std::vector < std::vector <std::string> > campaignRegionNames;
std::string getTitle(const std::string & text);
std::string getDescr(const std::string & text);
void load();
CGeneralTextHandler();
};