summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-02 12:55:32 +0000
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-02 12:55:32 +0000
commit5efaa5125fe92a5438b3cc2949f4d720bced5a7a (patch)
tree87f4da1382fb6179610182ca3e502e5365e66276 /src/being.cpp
parent2e60491ceb0548b0bea93207c13b974d6a6cf5cc (diff)
downloadmana-5efaa5125fe92a5438b3cc2949f4d720bced5a7a.tar.gz
mana-5efaa5125fe92a5438b3cc2949f4d720bced5a7a.tar.bz2
mana-5efaa5125fe92a5438b3cc2949f4d720bced5a7a.tar.xz
mana-5efaa5125fe92a5438b3cc2949f4d720bced5a7a.zip
General code cleanups
* Don't needlessly store or return raw pointers in BeingInfo * Less copying, more moving * Less else after return * Make AddDEF a template instead of a macro * Removed some unused includes * Use range-based for loops
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 9549b625..6b21198a 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -378,12 +378,12 @@ void Being::takeDamage(Being *attacker, int amount,
}
else if (attacker && attacker->getType() == MONSTER)
{
- const Attack *attack = attacker->getInfo()->getAttack(attackId);
+ const Attack &attack = attacker->getInfo()->getAttack(attackId);
if (type != CRITICAL)
- hitEffectId = attack->mHitEffectId;
+ hitEffectId = attack.mHitEffectId;
else
- hitEffectId = attack->mCriticalHitEffectId;
+ hitEffectId = attack.mCriticalHitEffectId;
}
else
{
@@ -414,7 +414,7 @@ void Being::handleAttack(Being *victim, int damage, int attackId)
fireMissile(victim, mEquippedWeapon->getMissileParticleFile());
else
fireMissile(victim,
- mInfo->getAttack(attackId)->mMissileParticleFilename);
+ mInfo->getAttack(attackId).mMissileParticleFilename);
sound.playSfx(mInfo->getSound((damage > 0) ?
SOUND_EVENT_HIT : SOUND_EVENT_MISS),
@@ -593,13 +593,13 @@ void Being::setAction(Action action, int attackId)
}
else
{
- currentAction = mInfo->getAttack(attackId)->mAction;
+ currentAction = mInfo->getAttack(attackId).mAction;
reset();
// Attack particle effect
if (Particle::enabled)
{
- int effectId = mInfo->getAttack(attackId)->mEffectId;
+ int effectId = mInfo->getAttack(attackId).mEffectId;
int rotation = 0;
switch (mSpriteDirection)
{