diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-08-13 17:30:59 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-08-13 17:33:08 -0600 |
commit | f46cfb91278b27f4943f5512778129fe985c678e (patch) | |
tree | 0be219d66e723bcca8de2d584d66bc65d040fb26 /src/npc.cpp | |
parent | be85ca9d91ff867faf140328d0bcbb2062b58cdf (diff) | |
download | mana-f46cfb91278b27f4943f5512778129fe985c678e.tar.gz mana-f46cfb91278b27f4943f5512778129fe985c678e.tar.bz2 mana-f46cfb91278b27f4943f5512778129fe985c678e.tar.xz mana-f46cfb91278b27f4943f5512778129fe985c678e.zip |
Clean up Being and it's derivatives
Move stuff only needed for Players into Player (like slots and sprite
limits). Move name handling into Being (no need for three copies of
this code). Clean up terminology (including Map terminology). Remove
hair-related variables.
Diffstat (limited to 'src/npc.cpp')
-rw-r--r-- | src/npc.cpp | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/src/npc.cpp b/src/npc.cpp index f7172d4b..dbae24e4 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -41,18 +41,13 @@ NPC::NPC(int id, int job, Map *map): NPCInfo info = NPCDB::get(job); // Setup NPC sprites - int c = BASE_SPRITE; for (std::list<NPCsprite*>::const_iterator i = info.sprites.begin(); i != info.sprites.end(); i++) { - if (c == VECTOREND_SPRITE) - break; - std::string file = "graphics/sprites/" + (*i)->sprite; int variant = (*i)->variant; - mSprites[c] = AnimatedSprite::load(file, variant); - c++; + mSprites.push_back(AnimatedSprite::load(file, variant)); } if (mParticleEffects) @@ -66,32 +61,15 @@ NPC::NPC(int id, int job, Map *map): this->controlParticle(p); } } - mName = 0; - - mNameColor = &guiPalette->getColor(Palette::NPC); -} -NPC::~NPC() -{ - delete mName; + setShowName(true); } void NPC::setName(const std::string &name) { const std::string displayName = name.substr(0, name.find('#', 0)); - delete mName; - mName = new Text(displayName, - getPixelX(), - getPixelY(), - gcn::Graphics::CENTER, - &guiPalette->getColor(Palette::NPC)); - Being::setName(displayName + " (NPC)"); -} - -Being::Type NPC::getType() const -{ - return Being::NPC; + Being::setName(displayName); } void NPC::talk() @@ -103,11 +81,3 @@ void NPC::talk() Net::getNpcHandler()->talk(mId); } - -void NPC::updateCoords() -{ - if (mName) - { - mName->adviseXY(getPixelX(), getPixelY()); - } -} |