From 311c175f3184103950c72bc5c775174597430b83 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Jul 2017 01:31:22 +0300 Subject: Replace std::vector into macro STD_VECTOR. In most case it equal to std::vector except debug modes. Now it can be also mse::mstd::vector, but sadly this class not support all required features. --- src/being/being.cpp | 24 ++++++++++++------------ src/being/being.h | 14 +++++++------- src/being/compoundsprite.h | 6 +++--- src/being/localplayer.h | 2 +- src/being/playerrelations.cpp | 4 ++-- src/being/playerrelations.h | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 56f22a1d5..508104d27 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -156,7 +156,7 @@ static const unsigned int SPEECH_MAX_TIME = 800; for (int f = 0; f < BadgeIndex::BadgeIndexSize; f++) #define for_each_horses(name) \ - FOR_EACH (std::vector::const_iterator, it, name) + FOR_EACH (STD_VECTOR::const_iterator, it, name) Being::Being(const BeingId id, const ActorTypeT type) : @@ -3265,8 +3265,8 @@ void Being::setSpriteSlot(const unsigned int slot, void Being::dumpSprites() const restrict2 { - std::vector::const_iterator it1 = mSlots.begin(); - const std::vector::const_iterator it1_end = mSlots.end(); + STD_VECTOR::const_iterator it1 = mSlots.begin(); + const STD_VECTOR::const_iterator it1_end = mSlots.end(); logger->log("sprites"); for (; it1 != it1_end; @@ -4195,10 +4195,10 @@ void Being::recalcSpritesOrder() restrict2 if (sz < 1) return; - std::vector slotRemap; + STD_VECTOR slotRemap; IntMap itemSlotRemap; - std::vector::iterator it; + STD_VECTOR::iterator it; int oldHide[20]; bool updatedSprite[20]; int dir = mSpriteDirection; @@ -4471,7 +4471,7 @@ void Being::recalcSpritesOrder() restrict2 } } -int Being::searchSlotValue(const std::vector &restrict slotRemap, +int Being::searchSlotValue(const STD_VECTOR &restrict slotRemap, const int val) const restrict2 { const size_t sz = mSprites.size(); @@ -4483,14 +4483,14 @@ int Being::searchSlotValue(const std::vector &restrict slotRemap, return CompoundSprite::getNumberOfLayers() - 1; } -void Being::searchSlotValueItr(std::vector::iterator &restrict it, +void Being::searchSlotValueItr(STD_VECTOR::iterator &restrict it, int &restrict idx, - std::vector &restrict slotRemap, + STD_VECTOR &restrict slotRemap, const int val) { // logger->log("searching %d", val); it = slotRemap.begin(); - const std::vector::iterator it_end = slotRemap.end(); + const STD_VECTOR::iterator it_end = slotRemap.end(); idx = 0; while (it != it_end) { @@ -4974,7 +4974,7 @@ void Being::removeItemParticles(const int id) restrict2 ParticleInfo *restrict const pi = (*it).second; if (pi != nullptr) { - FOR_EACH (std::vector::const_iterator, itp, pi->particles) + FOR_EACH (STD_VECTOR::const_iterator, itp, pi->particles) mChildParticleEffects.removeLocally(*itp); delete pi; } @@ -4988,13 +4988,13 @@ void Being::recreateItemParticles() restrict2 ParticleInfo *restrict const pi = (*it).second; if ((pi != nullptr) && !pi->files.empty()) { - FOR_EACH (std::vector::const_iterator, + FOR_EACH (STD_VECTOR::const_iterator, itp, pi->particles) { mChildParticleEffects.removeLocally(*itp); } - FOR_EACH (std::vector::const_iterator, str, pi->files) + FOR_EACH (STD_VECTOR::const_iterator, str, pi->files) { Particle *const p = particleEngine->addEffect( *str, 0, 0); diff --git a/src/being/being.h b/src/being/being.h index 8bba7548d..6f9e753d9 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1184,7 +1184,7 @@ class Being notfinal : public ActorSprite, typedef std::map SpriteParticleInfo; typedef SpriteParticleInfo::iterator SpriteParticleInfoIter; - std::vector mSlots; + STD_VECTOR mSlots; SpriteParticleInfo mSpriteParticles; // Character guild information @@ -1226,12 +1226,12 @@ class Being notfinal : public ActorSprite, template int getOffset() const restrict2 A_WARN_UNUSED; - int searchSlotValue(const std::vector &restrict slotRemap, + int searchSlotValue(const STD_VECTOR &restrict slotRemap, const int val) const restrict2 A_WARN_UNUSED; - static void searchSlotValueItr(std::vector::iterator &restrict it, + static void searchSlotValueItr(STD_VECTOR::iterator &restrict it, int &idx, - std::vector &restrict slotRemap, + STD_VECTOR &restrict slotRemap, const int val); void addSpiritBalls(const unsigned int balls, @@ -1286,9 +1286,9 @@ class Being notfinal : public ActorSprite, Particle *restrict mSpecialParticle; ChatObject *restrict mChat; HorseInfo *restrict mHorseInfo; - std::vector mDownHorseSprites; - std::vector mUpHorseSprites; - std::vector mSpiritParticles; + STD_VECTOR mDownHorseSprites; + STD_VECTOR mUpHorseSprites; + STD_VECTOR mSpiritParticles; int mX; // position in tiles int mY; // position in tiles diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h index 92474025a..bf6679963 100644 --- a/src/being/compoundsprite.h +++ b/src/being/compoundsprite.h @@ -36,8 +36,8 @@ class Image; class CompoundSprite notfinal : public Sprite { public: - typedef std::vector::iterator SpriteIterator; - typedef std::vector::const_iterator SpriteConstIterator; + typedef STD_VECTOR::iterator SpriteIterator; + typedef STD_VECTOR::const_iterator SpriteConstIterator; CompoundSprite(); @@ -107,7 +107,7 @@ class CompoundSprite notfinal : public Sprite int getStartTime() const noexcept2 A_WARN_UNUSED { return mStartTime; } - std::vector mSprites; + STD_VECTOR mSprites; protected: void redraw() const; diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 76a8c913b..fced5be26 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -471,7 +471,7 @@ class LocalPlayer final : public Being, int mLastAction; // Time stamp of the last action, -1 if none. - std::vector mStatusEffectIcons; + STD_VECTOR mStatusEffectIcons; typedef std::pair MessagePair; /** Queued messages*/ diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 8911ef3e7..8da47f36b 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -181,7 +181,7 @@ static const char *const DEFAULT_PERMISSIONS = "default-player-permissions"; int PlayerRelationsManager::getPlayerIgnoreStrategyIndex( const std::string &name) { - const std::vector *const strategies + const STD_VECTOR *const strategies = getPlayerIgnoreStrategies(); if (strategies == nullptr) @@ -576,7 +576,7 @@ class PIS_emote final : public PlayerIgnoreStrategy uint8_t mEmotion; }; -std::vector * +STD_VECTOR * PlayerRelationsManager::getPlayerIgnoreStrategies() { if (mIgnoreStrategies.empty()) diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h index c9e5952f2..d1db4a003 100644 --- a/src/being/playerrelations.h +++ b/src/being/playerrelations.h @@ -118,7 +118,7 @@ class PlayerRelationsManager final * The player ignore strategies are allocated statically and must * not be deleted. */ - std::vector *getPlayerIgnoreStrategies() + STD_VECTOR *getPlayerIgnoreStrategies() A_WARN_UNUSED; /** @@ -202,7 +202,7 @@ class PlayerRelationsManager final PlayerIgnoreStrategy *mIgnoreStrategy; std::map mRelations; std::list mListeners; - std::vector mIgnoreStrategies; + STD_VECTOR mIgnoreStrategies; }; -- cgit v1.2.3-60-g2f50