diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-20 21:20:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-20 21:20:41 +0300 |
commit | 65c3c7a8ac6437d507597b840fc20dc1cad5fbf1 (patch) | |
tree | fc6ff6da1aa6a97e4cd8f84309010d47a65b01ff | |
parent | 8fb2c062cd1c03f032b99f4a7e7663c0653ba837 (diff) | |
download | manaplus-65c3c7a8ac6437d507597b840fc20dc1cad5fbf1.tar.gz manaplus-65c3c7a8ac6437d507597b840fc20dc1cad5fbf1.tar.bz2 manaplus-65c3c7a8ac6437d507597b840fc20dc1cad5fbf1.tar.xz manaplus-65c3c7a8ac6437d507597b840fc20dc1cad5fbf1.zip |
Add missing const in being directory.
-rw-r--r-- | src/being/actor.h | 2 | ||||
-rw-r--r-- | src/being/being.cpp | 26 | ||||
-rw-r--r-- | src/being/being.h | 10 | ||||
-rw-r--r-- | src/being/compoundsprite.cpp | 6 | ||||
-rw-r--r-- | src/being/compoundsprite.h | 6 | ||||
-rw-r--r-- | src/being/crazymoves.cpp | 8 | ||||
-rw-r--r-- | src/being/crazymoves.h | 28 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 14 |
8 files changed, 55 insertions, 45 deletions
diff --git a/src/being/actor.h b/src/being/actor.h index 3e004c419..875d162bb 100644 --- a/src/being/actor.h +++ b/src/being/actor.h @@ -76,7 +76,7 @@ class Actor notfinal /** * Sets the pixel position of this actor. */ - virtual void setPosition(const Vector &pos) + virtual void setPosition(const Vector &restrict pos) restrict2 { mPos = pos; } /** diff --git a/src/being/being.cpp b/src/being/being.cpp index 1f3a35844..ce16f9ff4 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -851,7 +851,7 @@ int Being::getHitEffect(const Being *restrict const attacker, int hitEffectId = 0; if (type == AttackType::SKILL || type == AttackType::SKILLMISS) { - SkillData *restrict const data = skillDialog->getSkillDataByLevel( + const SkillData *restrict const data = skillDialog->getSkillDataByLevel( attackId, level); if (!data) return -1; @@ -2070,7 +2070,7 @@ void Being::drawEmotion(Graphics *restrict const graphics, int y; if (mShowBadges == 2 && mDispName && gui) { - Font *restrict const font = gui->getFont(); + const Font *restrict const font = gui->getFont(); x = mDispName->getX() - offsetX + mDispName->getWidth(); y = mDispName->getY() - offsetY - font->getHeight(); } @@ -2086,7 +2086,7 @@ void Being::drawEmotion(Graphics *restrict const graphics, } for_each_badges() { - AnimatedSprite *restrict const sprite = mBadges[f]; + const AnimatedSprite *restrict const sprite = mBadges[f]; if (sprite) { sprite->draw(graphics, x, y); @@ -2884,7 +2884,8 @@ void Being::draw(Graphics *restrict const graphics, } void Being::drawSprites(Graphics *restrict const graphics, - int posX, int posY) const restrict2 + const int posX, + const int posY) const restrict2 { const int sz = getNumberOfLayers(); for (int f = 0; f < sz; f ++) @@ -2903,7 +2904,8 @@ void Being::drawSprites(Graphics *restrict const graphics, } void Being::drawSpritesSDL(Graphics *restrict const graphics, - int posX, int posY) const restrict2 + const int posX, + const int posY) const restrict2 { const unsigned int sz = CAST_U32(size()); for (unsigned int f = 0; f < sz; f ++) @@ -3992,7 +3994,7 @@ void Being::removeAllItemsParticles() restrict2 void Being::addItemParticles(const int id, const SpriteDisplay &restrict display) restrict2 { - SpriteParticleInfoIter it = mSpriteParticles.find(id); + const SpriteParticleInfoIter it = mSpriteParticles.find(id); ParticleInfo *restrict pi = nullptr; if (it == mSpriteParticles.end()) { @@ -4027,7 +4029,7 @@ void Being::addItemParticles(const int id, void Being::removeItemParticles(const int id) restrict2 { - SpriteParticleInfoIter it = mSpriteParticles.find(id); + const SpriteParticleInfoIter it = mSpriteParticles.find(id); if (it == mSpriteParticles.end()) return; ParticleInfo *restrict const pi = (*it).second; @@ -4271,7 +4273,7 @@ void Being::setHorse(const int horseId) restrict2 { FOR_EACH (SpriteRefs, it, mHorseInfo->downSprites) { - SpriteReference *restrict const ref = *it; + const SpriteReference *restrict const ref = *it; AnimatedSprite *const sprite = AnimatedSprite::load( ref->sprite, ref->variant); @@ -4281,8 +4283,8 @@ void Being::setHorse(const int horseId) restrict2 } FOR_EACH (SpriteRefs, it, mHorseInfo->upSprites) { - SpriteReference *restrict const ref = *it; - AnimatedSprite *sprite = AnimatedSprite::load( + const SpriteReference *restrict const ref = *it; + AnimatedSprite *const sprite = AnimatedSprite::load( ref->sprite, ref->variant); mUpHorseSprites.push_back(sprite); @@ -4334,7 +4336,7 @@ void Being::addSpiritBalls(const unsigned int balls, return; for (unsigned int f = 0; f < balls; f ++) { - Particle *particle = effectManager->triggerReturn( + Particle *const particle = effectManager->triggerReturn( effectId, this); mSpiritParticles.push_back(particle); @@ -4347,7 +4349,7 @@ void Being::removeSpiritBalls(const unsigned int balls) restrict2 return; for (unsigned int f = 0; f < balls && !mSpiritParticles.empty(); f ++) { - Particle *restrict const particle = mSpiritParticles.back(); + const Particle *restrict const particle = mSpiritParticles.back(); mChildParticleEffects.removeLocally(particle); mSpiritParticles.pop_back(); } diff --git a/src/being/being.h b/src/being/being.h index fb818aa4b..fb2931009 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -534,14 +534,14 @@ class Being notfinal : public ActorSprite, void setState(const uint8_t state) restrict2; virtual void drawSprites(Graphics *restrict const graphics, - int posX, - int posY) const + const int posX, + const int posY) const restrict2 override final A_NONNULL(2); virtual void drawSpritesSDL(Graphics *restrict const graphics, - int posX, - int posY) const restrict2 override final - A_NONNULL(2); + const int posX, + const int posY) const + restrict2 override final A_NONNULL(2); void drawHpBar(Graphics *restrict const graphics, const int maxHP, diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp index 110870c07..981125633 100644 --- a/src/being/compoundsprite.cpp +++ b/src/being/compoundsprite.cpp @@ -162,7 +162,8 @@ void CompoundSprite::draw(Graphics *const graphics, } void CompoundSprite::drawSprites(Graphics *const graphics, - int posX, int posY) const + const int posX, + const int posY) const { FOR_EACH (SpriteConstIterator, it, mSprites) { @@ -175,7 +176,8 @@ void CompoundSprite::drawSprites(Graphics *const graphics, } void CompoundSprite::drawSpritesSDL(Graphics *const graphics, - int posX, int posY) const + const int posX, + const int posY) const { FOR_EACH (SpriteConstIterator, it, mSprites) { diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h index 88e8486df..797ae767c 100644 --- a/src/being/compoundsprite.h +++ b/src/being/compoundsprite.h @@ -95,10 +95,12 @@ class CompoundSprite notfinal : public Sprite void ensureSize(size_t layerCount); virtual void drawSprites(Graphics *const graphics, - int posX, int posY) const; + const int posX, + const int posY) const; virtual void drawSpritesSDL(Graphics *const graphics, - int posX, int posY) const; + const int posX, + const int posY) const; /** * Returns the curent frame in the current animation of the given diff --git a/src/being/crazymoves.cpp b/src/being/crazymoves.cpp index 3eb3fd3f4..9e7d6b8fe 100644 --- a/src/being/crazymoves.cpp +++ b/src/being/crazymoves.cpp @@ -491,7 +491,7 @@ void CrazyMoves::crazyMove9() } } -void CrazyMoves::crazyMoveAm() +void CrazyMoves::crazyMoveAm() const { if (!localPlayer) return; @@ -569,7 +569,7 @@ void CrazyMoves::crazyMoveAm() } } -void CrazyMoves::crazyMoveAd() +void CrazyMoves::crazyMoveAd() const { settings.crazyMoveState ++; @@ -710,7 +710,7 @@ void CrazyMoves::crazyMoveAs() settings.crazyMoveState ++; } -void CrazyMoves::crazyMoveAo() +void CrazyMoves::crazyMoveAo() const { settings.crazyMoveState ++; if (settings.crazyMoveState < mMoveProgram.length()) @@ -730,7 +730,7 @@ void CrazyMoves::crazyMoveAo() } } -void CrazyMoves::crazyMoveAe() +void CrazyMoves::crazyMoveAe() const { settings.crazyMoveState ++; const signed char emo = mMoveProgram[settings.crazyMoveState]; diff --git a/src/being/crazymoves.h b/src/being/crazymoves.h index f29625247..bb96814ad 100644 --- a/src/being/crazymoves.h +++ b/src/being/crazymoves.h @@ -35,21 +35,21 @@ class CrazyMoves final void crazyMove(); protected: - void crazyMove1(); - void crazyMove2(); - void crazyMove3(); - void crazyMove4(); - void crazyMove5(); - void crazyMove6(); - void crazyMove7(); - void crazyMove8(); - void crazyMove9(); + static void crazyMove1(); + static void crazyMove2(); + static void crazyMove3(); + static void crazyMove4(); + static void crazyMove5(); + static void crazyMove6(); + static void crazyMove7(); + static void crazyMove8(); + static void crazyMove9(); void crazyMoveA(); - void crazyMoveAd(); - void crazyMoveAe(); - void crazyMoveAm(); - void crazyMoveAo(); - void crazyMoveAs(); + void crazyMoveAd() const; + void crazyMoveAe() const; + void crazyMoveAm() const; + void crazyMoveAo() const; + static void crazyMoveAs(); std::string mMoveProgram; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index ef034fc22..c3cf67d66 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -566,7 +566,7 @@ Being *LocalPlayer::setNewTarget(const ActorTypeT type, localPlayer, 20, type, allowSort); if (target && target != mTarget) - localPlayer->setTarget(target); + setTarget(target); return target; } @@ -1267,8 +1267,8 @@ void LocalPlayer::moveToTarget(int dist) unsigned int f = 0; for (Path::const_iterator i = debugPath.begin(), - i_end = debugPath.end(); - i != i_end && f < limit; ++i, f++) + i_fend = debugPath.end(); + i != i_fend && f < limit; ++i, f++) { pos = (*i); } @@ -1799,7 +1799,9 @@ void LocalPlayer::saveHomes() std::stringstream ss; for (std::map<std::string, Vector>::const_iterator iter = mHomes.begin(), - iter_end = mHomes.end(); iter != iter_end; ++iter ) + iter_fend = mHomes.end(); + iter != iter_fend; + ++iter) { const Vector &pos = (*iter).second; @@ -2077,7 +2079,9 @@ void LocalPlayer::updateCoords() else { for (Path::const_iterator i = mNavigatePath.begin(), - i_end = mNavigatePath.end(); i != i_end; ++ i) + i_fend = mNavigatePath.end(); + i != i_fend; + ++i) { if ((*i).x == mX && (*i).y == mY) { |