summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-30 12:25:16 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-30 12:25:16 +0300
commit1680d159ecbf75591d2dab1416ff8144c27d4de5 (patch)
treecd34ad27487036265f08d7aa63476c160280d899 /src/being
parent9913b4b481ddcaf0fa8499f3554c85bb588be7f0 (diff)
downloadmanaverse-1680d159ecbf75591d2dab1416ff8144c27d4de5.tar.gz
manaverse-1680d159ecbf75591d2dab1416ff8144c27d4de5.tar.bz2
manaverse-1680d159ecbf75591d2dab1416ff8144c27d4de5.tar.xz
manaverse-1680d159ecbf75591d2dab1416ff8144c27d4de5.zip
Rename player_node variable into localPlayer.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/actorsprite.cpp4
-rw-r--r--src/being/being.cpp62
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/being/localplayer.h2
-rw-r--r--src/being/playerrelations.cpp4
5 files changed, 37 insertions, 37 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 8c414b83f..c26d33d7e 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -83,8 +83,8 @@ ActorSprite::~ActorSprite()
mUsedTargetCursor = nullptr;
- if (player_node && player_node->getTarget() == this)
- player_node->setTarget(nullptr);
+ if (localPlayer && localPlayer->getTarget() == this)
+ localPlayer->setTarget(nullptr);
// Notify listeners of the destruction.
FOR_EACH (ActorSpriteListenerIterator, iter, mActorSpriteListeners)
diff --git a/src/being/being.cpp b/src/being/being.cpp
index f5c4611ef..f69a084c0 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -522,7 +522,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
if (type == CRITICAL)
attacker->setCriticalHit(amount);
- if (attacker == player_node)
+ if (attacker == localPlayer)
{
color = &userPalette->getColor(
UserPalette::HIT_LOCAL_PLAYER_CRITICAL);
@@ -534,7 +534,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
}
else if (!amount)
{
- if (attacker == player_node)
+ if (attacker == localPlayer)
{
// This is intended to be the wrong direction to visually
// differentiate between hits and misses
@@ -547,7 +547,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
}
else if (mType == ActorType::MONSTER)
{
- if (attacker == player_node)
+ if (attacker == localPlayer)
{
color = &userPalette->getColor(
UserPalette::HIT_LOCAL_PLAYER_MONSTER);
@@ -558,8 +558,8 @@ void Being::takeDamage(Being *const attacker, const int amount,
UserPalette::HIT_PLAYER_MONSTER);
}
}
- else if (mType == ActorType::PLAYER && attacker != player_node
- && this == player_node)
+ else if (mType == ActorType::PLAYER && attacker != localPlayer
+ && this == localPlayer)
{
// here player was attacked by other player. mark him as enemy.
color = &userPalette->getColor(UserPalette::HIT_PLAYER_PLAYER);
@@ -573,7 +573,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
if (chatWindow && mShowBattleEvents)
{
- if (this == player_node)
+ if (this == localPlayer)
{
if (attacker->mType == ActorType::PLAYER || amount)
{
@@ -582,7 +582,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
ChatMsgType::BY_OTHER);
}
}
- else if (attacker == player_node && amount)
+ else if (attacker == localPlayer && amount)
{
chatWindow->battleChatLog(strprintf("%s : You hit %s -%d",
attacker->getName().c_str(), getName().c_str(), amount),
@@ -601,8 +601,8 @@ void Being::takeDamage(Being *const attacker, const int amount,
if (amount > 0)
{
- if (player_node && player_node == this)
- player_node->setLastHitFrom(attacker->getName());
+ if (localPlayer && localPlayer == this)
+ localPlayer->setLastHitFrom(attacker->getName());
mDamageTaken += amount;
if (mInfo)
@@ -734,7 +734,7 @@ void Being::handleAttack(Being *const victim, const int damage,
if (!victim || !mInfo)
return;
- if (this != player_node)
+ if (this != localPlayer)
setAction(BeingAction::ATTACK, attackId);
mLastAttackX = victim->getTileX();
@@ -748,7 +748,7 @@ void Being::handleAttack(Being *const victim, const int damage,
reset();
mActionTime = tick_time;
- if (this != player_node)
+ if (this != localPlayer)
{
const uint8_t dir = calcDirection(victim->getTileX(),
victim->getTileY());
@@ -790,7 +790,7 @@ void Being::handleSkill(Being *const victim, const int damage,
if (!victim || !mInfo || !skillDialog)
return;
- if (this != player_node)
+ if (this != localPlayer)
setAction(BeingAction::ATTACK, 1);
const SkillInfo *const skill = skillDialog->getSkill(skillId);
@@ -802,7 +802,7 @@ void Being::handleSkill(Being *const victim, const int damage,
reset();
mActionTime = tick_time;
- if (this != player_node)
+ if (this != localPlayer)
{
const uint8_t dir = calcDirection(victim->getTileX(),
victim->getTileY());
@@ -873,13 +873,13 @@ void Being::addGuild(Guild *const guild)
mGuilds[guild->getId()] = guild;
- if (this == player_node && socialWindow)
+ if (this == localPlayer && socialWindow)
socialWindow->addTab(guild);
}
void Being::removeGuild(const int id)
{
- if (this == player_node && socialWindow)
+ if (this == localPlayer && socialWindow)
socialWindow->removeTab(mGuilds[id]);
if (mGuilds[id])
@@ -925,7 +925,7 @@ void Being::clearGuilds()
if (guild)
{
- if (this == player_node && socialWindow)
+ if (this == localPlayer && socialWindow)
socialWindow->removeTab(guild);
guild->removeMember(mId);
@@ -951,7 +951,7 @@ void Being::setParty(Party *const party)
updateColors();
- if (this == player_node && socialWindow)
+ if (this == localPlayer && socialWindow)
{
if (old)
socialWindow->removeTab(old);
@@ -963,10 +963,10 @@ void Being::setParty(Party *const party)
void Being::updateGuild()
{
- if (!player_node)
+ if (!localPlayer)
return;
- Guild *const guild = player_node->getGuild();
+ Guild *const guild = localPlayer->getGuild();
if (!guild)
{
clearGuilds();
@@ -996,7 +996,7 @@ void Being::setGuild(Guild *const guild)
updateColors();
- if (this == player_node && socialWindow)
+ if (this == localPlayer && socialWindow)
{
if (old)
socialWindow->removeTab(old);
@@ -1420,7 +1420,7 @@ void Being::logic()
/ mAttackSpeed;
}
- if (this == player_node && curFrame >= frameCount)
+ if (this == localPlayer && curFrame >= frameCount)
nextTile();
break;
@@ -1865,7 +1865,7 @@ void Being::showName()
}
Font *font = nullptr;
- if (player_node && player_node->getTarget() == this
+ if (localPlayer && localPlayer->getTarget() == this
&& mType != ActorType::MONSTER)
{
font = boldFont;
@@ -1906,7 +1906,7 @@ void Being::updateColors()
mNameColor = &userPalette->getColor(UserPalette::NPC);
mTextColor = &userPalette->getColor(UserPalette::NPC);
}
- else if (this == player_node)
+ else if (this == localPlayer)
{
mNameColor = &userPalette->getColor(UserPalette::SELF);
mTextColor = &theme->getColor(Theme::PLAYER, 255);
@@ -1929,13 +1929,13 @@ void Being::updateColors()
{
mNameColor = &userPalette->getColor(UserPalette::MONSTER);
}
- else if (mParty && player_node
- && mParty == player_node->getParty())
+ else if (mParty && localPlayer
+ && mParty == localPlayer->getParty())
{
mNameColor = &userPalette->getColor(UserPalette::PARTY);
}
- else if (player_node && getGuild()
- && getGuild() == player_node->getGuild())
+ else if (localPlayer && getGuild()
+ && getGuild() == localPlayer->getGuild())
{
mNameColor = &userPalette->getColor(UserPalette::GUILD);
}
@@ -2220,7 +2220,7 @@ bool Being::updateFromCache()
void Being::addToCache() const
{
- if (player_node == this)
+ if (localPlayer == this)
return;
BeingCacheEntry *entry = Being::getCacheEntry(getId());
@@ -2410,7 +2410,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
}
- if (mShowMobHP && mInfo && player_node && player_node->getTarget() == this
+ if (mShowMobHP && mInfo && localPlayer && localPlayer->getTarget() == this
&& mType == ActorType::MONSTER)
{
// show hp bar here
@@ -2426,7 +2426,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
}
if (mShowOwnHP
&& mInfo
- && player_node == this
+ && localPlayer == this
&& mAction != BeingAction::DEAD)
{
drawHpBar(graphics, PlayerInfo::getAttribute(Attributes::MAX_HP),
@@ -2469,7 +2469,7 @@ void Being::drawHpBar(Graphics *const graphics, const int maxHP, const int hp,
if (serverVersion < 1)
{ // old servers
- if ((!damage && (this != player_node || hp == maxHP))
+ if ((!damage && (this != localPlayer || hp == maxHP))
|| (!hp && maxHP == damage))
{
graphics->setColor(userPalette->getColorWithAlpha(color1));
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index ec4c51a19..e906ea5ab 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -99,7 +99,7 @@ static const int MAX_TICK_VALUE = INT_MAX / 2;
typedef std::map<int, Guild*>::const_iterator GuildMapCIter;
-LocalPlayer *player_node = nullptr;
+LocalPlayer *localPlayer = nullptr;
class SkillDialog;
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index de78981cc..d8a0d5e0f 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -524,6 +524,6 @@ class LocalPlayer final : public Being,
bool mShowNavigePath;
};
-extern LocalPlayer *player_node;
+extern LocalPlayer *localPlayer;
#endif // BEING_LOCALPLAYER_H
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index 42f15d1ba..656e59088 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -335,8 +335,8 @@ void PlayerRelationsManager::setRelation(const std::string &player_name,
const PlayerRelation::Relation
relation)
{
- if (!player_node || (relation != PlayerRelation::NEUTRAL
- && player_node->getName() == player_name))
+ if (!localPlayer || (relation != PlayerRelation::NEUTRAL
+ && localPlayer->getName() == player_name))
{
return;
}