summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
Diffstat (limited to 'src/being')
-rw-r--r--src/being/actorsprite.cpp2
-rw-r--r--src/being/actorsprite.h2
-rw-r--r--src/being/actortype.h16
-rw-r--r--src/being/being.cpp100
-rw-r--r--src/being/being.h2
-rw-r--r--src/being/localplayer.cpp20
-rw-r--r--src/being/playerrelations.cpp10
7 files changed, 76 insertions, 76 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 24c8779c0..bf3709089 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -217,7 +217,7 @@ void ActorSprite::updateStatusEffect(const int index, const bool newStatus)
index, newStatus);
if (!effect)
return;
- if (effect->isPoison() && getType() == ActorType::PLAYER)
+ if (effect->isPoison() && getType() == ActorType::Player)
setPoison(newStatus);
handleStatusEffect(effect, index);
}
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index b4b6d8433..79c00060b 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -64,7 +64,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
* Returns the type of the ActorSprite.
*/
virtual ActorType::Type getType() const A_WARN_UNUSED
- { return ActorType::UNKNOWN; }
+ { return ActorType::Unknown; }
void draw1(Graphics *const graphics,
const int offsetX,
diff --git a/src/being/actortype.h b/src/being/actortype.h
index 7603616ce..b45961c8a 100644
--- a/src/being/actortype.h
+++ b/src/being/actortype.h
@@ -26,14 +26,14 @@ namespace ActorType
{
enum Type
{
- UNKNOWN = 0,
- PLAYER,
- NPC,
- MONSTER,
- FLOOR_ITEM,
- PORTAL,
- LOCAL_PET,
- AVATAR
+ Unknown = 0,
+ Player,
+ Npc,
+ Monster,
+ FloorItem,
+ Portal,
+ LocalPet,
+ Avatar
};
} // namespace ActorType
diff --git a/src/being/being.cpp b/src/being/being.cpp
index b69ceaa4a..57e212b6a 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -218,16 +218,16 @@ Being::Being(const int id,
setMap(map);
setSubtype(subtype, 0);
- if (mType == ActorType::PLAYER)
+ if (mType == ActorType::Player)
mShowName = config.getBoolValue("visiblenames");
- else if (mType != ActorType::NPC)
+ else if (mType != ActorType::Npc)
mGotComment = true;
config.addListener("visiblenames", this);
reReadConfig();
- if (mType == ActorType::NPC)
+ if (mType == ActorType::Npc)
setShowName(true);
else
setShowName(mShowName);
@@ -288,7 +288,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
mSubType = subtype;
mLook = look;
- if (mType == ActorType::MONSTER)
+ if (mType == ActorType::Monster)
{
mInfo = MonsterDB::get(mSubType);
if (mInfo)
@@ -299,7 +299,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
mYDiff = mInfo->getSortOffsetY();
}
}
- else if (mType == ActorType::NPC)
+ else if (mType == ActorType::Npc)
{
mInfo = NPCDB::get(mSubType);
if (mInfo)
@@ -308,13 +308,13 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
mYDiff = mInfo->getSortOffsetY();
}
}
- else if (mType == ActorType::AVATAR)
+ else if (mType == ActorType::Avatar)
{
mInfo = AvatarDB::get(mSubType);
if (mInfo)
setupSpriteDisplay(mInfo->getDisplay(), false);
}
- else if (mType == ActorType::LOCAL_PET)
+ else if (mType == ActorType::LocalPet)
{
mInfo = PETDB::get(mId);
if (mInfo)
@@ -334,7 +334,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
}
}
}
- else if (mType == ActorType::PLAYER)
+ else if (mType == ActorType::Player)
{
int id = -100 - subtype;
@@ -545,7 +545,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
color = &userPalette->getColor(UserPalette::MISS);
}
}
- else if (mType == ActorType::MONSTER)
+ else if (mType == ActorType::Monster)
{
if (attacker == localPlayer)
{
@@ -558,7 +558,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
UserPalette::HIT_PLAYER_MONSTER);
}
}
- else if (mType == ActorType::PLAYER && attacker != localPlayer
+ else if (mType == ActorType::Player && attacker != localPlayer
&& this == localPlayer)
{
// here player was attacked by other player. mark him as enemy.
@@ -575,7 +575,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
{
if (this == localPlayer)
{
- if (attacker->mType == ActorType::PLAYER || amount)
+ if (attacker->mType == ActorType::Player || amount)
{
chatWindow->battleChatLog(strprintf("%s : Hit you -%d",
attacker->getName().c_str(), amount),
@@ -626,12 +626,12 @@ void Being::takeDamage(Being *const attacker, const int amount,
mHP = 0;
}
- if (mType == ActorType::MONSTER)
+ if (mType == ActorType::Monster)
{
updatePercentHP();
updateName();
}
- else if (mType == ActorType::PLAYER && socialWindow && getName() != "")
+ else if (mType == ActorType::Player && socialWindow && getName() != "")
{
socialWindow->updateAvatar(getName());
}
@@ -670,7 +670,7 @@ int Being::getHitEffect(const Being *const attacker,
{
const ItemInfo *const attackerWeapon
= attacker->getEquippedWeapon();
- if (attackerWeapon && attacker->getType() == ActorType::PLAYER)
+ if (attackerWeapon && attacker->getType() == ActorType::Player)
{
if (type == MISS)
hitEffectId = attackerWeapon->getMissEffectId();
@@ -679,7 +679,7 @@ int Being::getHitEffect(const Being *const attacker,
else
hitEffectId = attackerWeapon->getCriticalHitEffectId();
}
- else if (attacker->getType() == ActorType::MONSTER)
+ else if (attacker->getType() == ActorType::Monster)
{
const BeingInfo *const info = attacker->getInfo();
if (info)
@@ -740,7 +740,7 @@ void Being::handleAttack(Being *const victim, const int damage,
mLastAttackX = victim->getTileX();
mLastAttackY = victim->getTileY();
- if (mType == ActorType::PLAYER && mEquippedWeapon)
+ if (mType == ActorType::Player && mEquippedWeapon)
fireMissile(victim, mEquippedWeapon->getMissileParticleFile());
else if (mInfo->getAttack(attackId))
fireMissile(victim, mInfo->getAttack(attackId)->mMissileParticle);
@@ -755,13 +755,13 @@ void Being::handleAttack(Being *const victim, const int damage,
if (dir)
setDirection(dir);
}
- if (damage && victim->mType == ActorType::PLAYER
+ if (damage && victim->mType == ActorType::Player
&& victim->mAction == BeingAction::SIT)
{
victim->setAction(BeingAction::STAND, 0);
}
- if (mType == ActorType::PLAYER)
+ if (mType == ActorType::Player)
{
if (mSpriteIDs.size() >= 10)
{
@@ -809,7 +809,7 @@ void Being::handleSkill(Being *const victim, const int damage,
if (dir)
setDirection(dir);
}
- if (damage && victim->mType == ActorType::PLAYER
+ if (damage && victim->mType == ActorType::Player
&& victim->mAction == BeingAction::SIT)
{
victim->setAction(BeingAction::STAND, 0);
@@ -830,7 +830,7 @@ void Being::handleSkill(Being *const victim, const int damage,
void Being::setName(const std::string &name)
{
- if (mType == ActorType::NPC)
+ if (mType == ActorType::Npc)
{
mName = name.substr(0, name.find('#', 0));
showName();
@@ -839,7 +839,7 @@ void Being::setName(const std::string &name)
{
mName = name;
- if (mType == ActorType::PLAYER && getShowName())
+ if (mType == ActorType::Player && getShowName())
showName();
}
}
@@ -1202,7 +1202,7 @@ void Being::setAction(const BeingAction::Action &action, const int attackId)
this,
false,
mX, mY);
- if (mType == ActorType::MONSTER || mType == ActorType::NPC)
+ if (mType == ActorType::Monster || mType == ActorType::Npc)
mYDiff = mInfo->getDeadSortOffsetY();
}
break;
@@ -1343,7 +1343,7 @@ void Being::nextTile()
}
mActionTime += static_cast<int>(mSpeed / 10);
- if ((mType != ActorType::PLAYER || mUseDiagonal)
+ if ((mType != ActorType::Player || mUseDiagonal)
&& mX != pos.x && mY != pos.y)
{
mSpeed = static_cast<float>(mWalkSpeed.x * 1.4F);
@@ -1472,7 +1472,7 @@ void Being::logic()
&& static_cast<int> ((static_cast<float>(get_elapsed_time(mActionTime))
/ mSpeed)) >= frameCount)
{
- if (mType != ActorType::PLAYER && actorManager)
+ if (mType != ActorType::Player && actorManager)
actorManager->destroy(this);
}
@@ -1779,7 +1779,7 @@ void Being::updateCoords()
offsetY += mInfo->getNameOffsetY();
}
// Monster names show above the sprite instead of below it
- if (mType == ActorType::MONSTER)
+ if (mType == ActorType::Monster)
offsetY += - getHeight() - mDispName->getHeight();
mDispName->adviseXY(offsetX, offsetY, mMoveNames);
@@ -1787,7 +1787,7 @@ void Being::updateCoords()
void Being::optionChanged(const std::string &value)
{
- if (mType == ActorType::PLAYER && value == "visiblenames")
+ if (mType == ActorType::Player && value == "visiblenames")
setShowName(config.getBoolValue("visiblenames"));
}
@@ -1849,7 +1849,7 @@ void Being::showName()
std::string displayName(mName);
- if (mType != ActorType::MONSTER && (mShowGender || mShowLevel))
+ if (mType != ActorType::Monster && (mShowGender || mShowLevel))
{
displayName.append(" ");
if (mShowLevel && getLevel() != 0)
@@ -1858,7 +1858,7 @@ void Being::showName()
displayName.append(getGenderSign());
}
- if (mType == ActorType::MONSTER)
+ if (mType == ActorType::Monster)
{
if (config.getBoolValue("showMonstersTakedDamage"))
displayName.append(", ").append(toString(getDamageTaken()));
@@ -1866,11 +1866,11 @@ void Being::showName()
Font *font = nullptr;
if (localPlayer && localPlayer->getTarget() == this
- && mType != ActorType::MONSTER)
+ && mType != ActorType::Monster)
{
font = boldFont;
}
- else if (mType == ActorType::PLAYER
+ else if (mType == ActorType::Player
&& !player_relations.isGoodName(this) && gui)
{
font = gui->getSecureFont();
@@ -1896,12 +1896,12 @@ void Being::updateColors()
{
if (userPalette)
{
- if (mType == ActorType::MONSTER)
+ if (mType == ActorType::Monster)
{
mNameColor = &userPalette->getColor(UserPalette::MONSTER);
mTextColor = &userPalette->getColor(UserPalette::MONSTER);
}
- else if (mType == ActorType::NPC)
+ else if (mType == ActorType::Npc)
{
mNameColor = &userPalette->getColor(UserPalette::NPC);
mTextColor = &userPalette->getColor(UserPalette::NPC);
@@ -2024,7 +2024,7 @@ void Being::setSprite(const unsigned int slot, const int id,
if (id1)
{
const ItemInfo &info = ItemDB::get(id1);
- if (!isTempSprite && mMap && mType == ActorType::PLAYER)
+ if (!isTempSprite && mMap && mType == ActorType::Player)
{
const int pet = info.getPet();
if (pet)
@@ -2039,7 +2039,7 @@ void Being::setSprite(const unsigned int slot, const int id,
const std::string &filename = info.getSprite(mGender, mSubType);
AnimatedSprite *equipmentSprite = nullptr;
- if (!isTempSprite && mType == ActorType::PLAYER)
+ if (!isTempSprite && mType == ActorType::Player)
{
const int pet = info.getPet();
if (pet)
@@ -2211,7 +2211,7 @@ bool Being::updateFromCache()
}
updateAwayEffect();
- if (mType == ActorType::PLAYER)
+ if (mType == ActorType::Player)
updateColors();
return true;
}
@@ -2393,7 +2393,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
}
}
- if (mHighlightMonsterAttackRange && mType == ActorType::MONSTER
+ if (mHighlightMonsterAttackRange && mType == ActorType::Monster
&& isAlive())
{
int attackRange;
@@ -2411,7 +2411,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
}
if (mShowMobHP && mInfo && localPlayer && localPlayer->getTarget() == this
- && mType == ActorType::MONSTER)
+ && mType == ActorType::Monster)
{
// show hp bar here
int maxHP = mMaxHP;
@@ -2516,7 +2516,7 @@ void Being::setHP(const int hp)
mHP = hp;
if (mMaxHP < mHP)
mMaxHP = mHP;
- if (mType == ActorType::MONSTER)
+ if (mType == ActorType::Monster)
updatePercentHP();
}
@@ -2905,18 +2905,18 @@ std::string Being::loadComment(const std::string &name,
std::string str;
switch (type)
{
- case ActorType::PLAYER:
+ case ActorType::Player:
str = settings.usersDir;
break;
- case ActorType::NPC:
+ case ActorType::Npc:
str = settings.npcsDir;
break;
- case ActorType::UNKNOWN:
- case ActorType::MONSTER:
- case ActorType::FLOOR_ITEM:
- case ActorType::PORTAL:
- case ActorType::LOCAL_PET:
- case ActorType::AVATAR:
+ case ActorType::Unknown:
+ case ActorType::Monster:
+ case ActorType::FloorItem:
+ case ActorType::Portal:
+ case ActorType::LocalPet:
+ case ActorType::Avatar:
default:
return "";
}
@@ -2938,10 +2938,10 @@ void Being::saveComment(const std::string &restrict name,
std::string dir;
switch (type)
{
- case ActorType::PLAYER:
+ case ActorType::Player:
dir = settings.usersDir;
break;
- case ActorType::NPC:
+ case ActorType::Npc:
dir = settings.npcsDir;
break;
default:
@@ -3134,7 +3134,7 @@ void Being::addPet(const int id)
}
Being *const being = actorManager->createBeing(
- id, ActorType::LOCAL_PET, 0);
+ id, ActorType::LocalPet, 0);
if (being)
{
being->setOwner(this);
@@ -3326,7 +3326,7 @@ void Being::playSfx(const SoundInfo &sound, Being *const being,
void Being::setLook(const uint8_t look)
{
- if (mType == ActorType::PLAYER)
+ if (mType == ActorType::Player)
setSubtype(mSubType, look);
}
diff --git a/src/being/being.h b/src/being/being.h
index c50cdf871..ed1127844 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -634,7 +634,7 @@ class Being notfinal : public ActorSprite,
void setGM(const bool gm);
bool canTalk() const A_WARN_UNUSED
- { return mType == ActorType::NPC; }
+ { return mType == ActorType::Npc; }
void talkTo() const;
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 70600ff2c..237f21dc2 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -110,7 +110,7 @@ extern MiniStatusWindow *miniStatusWindow;
extern SkillDialog *skillDialog;
LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
- Being(id, ActorType::PLAYER, subtype, nullptr),
+ Being(id, ActorType::Player, subtype, nullptr),
AttributeListener(),
StatListener(),
mGMLevel(0),
@@ -289,7 +289,7 @@ void LocalPlayer::logic()
if (mTarget)
{
- if (mTarget->getType() == ActorType::NPC)
+ if (mTarget->getType() == ActorType::Npc)
{
// NPCs are always in range
mTarget->setTargetType(TargetCursorType::IN_RANGE);
@@ -308,7 +308,7 @@ void LocalPlayer::logic()
mTarget->setTargetType(targetType);
if (!mTarget->isAlive() && (!mTargetDeadPlayers
- || mTarget->getType() != ActorType::PLAYER))
+ || mTarget->getType() != ActorType::Player))
{
stopAttack(true);
}
@@ -527,7 +527,7 @@ void LocalPlayer::setTarget(Being *const target)
oldTarget = mTarget;
}
- if (mTarget && mTarget->getType() == ActorType::MONSTER)
+ if (mTarget && mTarget->getType() == ActorType::Monster)
mTarget->setShowName(false);
mTarget = target;
@@ -542,7 +542,7 @@ void LocalPlayer::setTarget(Being *const target)
mTarget->updateName();
}
- if (target && target->getType() == ActorType::MONSTER)
+ if (target && target->getType() == ActorType::Monster)
target->setShowName(true);
}
@@ -725,7 +725,7 @@ void LocalPlayer::attack(Being *const target, const bool keep,
{
mKeepAttacking = keep;
- if (!target || target->getType() == ActorType::NPC)
+ if (!target || target->getType() == ActorType::Npc)
return;
if (mTarget != target)
@@ -755,7 +755,7 @@ void LocalPlayer::attack(Being *const target, const bool keep,
mActionTime = tick_time;
- if (target->getType() != ActorType::PLAYER
+ if (target->getType() != ActorType::Player
|| checAttackPermissions(target))
{
setAction(BeingAction::ATTACK);
@@ -2771,7 +2771,7 @@ void LocalPlayer::attack2(Being *const target, const bool keep,
return;
}
setTarget(target);
- if (target->getType() != ActorType::NPC)
+ if (target->getType() != ActorType::Npc)
{
mKeepAttacking = true;
moveToTarget();
@@ -2984,7 +2984,7 @@ void LocalPlayer::followMoveTo(const Being *const being,
if (actorManager)
{
Being *const b = actorManager->findBeingByName(
- mPlayerFollowed, ActorType::PLAYER);
+ mPlayerFollowed, ActorType::Player);
setTarget(b);
}
}
@@ -3144,7 +3144,7 @@ void LocalPlayer::checkNewName(Being *const being)
return;
const std::string &nick = being->getName();
- if (being->getType() == ActorType::PLAYER)
+ if (being->getType() == ActorType::Player)
{
const Guild *const guild = getGuild();
if (guild)
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index 656e59088..e592b9e8e 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -249,9 +249,9 @@ void PlayerRelationsManager::signalUpdate(const std::string &name)
if (actorManager)
{
Being *const being = actorManager->findBeingByName(
- name, ActorType::PLAYER);
+ name, ActorType::Player);
- if (being && being->getType() == ActorType::PLAYER)
+ if (being && being->getType() == ActorType::Player)
being->updateColors();
}
}
@@ -300,7 +300,7 @@ bool PlayerRelationsManager::hasPermission(const Being *const being,
if (!being)
return false;
- if (being->getType() == ActorType::PLAYER)
+ if (being->getType() == ActorType::Player)
return hasPermission(being->getName(), flags) == flags;
return true;
}
@@ -321,9 +321,9 @@ bool PlayerRelationsManager::hasPermission(const std::string &name,
if (mIgnoreStrategy)
{
Being *const b = actorManager->findBeingByName(
- name, ActorType::PLAYER);
+ name, ActorType::Player);
- if (b && b->getType() == ActorType::PLAYER)
+ if (b && b->getType() == ActorType::Player)
mIgnoreStrategy->ignore(b, rejections);
}
}