diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-06 21:42:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-06 21:42:39 +0300 |
commit | 7b818cbf0b07826fd93bfe9c6cc22f9f1ede3329 (patch) | |
tree | 5a0c8a07f9930599f6b1efaf7a684bedeeb482bb /src/being | |
parent | f970dbd2e2c2548114ef86dc7d6b3046791c6612 (diff) | |
download | manaverse-7b818cbf0b07826fd93bfe9c6cc22f9f1ede3329.tar.gz manaverse-7b818cbf0b07826fd93bfe9c6cc22f9f1ede3329.tar.bz2 manaverse-7b818cbf0b07826fd93bfe9c6cc22f9f1ede3329.tar.xz manaverse-7b818cbf0b07826fd93bfe9c6cc22f9f1ede3329.zip |
Add noexcept into being.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/actorsprite.h | 2 | ||||
-rw-r--r-- | src/being/being.cpp | 2 | ||||
-rw-r--r-- | src/being/being.h | 194 | ||||
-rw-r--r-- | src/being/flooritem.h | 2 |
4 files changed, 99 insertions, 101 deletions
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index f621211ca..314fff9fb 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -66,7 +66,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor /** * Returns the type of the ActorSprite. */ - virtual ActorTypeT getType() const A_WARN_UNUSED + virtual ActorTypeT getType() const noexcept A_WARN_UNUSED { return ActorType::Unknown; } void draw1(Graphics *const graphics, diff --git a/src/being/being.cpp b/src/being/being.cpp index 194bfb526..2de362365 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -4225,7 +4225,7 @@ bool Being::isSellShopEnabled() const restrict2 #endif } -void Being::serverRemove() restrict2 +void Being::serverRemove() restrict2 noexcept { // remove some flags what can survive player remove and next visible mTrickDead = false; diff --git a/src/being/being.h b/src/being/being.h index ee9b53112..a689e961a 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -68,7 +68,7 @@ extern volatile int cur_time; struct NextSoundInfo final { - NextSoundInfo() : + NextSoundInfo() noexcept : sound(nullptr), x(0), y(0), @@ -106,7 +106,8 @@ class Being notfinal : public ActorSprite, virtual ~Being(); - ActorTypeT getType() const restrict2 override final A_WARN_UNUSED + ActorTypeT getType() const restrict2 noexcept override final + A_WARN_UNUSED { return mType; } /** @@ -117,14 +118,14 @@ class Being notfinal : public ActorSprite, /** * Returns the time spent in the current action. */ - int getActionTime() const restrict2 A_WARN_UNUSED + int getActionTime() const restrict2 noexcept A_WARN_UNUSED { return mActionTime; } /** * Set the current action time. * @see Ea::BeingHandler that set it to tick time. */ - void setActionTime(const int actionTime) restrict2 + void setActionTime(const int actionTime) restrict2 noexcept { mActionTime = actionTime; } /** @@ -140,19 +141,19 @@ class Being notfinal : public ActorSprite, /** * Returns the destination for this being. */ - const Vector &getDestination() const restrict2 A_WARN_UNUSED + const Vector &getDestination() const restrict2 noexcept A_WARN_UNUSED { return mDest; } /** * Returns the tile x coord */ - int getTileX() const restrict2 override A_WARN_UNUSED + int getTileX() const restrict2 noexcept override A_WARN_UNUSED { return mX; } /** * Returns the tile y coord */ - int getTileY() const restrict2 override A_WARN_UNUSED + int getTileY() const restrict2 noexcept override A_WARN_UNUSED { return mY; } /** @@ -207,7 +208,7 @@ class Being notfinal : public ActorSprite, /** * Returns the name of the being. */ - const std::string &getName() const restrict2 A_WARN_UNUSED + const std::string &getName() const restrict2 noexcept A_WARN_UNUSED { return mName; } /** @@ -217,7 +218,7 @@ class Being notfinal : public ActorSprite, */ void setName(const std::string &restrict name) restrict2; - bool getShowName() const A_WARN_UNUSED + bool getShowName() const noexcept A_WARN_UNUSED { return mShowName; } void setShowName(const bool doShowName) restrict2; @@ -227,10 +228,12 @@ class Being notfinal : public ActorSprite, */ void setPartyName(const std::string &restrict name) restrict2; - const std::string &getPartyName() const restrict2 A_WARN_UNUSED + const std::string &getPartyName() const restrict2 noexcept + A_WARN_UNUSED { return mPartyName; } - const std::string &getGuildName() const restrict2 A_WARN_UNUSED + const std::string &getGuildName() const restrict2 noexcept + A_WARN_UNUSED { return mGuildName; } /** @@ -270,7 +273,8 @@ class Being notfinal : public ActorSprite, /** * Returns all guilds the being is in. */ - const std::map<int, Guild*> &getGuilds() const restrict2 A_WARN_UNUSED + const std::map<int, Guild*> &getGuilds() const restrict2 noexcept + A_WARN_UNUSED { return mGuilds; } /** @@ -284,7 +288,7 @@ class Being notfinal : public ActorSprite, int16_t getNumberOfGuilds() const restrict2 A_WARN_UNUSED { return static_cast<int16_t>(mGuilds.size()); } - bool isInParty() const restrict2 A_WARN_UNUSED + bool isInParty() const restrict2 noexcept A_WARN_UNUSED { return mParty; } void setParty(Party *restrict const party) restrict2; @@ -293,7 +297,7 @@ class Being notfinal : public ActorSprite, void updateGuild() restrict2; - Party *getParty() const restrict2 A_WARN_UNUSED + Party *getParty() const restrict2 noexcept A_WARN_UNUSED { return mParty; } int getSpritesCount() const restrict2 A_WARN_UNUSED @@ -325,13 +329,13 @@ class Being notfinal : public ActorSprite, /** * Get the number of hairstyles implemented */ - static int getNumOfHairstyles() A_WARN_UNUSED + static int getNumOfHairstyles() noexcept A_WARN_UNUSED { return mNumberOfHairstyles; } /** * Get the number of races implemented */ - static int getNumOfRaces() A_WARN_UNUSED + static int getNumOfRaces() noexcept A_WARN_UNUSED { return mNumberOfRaces; } /** @@ -360,7 +364,7 @@ class Being notfinal : public ActorSprite, const int offsetX, const int offsetY) const restrict2 A_NONNULL(2); - BeingTypeId getSubType() const restrict2 + BeingTypeId getSubType() const restrict2 noexcept A_WARN_UNUSED { return mSubType; } /** @@ -369,7 +373,7 @@ class Being notfinal : public ActorSprite, void setSubtype(const BeingTypeId subtype, const uint16_t look) restrict2; - const BeingInfo *getInfo() const restrict2 A_WARN_UNUSED + const BeingInfo *getInfo() const restrict2 noexcept A_WARN_UNUSED { return mInfo; } TargetCursorSizeT getTargetCursorSize() const restrict2 override final @@ -418,21 +422,21 @@ class Being notfinal : public ActorSprite, /** * Gets the walk speed in pixels per second. */ - Vector getWalkSpeed() const restrict2 A_WARN_UNUSED + Vector getWalkSpeed() const restrict2 noexcept A_WARN_UNUSED { return mWalkSpeed; } /** * Sets the attack speed. * @todo In what unit? */ - void setAttackSpeed(const int speed) restrict2 + void setAttackSpeed(const int speed) restrict2 noexcept { mAttackSpeed = speed; } /** * Gets the attack speed. * @todo In what unit? */ - int getAttackSpeed() const restrict2 A_WARN_UNUSED + int getAttackSpeed() const restrict2 noexcept A_WARN_UNUSED { return mAttackSpeed; } /** @@ -444,19 +448,19 @@ class Being notfinal : public ActorSprite, /** * Get the being's action currently performed. */ - BeingActionT getCurrentAction() const restrict2 A_WARN_UNUSED + BeingActionT getCurrentAction() const restrict2 noexcept A_WARN_UNUSED { return mAction; } /** * Returns whether this being is still alive. */ - bool isAlive() const restrict2 A_WARN_UNUSED + bool isAlive() const restrict2 noexcept A_WARN_UNUSED { return mAction != BeingAction::DEAD; } /** * Returns the current direction. */ - uint8_t getDirection() const restrict2 A_WARN_UNUSED + uint8_t getDirection() const restrict2 noexcept A_WARN_UNUSED { return mDirection; } /** @@ -464,17 +468,17 @@ class Being notfinal : public ActorSprite, */ virtual void setDirection(const uint8_t direction) restrict2; - virtual void setDirectionDelayed(const uint8_t direction) restrict2 + void setDirectionDelayed(const uint8_t direction) restrict2 noexcept { mDirectionDelayed = direction; } - uint8_t getDirectionDelayed() const restrict2 A_WARN_UNUSED + uint8_t getDirectionDelayed() const restrict2 noexcept A_WARN_UNUSED { return mDirectionDelayed; } /** * Returns the direction the being is facing. */ - SpriteDirection::Type getSpriteDirection() const - restrict2 A_WARN_UNUSED + SpriteDirection::Type getSpriteDirection() const restrict2 noexcept + A_WARN_UNUSED { return mSpriteDirection; } void setPosition(const Vector &restrict pos) restrict2 override; @@ -502,12 +506,6 @@ class Being notfinal : public ActorSprite, { return std::max(CompoundSprite::getHeight(), DEFAULT_BEING_HEIGHT); } /** - * Returns the being's pixel radius used to detect collisions. - */ - virtual int getCollisionRadius() const restrict2 A_WARN_UNUSED - { return 16; } - - /** * Shoots a missile particle from this being, to target being */ void fireMissile(Being *restrict const target, @@ -517,13 +515,13 @@ class Being notfinal : public ActorSprite, * Returns the path this being is following. An empty path is returned * when this being isn't following any path currently. */ - const Path &getPath() const restrict2 A_WARN_UNUSED + const Path &getPath() const restrict2 noexcept A_WARN_UNUSED { return mPath; } - int getDistance() const restrict2 A_WARN_UNUSED + int getDistance() const restrict2 noexcept A_WARN_UNUSED { return mDistance; } - void setDistance(const int n) restrict2 + void setDistance(const int n) restrict2 noexcept { mDistance = n; } /** @@ -563,24 +561,24 @@ class Being notfinal : public ActorSprite, void flashName(const int time) restrict2; - int getDamageTaken() const restrict2 A_WARN_UNUSED + int getDamageTaken() const restrict2 noexcept A_WARN_UNUSED { return mDamageTaken; } - void setDamageTaken(const int damage) restrict2 + void setDamageTaken(const int damage) restrict2 noexcept { mDamageTaken = damage; } void updateName() restrict2; - void setLevel(const int n) restrict2 + void setLevel(const int n) restrict2 noexcept { mLevel = n; } virtual int getLevel() const restrict2 A_WARN_UNUSED { return mLevel; } - void setReachable(const ReachableT n) restrict2 + void setReachable(const ReachableT n) restrict2 noexcept { mReachable = n; } - ReachableT getReachable() const restrict2 A_WARN_UNUSED + ReachableT getReachable() const restrict2 noexcept A_WARN_UNUSED { return mReachable; } static void reReadConfig(); @@ -596,7 +594,7 @@ class Being notfinal : public ActorSprite, */ virtual void setGender(const GenderT gender) restrict2; - GenderT getGender() const restrict2 A_WARN_UNUSED + GenderT getGender() const restrict2 noexcept A_WARN_UNUSED { return mGender; } /** @@ -629,7 +627,7 @@ class Being notfinal : public ActorSprite, /** * Whether or not this player is a GM. */ - bool isGM() const restrict2 A_WARN_UNUSED + bool isGM() const restrict2 noexcept A_WARN_UNUSED { return mIsGM; } /** @@ -637,7 +635,7 @@ class Being notfinal : public ActorSprite, */ void setGM(const bool gm) restrict2; - bool canTalk() const restrict2 A_WARN_UNUSED + bool canTalk() const restrict2 noexcept A_WARN_UNUSED { return mType == ActorType::Npc; } void talkTo() const restrict2; @@ -651,60 +649,60 @@ class Being notfinal : public ActorSprite, const int x, const int y) const restrict2 A_NONNULL(2); - void setMoveTime() restrict2 + void setMoveTime() restrict2 noexcept { mMoveTime = cur_time; } - void setAttackTime() restrict2 + void setAttackTime() restrict2 noexcept { mAttackTime = cur_time; } - void setTalkTime() restrict2 + void setTalkTime() restrict2 noexcept { mTalkTime = cur_time; } - void setTestTime() restrict2 + void setTestTime() restrict2 noexcept { mTestTime = cur_time; } - void setOtherTime() restrict2 + void setOtherTime() restrict2 noexcept { mOtherTime = cur_time; } - unsigned int getMoveTime() const restrict2 + unsigned int getMoveTime() const restrict2 noexcept { return mMoveTime; } - unsigned int getAttackTime() const restrict2 + unsigned int getAttackTime() const restrict2 noexcept { return mAttackTime; } - unsigned int getTalkTime() const restrict2 + unsigned int getTalkTime() const restrict2 noexcept { return mTalkTime; } - unsigned int getTestTime() const restrict2 + unsigned int getTestTime() const restrict2 noexcept { return mTestTime; } - unsigned int getOtherTime() const restrict2 + unsigned int getOtherTime() const restrict2 noexcept { return mOtherTime; } void resetCounters() restrict2; void updateColors() restrict2; - void setEnemy(const bool n) restrict2 + void setEnemy(const bool n) restrict2 noexcept { mEnemy = n; } - const std::string &getIp() const restrict2 A_WARN_UNUSED + const std::string &getIp() const restrict2 noexcept A_WARN_UNUSED { return mIp; } - void setIp(const std::string &restrict ip) restrict2 + void setIp(const std::string &restrict ip) restrict2 noexcept { mIp = ip; } - unsigned int getPvpRank() const restrict2 A_WARN_UNUSED + unsigned int getPvpRank() const restrict2 noexcept A_WARN_UNUSED { return mPvpRank; } - void setPvpRank(const unsigned int rank) restrict2 + void setPvpRank(const unsigned int rank) restrict2 noexcept { mPvpRank = rank; } void setHP(const int n) restrict2; void setMaxHP(const int hp) restrict2; - int getHP() const restrict2 A_WARN_UNUSED + int getHP() const restrict2 noexcept A_WARN_UNUSED { return mHP; } uint8_t calcDirection(const int dstX, @@ -712,28 +710,28 @@ class Being notfinal : public ActorSprite, uint8_t calcDirection() const restrict2 A_WARN_UNUSED; - void setAttackDelay(const int n) restrict2 + void setAttackDelay(const int n) restrict2 noexcept { mAttackDelay = n; } - int getAttackDelay() const restrict2 A_WARN_UNUSED + int getAttackDelay() const restrict2 noexcept A_WARN_UNUSED { return mAttackDelay; } - int getMinHit() const restrict2 A_WARN_UNUSED + int getMinHit() const restrict2 noexcept A_WARN_UNUSED { return mMinHit; } - void setMinHit(const int n) restrict2 + void setMinHit(const int n) restrict2 noexcept { mMinHit = n; } - int getMaxHit() const restrict2 A_WARN_UNUSED + int getMaxHit() const restrict2 noexcept A_WARN_UNUSED { return mMaxHit; } - void setMaxHit(const int n) restrict2 + void setMaxHit(const int n) restrict2 noexcept { mMaxHit = n; } int getCriticalHit() const restrict2 A_WARN_UNUSED { return mCriticalHit; } - void setCriticalHit(const int n) restrict2 + void setCriticalHit(const int n) restrict2 noexcept { mCriticalHit = n; } void updateHit(const int amount) restrict2; @@ -742,10 +740,10 @@ class Being notfinal : public ActorSprite, void undressItemById(const int id) restrict2; - int getGoodStatus() const restrict2 A_WARN_UNUSED + int getGoodStatus() const restrict2 noexcept A_WARN_UNUSED { return mGoodStatus; } - void setGoodStatus(const int n) restrict2 + void setGoodStatus(const int n) restrict2 noexcept { mGoodStatus = n; } std::string getGenderSign() const restrict2 A_WARN_UNUSED; @@ -754,10 +752,10 @@ class Being notfinal : public ActorSprite, void updateComment() restrict2; - const std::string getComment() const restrict2 A_WARN_UNUSED + const std::string getComment() const restrict2 noexcept A_WARN_UNUSED { return mComment; } - void setComment(const std::string &restrict n) restrict2 + void setComment(const std::string &restrict n) restrict2 noexcept { mComment = n; } static void clearCache(); @@ -770,7 +768,7 @@ class Being notfinal : public ActorSprite, const std::string &restrict comment, const ActorTypeT &restrict type); - bool isAdvanced() const restrict2 A_WARN_UNUSED + bool isAdvanced() const restrict2 noexcept A_WARN_UNUSED { return mAdvanced; } void setAdvanced(const bool n) restrict2 @@ -785,7 +783,7 @@ class Being notfinal : public ActorSprite, /** * Sets the attack range. */ - void setAttackRange(const int range) restrict2 + void setAttackRange(const int range) restrict2 noexcept { mAttackRange = range; } /* @@ -800,10 +798,10 @@ class Being notfinal : public ActorSprite, void updatePercentHP() restrict2; - void setRaceName(const std::string &restrict name) restrict2 + void setRaceName(const std::string &restrict name) restrict2 noexcept { mRaceName = name; } - std::string getRaceName() const restrict2 A_WARN_UNUSED + std::string getRaceName() const restrict2 noexcept A_WARN_UNUSED { return mRaceName; } int getSpriteID(const int slot) const restrict2 A_WARN_UNUSED; @@ -816,10 +814,10 @@ class Being notfinal : public ActorSprite, void setHairColor(const unsigned int slot, const ItemColor color) restrict2; - void setHairColor(const ItemColor color) restrict2 + void setHairColor(const ItemColor color) restrict2 noexcept { mHairColor = color; } - ItemColor getHairColor() const A_WARN_UNUSED + ItemColor getHairColor() const noexcept A_WARN_UNUSED { return mHairColor; } void recalcSpritesOrder() restrict2; @@ -853,16 +851,16 @@ class Being notfinal : public ActorSprite, void fixPetSpawnPos(int &restrict dstX, int &restrict dstY) const restrict2; - const std::vector<Being*> &getPets() const restrict2 + const std::vector<Being*> &getPets() const restrict2 noexcept { return mPets; } Being *getFirstPet() restrict2 { return mPets.empty() ? nullptr : mPets[0]; } - void setOwner(Being *restrict const owner) restrict2 + void setOwner(Being *restrict const owner) restrict2 noexcept { mOwner = owner; } - Being *getOwner() const restrict2 + Being *getOwner() const restrict2 noexcept { return mOwner; } void unassignPet(const Being *restrict const pet) restrict2; @@ -876,7 +874,7 @@ class Being notfinal : public ActorSprite, const bool main, const int x, const int y) const restrict2; - uint16_t getLook() const restrict2 + uint16_t getLook() const restrict2 noexcept { return mLook; } void setLook(const uint16_t look) restrict2; @@ -900,10 +898,10 @@ class Being notfinal : public ActorSprite, void recreateItemParticles() restrict2; - void incUsage() restrict2 + void incUsage() restrict2 noexcept { mUsageCounter ++; } - int decUsage() restrict2 + int decUsage() restrict2 noexcept { return --mUsageCounter; } virtual int getLastAttackX() const restrict2 @@ -917,7 +915,7 @@ class Being notfinal : public ActorSprite, void setChat(ChatObject *restrict const obj) restrict2; - ChatObject *getChat() const restrict2 + ChatObject *getChat() const restrict2 noexcept { return mChat; } void setRiding(const bool b) restrict2 override final; @@ -928,42 +926,42 @@ class Being notfinal : public ActorSprite, void setSellBoard(const std::string &restrict text) restrict2; - std::string getSellBoard() const restrict2 A_WARN_UNUSED + std::string getSellBoard() const restrict2 noexcept A_WARN_UNUSED { return mSellBoard; } void setBuyBoard(const std::string &restrict text) restrict2; - std::string getBuyBoard() const restrict2 A_WARN_UNUSED + std::string getBuyBoard() const restrict2 noexcept A_WARN_UNUSED { return mBuyBoard; } void setSpiritBalls(const unsigned int balls) restrict2; - unsigned int getSpiritBalls() const restrict2 A_WARN_UNUSED + unsigned int getSpiritBalls() const restrict2 noexcept A_WARN_UNUSED { return mSpiritBalls; } #endif - void setKarma(const int karma) restrict2 + void setKarma(const int karma) restrict2 noexcept { mKarma = karma; } - int getKarma() const restrict2 + int getKarma() const restrict2 noexcept A_WARN_UNUSED { return mKarma; } - void setManner(const int manner) restrict2 + void setManner(const int manner) restrict2 noexcept { mManner = manner; } - int getManner() const restrict2 + int getManner() const restrict2 noexcept A_WARN_UNUSED { return mManner; } - void disablePetAi() restrict2 + void disablePetAi() restrict2 noexcept { mPetAi = false; } - void enablePetAi() restrict2 + void enablePetAi() restrict2 noexcept { mPetAi = true; } - int getAreaSize() const restrict2 + int getAreaSize() const restrict2 noexcept A_WARN_UNUSED { return mAreaSize; } - void setAreaSize(const int areaSize) restrict2 + void setAreaSize(const int areaSize) restrict2 noexcept { mAreaSize = areaSize; } void setTeamId(const uint16_t teamId) restrict2; @@ -986,10 +984,10 @@ class Being notfinal : public ActorSprite, void showBadges(const bool show) restrict2; - uint16_t getTeamId() const restrict2 + uint16_t getTeamId() const restrict2 noexcept A_WARN_UNUSED { return mTeamId; } - void serverRemove() restrict2; + void serverRemove() restrict2 noexcept; protected: /** diff --git a/src/being/flooritem.h b/src/being/flooritem.h index 7d7a12022..343e50c40 100644 --- a/src/being/flooritem.h +++ b/src/being/flooritem.h @@ -64,7 +64,7 @@ class FloorItem final : public ActorSprite void postInit(Map *const map, int subX, int subY); - ActorTypeT getType() const override final A_WARN_UNUSED + ActorTypeT getType() const noexcept override final A_WARN_UNUSED { return ActorType::FloorItem; } void draw(Graphics *const graphics, |