1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Remove this-> occurrences in new code

This commit is contained in:
Vadim Markovtsev 2016-01-25 14:14:32 +03:00
parent afa95312ba
commit 22eb71de03

View File

@ -760,16 +760,16 @@ void CArtifactInstance::init()
std::string CArtifactInstance::getEffectiveDescription( std::string CArtifactInstance::getEffectiveDescription(
const CGHeroInstance *hero) const const CGHeroInstance *hero) const
{ {
std::string text = this->artType->Description(); std::string text = artType->Description();
if (!vstd::contains(text, '{')) if (!vstd::contains(text, '{'))
text = '{' + this->artType->Name() + "}\n\n" + text; //workaround for new artifacts with single name, turns it to H3-style text = '{' + artType->Name() + "}\n\n" + text; //workaround for new artifacts with single name, turns it to H3-style
if(this->artType->id == ArtifactID::SPELL_SCROLL) if(artType->id == ArtifactID::SPELL_SCROLL)
{ {
// we expect scroll description to be like this: This scroll contains the [spell name] spell which is added into your spell book for as long as you carry the scroll. // we expect scroll description to be like this: This scroll contains the [spell name] spell which is added into your spell book for as long as you carry the scroll.
// so we want to replace text in [...] with a spell name // so we want to replace text in [...] with a spell name
// 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
int spellID = this->getGivenSpellID(); int spellID = getGivenSpellID();
size_t nameStart = text.find_first_of('['); size_t nameStart = text.find_first_of('[');
size_t nameEnd = text.find_first_of(']', nameStart); size_t nameEnd = text.find_first_of(']', nameStart);
if(spellID >= 0) if(spellID >= 0)
@ -778,10 +778,10 @@ std::string CArtifactInstance::getEffectiveDescription(
text = text.replace(nameStart, nameEnd - nameStart + 1, VLC->spellh->objects[spellID]->name); text = text.replace(nameStart, nameEnd - nameStart + 1, VLC->spellh->objects[spellID]->name);
} }
} }
else if (hero && this->artType->constituentOf.size()) //display info about set else if (hero && artType->constituentOf.size()) //display info about set
{ {
std::string artList; std::string artList;
auto combinedArt = this->artType->constituentOf[0]; auto combinedArt = artType->constituentOf[0];
text += "\n\n"; text += "\n\n";
text += "{" + combinedArt->Name() + "}"; text += "{" + combinedArt->Name() + "}";
int wornArtifacts = 0; int wornArtifacts = 0;