diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-07-28 19:57:31 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-07-28 19:57:31 +0200 |
commit | 2b1c0dcf269d617de1f6c203df547166661f089e (patch) | |
tree | 5d247d694f28ddbeb6e2da26b9db02eeab5c7480 /src/being.cpp | |
parent | 44d8856c777790449df46e3b5348a6a7433a75d8 (diff) | |
download | mana-2b1c0dcf269d617de1f6c203df547166661f089e.tar.gz mana-2b1c0dcf269d617de1f6c203df547166661f089e.tar.bz2 mana-2b1c0dcf269d617de1f6c203df547166661f089e.tar.xz mana-2b1c0dcf269d617de1f6c203df547166661f089e.zip |
Centralized configuration default values using the VariableData system.
Please note that I didn't turned all the getValue() call into new ones,
simply because I have to have config object initiated which is not
forcefully the case the branding file.
Resolves: Manasource Mantis #170.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/being.cpp b/src/being.cpp index 7a1f3eec..70ef55f9 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -112,7 +112,7 @@ Being::Being(int id, Type type, int subtype, Map *map): mWalkSpeed = Net::getPlayerHandler()->getDefaultWalkSpeed(); if (getType() == PLAYER) - mShowName = config.getValue("visiblenames", 1); + mShowName = config.getBoolValue("visiblenames"); config.addListener("visiblenames", this); @@ -298,7 +298,7 @@ void Being::setSpeech(const std::string &text, int time) if (!mSpeech.empty()) mSpeechTime = time <= SPEECH_MAX_TIME ? time : SPEECH_MAX_TIME; - const int speech = (int) config.getValue("speech", TEXT_OVERHEAD); + const int speech = config.getIntValue("speech"); if (speech == TEXT_OVERHEAD) { if (mText) @@ -887,7 +887,7 @@ void Being::drawSpeech(int offsetX, int offsetY) { const int px = getPixelX() - offsetX; const int py = getPixelY() - offsetY; - const int speech = (int) config.getValue("speech", TEXT_OVERHEAD); + const int speech = config.getIntValue("speech"); // Draw speech above this being if (mSpeechTime == 0) @@ -994,7 +994,7 @@ void Being::optionChanged(const std::string &value) { if (getType() == PLAYER && value == "visiblenames") { - setShowName(config.getValue("visiblenames", 1)); + setShowName(config.getBoolValue("visiblenames")); } } @@ -1010,7 +1010,7 @@ void Being::showName() mDispName = 0; std::string mDisplayName(mName); - if (config.getValue("showgender", false)) + if (config.getBoolValue("showgender")) { if (getGender() == GENDER_FEMALE) mDisplayName += " \u2640"; @@ -1020,7 +1020,7 @@ void Being::showName() if (getType() == MONSTER) { - if (config.getValue("showMonstersTakedDamage", false)) + if (config.getBoolValue("showMonstersTakedDamage")) { mDisplayName += ", " + toString(getDamageTaken()); } @@ -1113,8 +1113,8 @@ void Being::setSprite(unsigned int slot, int id, const std::string &color, if (!color.empty()) filename += "|" + color; - equipmentSprite = AnimatedSprite::load("graphics/sprites/" + - filename); + equipmentSprite = AnimatedSprite::load( + paths.getStringValue("sprites") + filename); } if (equipmentSprite) @@ -1154,7 +1154,7 @@ void Being::load() int hairstyles = 1; while (ItemDB::get(-hairstyles).getSprite(GENDER_MALE) != - paths.getValue("spriteErrorFile", "error.xml")) + paths.getStringValue("spriteErrorFile")) hairstyles++; mNumberOfHairstyles = hairstyles; |