diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2012-01-18 18:10:26 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2012-01-18 22:40:43 +0100 |
commit | 4159ba015c5f2035d188367d85d85052a7673cdc (patch) | |
tree | 1776e43ef3708dc094f747e64720dd41f1fa1f5b /src | |
parent | e554d9b2be1ec2fcb15065ae70151302adeef602 (diff) | |
download | mana-client-4159ba015c5f2035d188367d85d85052a7673cdc.tar.gz mana-client-4159ba015c5f2035d188367d85d85052a7673cdc.tar.bz2 mana-client-4159ba015c5f2035d188367d85d85052a7673cdc.tar.xz mana-client-4159ba015c5f2035d188367d85d85052a7673cdc.zip |
ColorDB -> HairDB.
This will ease the reading of the next patch about hair handling
at character creation time in tAthena.
As requested by bjorn.
Reviewed-by: bjorn
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/client.cpp | 6 | ||||
-rw-r--r-- | src/gui/charcreatedialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 2 | ||||
-rw-r--r-- | src/net/manaserv/beinghandler.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/charhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 4 | ||||
-rw-r--r-- | src/resources/hairdb.cpp (renamed from src/resources/colordb.cpp) | 13 | ||||
-rw-r--r-- | src/resources/hairdb.h (renamed from src/resources/colordb.h) | 11 |
11 files changed, 36 insertions, 34 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e2f1567..575a00f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -363,12 +363,12 @@ SET(SRCS resources/animation.h resources/beinginfo.cpp resources/beinginfo.h - resources/colordb.cpp - resources/colordb.h resources/dye.cpp resources/dye.h resources/emotedb.cpp resources/emotedb.h + resources/hairdb.cpp + resources/hairdb.h resources/image.cpp resources/image.h resources/imageloader.cpp diff --git a/src/being.cpp b/src/being.cpp index c7ee9083..9483e897 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -51,7 +51,7 @@ #include "net/npchandler.h" #include "resources/beinginfo.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "resources/emotedb.h" #include "resources/image.h" #include "resources/itemdb.h" diff --git a/src/client.cpp b/src/client.cpp index 0c41c7cc..768fae1e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -64,7 +64,7 @@ #include "net/net.h" #include "net/worldinfo.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "resources/emotedb.h" #include "resources/image.h" #include "resources/itemdb.h" @@ -449,7 +449,7 @@ Client::~Client() SDL_RemoveTimer(mSecondsCounterId); // Unload XML databases - ColorDB::unload(); + HairDB::unload(); EmoteDB::unload(); delete itemDb; MonsterDB::unload(); @@ -759,7 +759,7 @@ int Client::exec() Event::trigger(Event::ClientChannel, Event::LoadingDatabases); // Load XML databases - ColorDB::load(); + HairDB::load(); switch (Net::getNetworkType()) { case ServerInfo::TMWATHENA: diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 746295b5..cdd6739c 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -42,7 +42,7 @@ #include "net/messageout.h" #include "net/net.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -57,7 +57,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mPlayer = new Being(0, ActorSprite::PLAYER, 0, NULL); mPlayer->setGender(GENDER_MALE); - int numberOfHairColors = ColorDB::size(); + int numberOfHairColors = HairDB::size(); mHairStyle = rand() % mPlayer->getNumOfHairstyles(); mHairColor = rand() % numberOfHairColors; @@ -363,10 +363,10 @@ void CharCreateDialog::updateHair() if (mHairStyle < 0) mHairStyle += Being::getNumOfHairstyles(); - mHairColor %= ColorDB::size(); + mHairColor %= HairDB::size(); if (mHairColor < 0) - mHairColor += ColorDB::size(); + mHairColor += HairDB::size(); mPlayer->setSprite(Net::getCharHandler()->hairSprite(), - mHairStyle * -1, ColorDB::get(mHairColor)); + mHairStyle * -1, HairDB::get(mHairColor)); } diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 42c514ec..2972c492 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -49,7 +49,7 @@ #include "net/messageout.h" #include "net/net.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "utils/gettext.h" #include "utils/stringutils.h" diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index 3e635d43..980c538c 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -38,7 +38,7 @@ #include "net/manaserv/playerhandler.h" #include "net/manaserv/manaserv_protocol.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "utils/gettext.h" @@ -144,7 +144,7 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg) being->setName(name); } int hs = msg.readInt8(), hc = msg.readInt8(); - being->setSprite(SPRITE_LAYER_HAIR, hs * -1, ColorDB::get(hc)); + being->setSprite(SPRITE_LAYER_HAIR, hs * -1, HairDB::get(hc)); being->setGender(msg.readInt8() == ManaServ::GENDER_MALE ? ::GENDER_MALE : ::GENDER_FEMALE); handleLooks(being, msg); @@ -334,7 +334,7 @@ void BeingHandler::handleBeingLooksChangeMessage(Net::MessageIn &msg) { int style = msg.readInt16(); int color = msg.readInt16(); - being->setSprite(SPRITE_LAYER_HAIR, style * -1, ColorDB::get(color)); + being->setSprite(SPRITE_LAYER_HAIR, style * -1, HairDB::get(color)); } } diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 8a072d26..a36ae1da 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -41,7 +41,7 @@ #include "net/manaserv/manaserv_protocol.h" #include "net/manaserv/attributes.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -392,7 +392,7 @@ void CharHandler::updateCharacters() player->setName(info.name); player->setGender(info.gender); player->setSprite(SPRITE_LAYER_HAIR, info.hairStyle * -1, - ColorDB::get(info.hairColor)); + HairDB::get(info.hairColor)); character->data.mAttributes[LEVEL] = info.level; character->data.mAttributes[CHAR_POINTS] = info.characterPoints; character->data.mAttributes[CORR_POINTS] = info.correctionPoints; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index e3e92a0b..f2ce7df8 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -35,7 +35,7 @@ #include "net/tmwa/protocol.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "resources/emotedb.h" #include <iostream> @@ -245,7 +245,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) dstBeing->setGender((gender == 0) ? GENDER_FEMALE : GENDER_MALE); // Set these after the gender, as the sprites may be gender-specific - dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, ColorDB::get(hairColor)); + dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, HairDB::get(hairColor)); dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); dstBeing->setSprite(SPRITE_HAT, headTop); @@ -487,7 +487,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) dstBeing->setSprite(SPRITE_TOPCLOTHES, id); break; case 6: // eAthena LOOK_HAIR_COLOR - dstBeing->setSpriteColor(SPRITE_HAIR, ColorDB::get(id)); + dstBeing->setSpriteColor(SPRITE_HAIR, HairDB::get(id)); break; case 8: // eAthena LOOK_SHIELD dstBeing->setSprite(SPRITE_SHIELD, id); @@ -614,7 +614,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) //dstBeing->setSprite(SPRITE_CAPE, cape); //dstBeing->setSprite(SPRITE_MISC1, misc1); //dstBeing->setSprite(SPRITE_MISC2, misc2); - dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, ColorDB::get(hairColor)); + dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, HairDB::get(hairColor)); if (msg.getId() == SMSG_PLAYER_MOVE) { diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 83682efe..f90537ec 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -38,7 +38,7 @@ #include "net/tmwa/network.h" #include "net/tmwa/protocol.h" -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -240,7 +240,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, Net::Character *char tempPlayer->setSprite(SPRITE_SHIELD, msg.readInt16()); tempPlayer->setSprite(SPRITE_HAT, msg.readInt16()); // head option top tempPlayer->setSprite(SPRITE_TOPCLOTHES, msg.readInt16()); // head option mid - tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, ColorDB::get(msg.readInt16())); + tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, HairDB::get(msg.readInt16())); tempPlayer->setSprite(SPRITE_MISC2, msg.readInt16()); tempPlayer->setName(msg.readString(24)); diff --git a/src/resources/colordb.cpp b/src/resources/hairdb.cpp index d0b46b4e..abf64bd5 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/hairdb.cpp @@ -1,6 +1,7 @@ /* * Color database * Copyright (C) 2008 Aethyra Development Team + * Copyright (C) 2009-2012 The Mana Developers * * This file is part of The Mana Client. * @@ -18,7 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "resources/colordb.h" +#include "resources/hairdb.h" #include "log.h" @@ -28,12 +29,12 @@ namespace { - ColorDB::Colors mColors; + HairDB::Colors mColors; bool mLoaded = false; std::string mFail = "#ffffff"; } -void ColorDB::load() +void HairDB::load() { if (mLoaded) unload(); @@ -84,7 +85,7 @@ void ColorDB::load() mLoaded = true; } -void ColorDB::unload() +void HairDB::unload() { logger->log("Unloading color database..."); @@ -92,7 +93,7 @@ void ColorDB::unload() mLoaded = false; } -std::string &ColorDB::get(int id) +std::string &HairDB::get(int id) { if (!mLoaded) load(); @@ -110,7 +111,7 @@ std::string &ColorDB::get(int id) } } -int ColorDB::size() +int HairDB::size() { return mColors.size(); } diff --git a/src/resources/colordb.h b/src/resources/hairdb.h index 57b52388..c29dbb83 100644 --- a/src/resources/colordb.h +++ b/src/resources/hairdb.h @@ -1,6 +1,7 @@ /* * Color database * Copyright (C) 2008 Aethyra Development Team + * Copyright (C) 2009-2012 The Mana Developers * * This file is part of The Mana Client. * @@ -18,16 +19,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef COLOR_MANAGER_H -#define COLOR_MANAGER_H +#ifndef HAIR_MANAGER_H +#define HAIR_MANAGER_H #include <map> #include <string> /** - * Color information database. + * Hair information database. */ -namespace ColorDB +namespace HairDB { /** * Loads the color data from <code>colors.xml</code>. @@ -43,7 +44,7 @@ namespace ColorDB int size(); - // Color DB + // Hair Color DB typedef std::map<int, std::string> Colors; typedef Colors::iterator ColorIterator; } |