1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Moved artifact-related text to CArtifact class.

This commit is contained in:
DjWarmonger
2012-12-06 19:03:47 +00:00
parent a6388652d3
commit cff758cfba
8 changed files with 38 additions and 30 deletions

View File

@@ -27,18 +27,16 @@ extern boost::rand48 ran;
const std::string & CArtifact::Name() const
{
if(name.size())
return name;
else
return VLC->generaltexth->artifNames[id];
return name;
}
const std::string & CArtifact::Description() const
{
if(description.size())
return description;
else
return VLC->generaltexth->artifDescriptions[id];
return description;
}
const std::string & CArtifact::EventText() const
{
return eventText;
}
bool CArtifact::isBig () const
@@ -184,10 +182,18 @@ std::string CArtifact::nodeName() const
// // //boost::algorithm::replace_first(description, "[spell name]", VLC->spellh->spells[spellid].name);
// }
void CArtifact::setName (std::string desc)
{
name = desc;
}
void CArtifact::setDescription (std::string desc)
{
description = desc;
}
void CArtifact::setEventText (std::string desc)
{
eventText = desc;
}
void CGrowingArtifact::levelUpArtifact (CArtifactInstance * art)
{
@@ -240,12 +246,11 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
map_list_of('S',CArtifact::ART_SPECIAL)('T',CArtifact::ART_TREASURE)('N',CArtifact::ART_MINOR)('J',CArtifact::ART_MAJOR)('R',CArtifact::ART_RELIC);
CLegacyConfigParser parser("DATA/ARTRAITS.TXT");
CLegacyConfigParser events("DATA/ARTEVENT.TXT");
parser.endLine(); // header
parser.endLine();
VLC->generaltexth->artifNames.resize(GameConstants::ARTIFACTS_QUANTITY);
VLC->generaltexth->artifDescriptions.resize(GameConstants::ARTIFACTS_QUANTITY);
std::map<ui32,ui8>::iterator itr;
for (int i=0; i<GameConstants::ARTIFACTS_QUANTITY; i++)
@@ -261,7 +266,9 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
}
CArtifact &nart = *art;
nart.id=i;
VLC->generaltexth->artifNames[i] = parser.readString();
nart.setName (parser.readString());
nart.setEventText (events.readString());
events.endLine();
nart.price= parser.readNumber();
@@ -277,7 +284,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
nart.aClass = classes[parser.readString()[0]];
//load description and remove quotation marks
VLC->generaltexth->artifDescriptions[i] = parser.readString();
nart.setDescription (parser.readString());
parser.endLine();