From f9a06a168a4c4354dcffdba7243b4eff783adb5b Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Thu, 12 Mar 2009 09:03:24 -0600 Subject: Made hair load again (commit e2d60401eaf55abe9e2251854f3174ffe0f4ad9e from TMW broke this, as it deleted the Being::load() method, which also loaded the hair styles). Also removed some unused variables in the being class. Signed-off-by: Ira Rice --- src/being.cpp | 16 ++++++++++++++-- src/being.h | 4 ++-- src/main.cpp | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 54908b07..64972912 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -83,8 +83,7 @@ Being::Being(int id, int job, Map *map): mSprites(VECTOREND_SPRITE, NULL), mSpriteIDs(VECTOREND_SPRITE, 0), mSpriteColors(VECTOREND_SPRITE, ""), - mStatusParticleEffects(&mStunParticleEffects, false), - mChildParticleEffects(&mStatusParticleEffects, false), + mChildParticleEffects(), mUsedTargetCursor(NULL) { setMap(map); @@ -578,3 +577,16 @@ void Being::setTargetAnimation(SimpleAnimation* animation) mUsedTargetCursor->reset(); } +void Being::load() +{ + // Hairstyles are encoded as negative numbers. Count how far negative + // we can go. + int hairstyles = 1; + + while (ItemDB::get(-hairstyles).getSprite(GENDER_MALE) != "error.xml") + { + hairstyles++; + } + mNumberOfHairstyles = hairstyles; +} + diff --git a/src/being.h b/src/being.h index 6f3125c8..d7a7d1d5 100644 --- a/src/being.h +++ b/src/being.h @@ -402,6 +402,8 @@ class Being : public Sprite virtual AnimatedSprite* getSprite(int index) const { return mSprites[index]; } + static void load(); + protected: /** * Sets the new path for this being. @@ -450,8 +452,6 @@ class Being : public Sprite std::vector mSprites; std::vector mSpriteIDs; std::vector mSpriteColors; - ParticleList mStunParticleEffects; - ParticleVector mStatusParticleEffects; ParticleList mChildParticleEffects; private: diff --git a/src/main.cpp b/src/main.cpp index a7032fb1..fab7ed95 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -939,6 +939,7 @@ int main(int argc, char *argv[]) MonsterDB::load(); NPCDB::load(); EmoteDB::load(); + Being::load(); // Hairstyles state = CHAR_CONNECT_STATE; break; -- cgit v1.2.3-60-g2f50