summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
Diffstat (limited to 'src/being')
-rw-r--r--src/being/crazymoves.cpp2
-rw-r--r--src/being/localplayer.cpp44
-rw-r--r--src/being/localplayer.h47
3 files changed, 55 insertions, 38 deletions
diff --git a/src/being/crazymoves.cpp b/src/being/crazymoves.cpp
index 5fb093d9d..e2d960aa4 100644
--- a/src/being/crazymoves.cpp
+++ b/src/being/crazymoves.cpp
@@ -806,7 +806,7 @@ void CrazyMoves::crazyMoveA()
else if (mMoveProgram[settings.crazyMoveState] == 'p')
{
settings.crazyMoveState ++;
- localPlayer->pickUpItems();
+ localPlayer->pickUpItems(0);
}
// emote
else if (mMoveProgram[settings.crazyMoveState] == 'e'
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 206f1f1ca..e12bdbdf4 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -334,7 +334,7 @@ void LocalPlayer::logic()
}
if (mKeepAttacking && (mTarget != nullptr))
- attack(mTarget, true);
+ attack(mTarget, true, false);
}
}
@@ -466,10 +466,12 @@ void LocalPlayer::nextTile()
pickUp(mPickUpTarget);
}
- if (mGoingToTarget && (mTarget != nullptr) && withinAttackRange(mTarget))
+ if (mGoingToTarget &&
+ mTarget != nullptr &&
+ withinAttackRange(mTarget, false, 0))
{
mAction = BeingAction::STAND;
- attack(mTarget, true);
+ attack(mTarget, true, false);
mGoingToTarget = false;
mPath.clear();
return;
@@ -780,7 +782,8 @@ bool LocalPlayer::emote(const uint8_t emotion)
return true;
}
-void LocalPlayer::attack(Being *const target, const bool keep,
+void LocalPlayer::attack(Being *const target,
+ const bool keep,
const bool dontChangeEquipment)
{
mKeepAttacking = keep;
@@ -841,7 +844,7 @@ void LocalPlayer::attack(Being *const target, const bool keep,
}
if (!keep)
- stopAttack();
+ stopAttack(false);
}
void LocalPlayer::stopAttack(const bool keepAttack)
@@ -1190,7 +1193,8 @@ void LocalPlayer::addJobMessage(const int64_t change)
addMessageToQueue(strprintf("%s %s",
xpStr.c_str(),
// TRANSLATORS: this is job experience
- _("job")));
+ _("job")),
+ UserColorId::EXP_INFO);
}
}
else
@@ -1198,7 +1202,8 @@ void LocalPlayer::addJobMessage(const int64_t change)
addMessageToQueue(strprintf("%s %s",
xpStr.c_str(),
// TRANSLATORS: this is job experience
- _("job")));
+ _("job")),
+ UserColorId::EXP_INFO);
}
}
}
@@ -1210,7 +1215,8 @@ void LocalPlayer::addXpMessage(const int64_t change)
addMessageToQueue(strprintf("%s %s",
toString(CAST_U64(change)).c_str(),
// TRANSLATORS: get xp message
- _("xp")));
+ _("xp")),
+ UserColorId::EXP_INFO);
}
}
@@ -1223,7 +1229,8 @@ void LocalPlayer::addHomunXpMessage(const int change)
_("Homun"),
change,
// TRANSLATORS: get xp message
- _("xp")));
+ _("xp")),
+ UserColorId::EXP_INFO);
}
}
@@ -1232,7 +1239,8 @@ void LocalPlayer::addHpMessage(const int change)
if (change != 0 && mMessages.size() < 20)
{
// TRANSLATORS: get hp message
- addMessageToQueue(strprintf("%d %s", change, _("hp")));
+ addMessageToQueue(strprintf("%d %s", change, _("hp")),
+ UserColorId::EXP_INFO);
}
}
@@ -1241,7 +1249,8 @@ void LocalPlayer::addSpMessage(const int change)
if (change != 0 && mMessages.size() < 20)
{
// TRANSLATORS: get hp message
- addMessageToQueue(strprintf("%d %s", change, _("mana")));
+ addMessageToQueue(strprintf("%d %s", change, _("mana")),
+ UserColorId::EXP_INFO);
}
}
@@ -2268,7 +2277,8 @@ int LocalPlayer::getAttackRange2() const
return range;
}
-void LocalPlayer::attack2(Being *const target, const bool keep,
+void LocalPlayer::attack2(Being *const target,
+ const bool keep,
const bool dontChangeEquipment)
{
if (!dontChangeEquipment && (target != nullptr))
@@ -2283,12 +2293,12 @@ void LocalPlayer::attack2(Being *const target, const bool keep,
(withinAttackRange(target, broken, broken ? 1 : 0) &&
getPathLength(target) <= getAttackRange2()))
{
- attack(target, keep);
+ attack(target, keep, false);
if (settings.attackType == 2)
{
if (target == nullptr)
{
- if (pickUpItems())
+ if (pickUpItems(0))
return;
}
else
@@ -2301,14 +2311,14 @@ void LocalPlayer::attack2(Being *const target, const bool keep,
{
if (settings.attackType == 2)
{
- if (pickUpItems())
+ if (pickUpItems(0))
return;
}
setTarget(target);
if (target->getType() != ActorType::Npc)
{
mKeepAttacking = true;
- moveToTarget();
+ moveToTarget(-1);
}
}
}
@@ -2526,7 +2536,7 @@ void LocalPlayer::followMoveTo(const Being *const being,
setTarget(b);
}
}
- moveToTarget();
+ moveToTarget(-1);
setNextDest(x2, y2);
break;
default:
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 11ac545bc..a262a6651 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -56,7 +56,7 @@ class LocalPlayer final : public Being,
* Constructor.
*/
explicit LocalPlayer(const BeingId id,
- const BeingTypeId subType = BeingTypeId_zero);
+ const BeingTypeId subType);
A_DELETE_COPY(LocalPlayer)
@@ -103,15 +103,17 @@ class LocalPlayer final : public Being,
int getAttackRange2() const A_WARN_UNUSED;
- void attack(Being *const target = nullptr, const bool keep = false,
- const bool dontChangeEquipment = false);
+ void attack(Being *const target,
+ const bool keep,
+ const bool dontChangeEquipment);
- void attack2(Being *const target = nullptr, const bool keep = false,
- const bool dontChangeEquipment = false);
+ void attack2(Being *const target,
+ const bool keep,
+ const bool dontChangeEquipment);
void setGroupId(const int id) override final;
- void stopAttack(const bool keepAttack = false);
+ void stopAttack(const bool keepAttack);
void untarget();
@@ -154,13 +156,13 @@ class LocalPlayer final : public Being,
* Returns whether the target is in range to attack
*/
bool withinAttackRange(const Being *const target,
- const bool fixDistance = false,
- const int addRange = 0) const A_WARN_UNUSED;
+ const bool fixDistance,
+ const int addRange) const A_WARN_UNUSED;
/**
* Stops the player dead in his tracks
*/
- void stopWalking(const bool sendToServer = true);
+ void stopWalking(const bool sendToServer);
bool toggleSit() const;
@@ -205,18 +207,19 @@ class LocalPlayer final : public Being,
void moveByDirection(const unsigned char dir);
- bool pickUpItems(int pickUpType = 0);
+ bool pickUpItems(int pickUpType);
void move(const int dX, const int dY);
- void moveToTarget(int dist = -1);
+ void moveToTarget(int dist);
void moveToHome();
bool isReachable(Being *const being,
- const int maxCost = 0) A_WARN_UNUSED;
+ const int maxCost) A_WARN_UNUSED;
- bool isReachable(const int x, const int y,
+ bool isReachable(const int x,
+ const int y,
const bool allowCollision) const A_WARN_UNUSED;
void setHome();
@@ -253,12 +256,17 @@ class LocalPlayer final : public Being,
const unsigned char dir);
void imitateOutfit(const Being *const player,
- const int sprite = -1) const;
+ const int sprite) const;
- void followMoveTo(const Being *const being, const int x, const int y);
+ void followMoveTo(const Being *const being,
+ const int x,
+ const int y);
- void followMoveTo(const Being *const being, const int x1, const int y1,
- const int x2, const int y2);
+ void followMoveTo(const Being *const being,
+ const int x1,
+ const int y1,
+ const int x2,
+ const int y2);
bool allowAction() A_WARN_UNUSED;
@@ -275,8 +283,7 @@ class LocalPlayer final : public Being,
void setMap(Map *const map) override final;
void addMessageToQueue(const std::string &message,
- const UserColorIdT color
- = UserColorId::EXP_INFO);
+ const UserColorIdT color);
/**
* Called when a option (set with config.addListener()) is changed
@@ -385,7 +392,7 @@ class LocalPlayer final : public Being,
void updateStatus() const;
void setTestParticle(const std::string &fileName,
- const bool updateHash = true);
+ const bool updateHash);
int getLastAttackX() const override final
{ return mTarget != nullptr ? mTarget->mX : mLastAttackX; }