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

View File

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