diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-05-17 19:16:11 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-05-17 21:49:16 -0600 |
commit | 3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d (patch) | |
tree | ed0e8cc5b608c31ac79e6d1de03d9ddfc74fa339 /src/localplayer.cpp | |
parent | 51945aa1af6f2a6dc15027ef40cf0ccf424d46e1 (diff) | |
download | mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.tar.gz mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.tar.bz2 mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.tar.xz mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.zip |
Remove Monster, Player, and NPC classes
Instead of having these three subclasses with minor differences, this
commit merges them back into Being. In the future, we can make Beings
that are talkable to some, attackable by others, etc. This also puts
back support for monster equipment.
Also changes remaining references to Being::Type and the constants to
refer to ActorSprite::Type.
Reviewed-by: Freeyorp
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 9796b2ac..17384a1f 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -32,7 +32,6 @@ #include "item.h" #include "log.h" #include "map.h" -#include "monster.h" #include "particle.h" #include "simpleanimation.h" #include "sound.h" @@ -80,7 +79,7 @@ const short walkingKeyboardDelay = 1000; LocalPlayer *player_node = NULL; LocalPlayer::LocalPlayer(int id, int subtype): - Player(id, subtype, 0), + Being(id, PLAYER, subtype, 0), mEquipment(new Equipment), mAttackRange(0), mTargetTime(-1), @@ -113,9 +112,6 @@ LocalPlayer::LocalPlayer(int id, int subtype): mUpdateName = true; - mTextColor = &Theme::getThemeColor(Theme::PLAYER); - mNameColor = &userPalette->getColor(UserPalette::SELF); - config.addListener("showownname", this); setShowName(config.getValue("showownname", 1)); } @@ -187,7 +183,7 @@ void LocalPlayer::logic() if (mTarget) { - if (mTarget->getType() == Being::NPC) + if (mTarget->getType() == ActorSprite::NPC) { // NPCs are always in range mTarget->setTargetType(TCT_IN_RANGE); @@ -219,7 +215,7 @@ void LocalPlayer::logic() } } - Player::logic(); + Being::logic(); } void LocalPlayer::setAction(Action action, int attackType) @@ -230,12 +226,7 @@ void LocalPlayer::setAction(Action action, int attackType) setTarget(NULL); } - Player::setAction(action, attackType); -} - -void LocalPlayer::setGM(bool gm) -{ - mIsGM = gm; + Being::setAction(action, attackType); } void LocalPlayer::setGMLevel(int level) @@ -621,7 +612,7 @@ void LocalPlayer::nextTile(unsigned char dir = 0) } - Player::nextTile(); + Being::nextTile(); } else { @@ -660,7 +651,6 @@ void LocalPlayer::inviteToGuild(Being *being) { if (being->getType() != PLAYER) return; - Player *player = static_cast<Player*>(being); // TODO: Allow user to choose which guild to invite being to // For now, just invite to the first guild you have permissions to invite with @@ -670,7 +660,7 @@ void LocalPlayer::inviteToGuild(Being *being) { if (checkInviteRights(itr->second->getName())) { - Net::getGuildHandler()->invite(itr->second->getId(), player); + Net::getGuildHandler()->invite(itr->second->getId(), being); return; } } @@ -746,12 +736,12 @@ void LocalPlayer::setTarget(Being *target) if (mTarget) mTarget->untarget(); - if (mTarget && mTarget->getType() == Being::MONSTER) + if (mTarget && mTarget->getType() == ActorSprite::MONSTER) mTarget->setShowName(false); mTarget = target; - if (target && target->getType() == Being::MONSTER) + if (target && target->getType() == ActorSprite::MONSTER) target->setShowName(true); } @@ -952,7 +942,7 @@ void LocalPlayer::attack(Being *target, bool keep) mKeepAttacking = keep; - if (!target || target->getType() == Being::NPC) + if (!target || target->getType() == ActorSprite::NPC) return; if (mTarget != target || !mTarget) |