diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-30 01:19:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-30 13:11:34 +0300 |
commit | 6b1684d33dec02eb6308bb3d8d3707f4d5252ba5 (patch) | |
tree | 4a0a5fd220828b92ef96446fe38dbe67ff446c6c /src | |
parent | 2a70a50c785ce639b76141a3a6887836d22fe12c (diff) | |
download | ManaVerse-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.tar.gz ManaVerse-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.tar.bz2 ManaVerse-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.tar.xz ManaVerse-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.zip |
Add unused warnings to some files.
Diffstat (limited to 'src')
105 files changed, 894 insertions, 826 deletions
diff --git a/src/actor.h b/src/actor.h index 21d5172c5..21363b513 100644 --- a/src/actor.h +++ b/src/actor.h @@ -26,6 +26,8 @@ #include <list> +#include "localconsts.h" + class Actor; class Graphics; class Image; @@ -56,20 +58,20 @@ public: * Returns the horizontal size of the actors graphical representation * in pixels or 0 when it is undefined. */ - virtual int getWidth() const + virtual int getWidth() const A_WARN_UNUSED { return 0; } /** * Returns the vertical size of the actors graphical representation * in pixels or 0 when it is undefined. */ - virtual int getHeight() const + virtual int getHeight() const A_WARN_UNUSED { return 0; } /** * Returns the pixel position of this actor. */ - const Vector &getPosition() const + const Vector &getPosition() const A_WARN_UNUSED { return mPos; } /** @@ -81,41 +83,41 @@ public: /** * Returns the pixels X coordinate of the actor. */ - int getPixelX() const + int getPixelX() const A_WARN_UNUSED { return static_cast<int>(mPos.x); } /** * Returns the pixel Y coordinate of the actor. */ - virtual int getPixelY() const + virtual int getPixelY() const A_WARN_UNUSED { return static_cast<int>(mPos.y); } /** * Returns the pixel Y coordinate of the actor for sorting only. */ - virtual int getSortPixelY() const + virtual int getSortPixelY() const A_WARN_UNUSED { return static_cast<int>(mPos.y) - mYDiff; } /** * Returns the x coordinate in tiles of the actor. */ - virtual int getTileX() const; + virtual int getTileX() const A_WARN_UNUSED; /** * Returns the y coordinate in tiles of the actor. */ - virtual int getTileY() const; + virtual int getTileY() const A_WARN_UNUSED; /** * Returns the number of Image layers used to draw the actor. */ - virtual int getNumberOfLayers() const + virtual int getNumberOfLayers() const A_WARN_UNUSED { return 0; } /** * Returns the current alpha value used to draw the actor. */ - virtual float getAlpha() const = 0; + virtual float getAlpha() const A_WARN_UNUSED = 0; /** * Sets the alpha value used to draw the actor. @@ -124,7 +126,7 @@ public: virtual void setMap(Map *const map); - const Map* getMap() const + const Map* getMap() const A_WARN_UNUSED { return mMap; } protected: diff --git a/src/actorsprite.h b/src/actorsprite.h index f7792ead0..8521a9c92 100644 --- a/src/actorsprite.h +++ b/src/actorsprite.h @@ -33,6 +33,8 @@ #include <set> #include <list> +#include "localconsts.h" + class SimpleAnimation; class StatusEffect; class ActorSpriteListener; @@ -72,7 +74,7 @@ public: ~ActorSprite(); - int getId() const + int getId() const A_WARN_UNUSED { return mId; } void setId(const int id) @@ -81,7 +83,7 @@ public: /** * Returns the type of the ActorSprite. */ - virtual Type getType() const + virtual Type getType() const A_WARN_UNUSED { return UNKNOWN; } virtual bool draw(Graphics *graphics, @@ -99,7 +101,7 @@ public: /** * Gets the way the object blocks pathfinding for other objects */ - virtual Map::BlockType getBlockType() const + virtual Map::BlockType getBlockType() const A_WARN_UNUSED { return Map::BLOCKTYPE_NONE; } /** @@ -110,13 +112,13 @@ public: /** * Returns the required size of a target cursor for this being. */ - virtual TargetCursorSize getTargetCursorSize() const + virtual TargetCursorSize getTargetCursorSize() const A_WARN_UNUSED { return TC_MEDIUM; } - virtual int getTargetOffsetX() const + virtual int getTargetOffsetX() const A_WARN_UNUSED { return 0; } - virtual int getTargetOffsetY() const + virtual int getTargetOffsetY() const A_WARN_UNUSED { return 0; } /** @@ -163,13 +165,13 @@ public: virtual void setAlpha(const float alpha) override { CompoundSprite::setAlpha(alpha); } - virtual float getAlpha() const override + virtual float getAlpha() const override A_WARN_UNUSED { return CompoundSprite::getAlpha(); } - virtual int getWidth() const override + virtual int getWidth() const override A_WARN_UNUSED { return CompoundSprite::getWidth(); } - virtual int getHeight() const override + virtual int getHeight() const override A_WARN_UNUSED { return CompoundSprite::getHeight(); } static void load(); diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h index bd5662c3c..4153b2714 100644 --- a/src/actorspritemanager.h +++ b/src/actorspritemanager.h @@ -26,6 +26,8 @@ #include "being.h" #include "flooritem.h" +#include "localconsts.h" + class LocalPlayer; class Map; @@ -56,7 +58,7 @@ class ActorSpriteManager final: public ConfigListener * Create a Being and add it to the list of ActorSprites. */ Being *createBeing(const int id, const ActorSprite::Type type, - const uint16_t subtype); + const uint16_t subtype) A_WARN_UNUSED; /** * Create a FloorItem and add it to the list of ActorSprites. @@ -79,19 +81,20 @@ class ActorSpriteManager final: public ConfigListener /** * Returns a specific Being, by id; */ - Being *findBeing(const int id) const; + Being *findBeing(const int id) const A_WARN_UNUSED; /** * Returns a being at specific coordinates. */ Being *findBeing(const int x, const int y, const ActorSprite::Type - type = ActorSprite::UNKNOWN) const; + type = ActorSprite::UNKNOWN) const A_WARN_UNUSED; /** * Returns a being at the specific pixel. */ Being *findBeingByPixel(const int x, const int y, - const bool allPlayers = false) const; + const bool allPlayers = false) + const A_WARN_UNUSED; /** * Returns a beings at the specific pixel. @@ -103,17 +106,17 @@ class ActorSpriteManager final: public ConfigListener /** * Returns a portal at the specific tile. */ - Being *findPortalByTile(const int x, const int y) const; + Being *findPortalByTile(const int x, const int y) const A_WARN_UNUSED; /** * Returns a specific FloorItem, by id. */ - FloorItem *findItem(const int id) const; + FloorItem *findItem(const int id) const A_WARN_UNUSED; /** * Returns a FloorItem at specific coordinates. */ - FloorItem *findItem(const int x, const int y) const; + FloorItem *findItem(const int x, const int y) const A_WARN_UNUSED; /** * Returns a being nearest to specific coordinates. @@ -129,7 +132,7 @@ class ActorSpriteManager final: public ConfigListener const ActorSprite::Type type = Being::UNKNOWN, const Being *const - excluded = nullptr) const; + excluded = nullptr) const A_WARN_UNUSED; /** * Returns a being nearest to another being. @@ -143,21 +146,21 @@ class ActorSpriteManager final: public ConfigListener const int maxTileDist, const ActorSprite::Type type = Being::UNKNOWN - ) const; + ) const A_WARN_UNUSED; /** * Finds a being by name and (optionally) by type. */ Being *findBeingByName(const std::string &name, const ActorSprite::Type - type = Being::UNKNOWN) const; + type = Being::UNKNOWN) const A_WARN_UNUSED; /** * Finds a nearest being by name and (optionally) by type. */ Being *findNearestByName(const std::string &name, const Being::Type &type = Being::UNKNOWN - ) const; + ) const A_WARN_UNUSED; /** * Heal all players in distance. @@ -185,7 +188,8 @@ class ActorSpriteManager final: public ConfigListener * * \param actor the ActorSprite to search for */ - bool hasActorSprite(const ActorSprite *const actor) const; + bool hasActorSprite(const ActorSprite *const actor) + const A_WARN_UNUSED; /** * Performs ActorSprite logic and deletes ActorSprite scheduled to be @@ -253,22 +257,22 @@ class ActorSpriteManager final: public ConfigListener void setAttackMobs(std::list<std::string> mobs) { mAttackMobs = mobs; } - int getPriorityAttackMobsSize() const + int getPriorityAttackMobsSize() const A_WARN_UNUSED { return static_cast<int>(mPriorityAttackMobs.size()); } - int getAttackMobsSize() const + int getAttackMobsSize() const A_WARN_UNUSED { return static_cast<int>(mAttackMobs.size()); } - int getPickupItemsSize() const + int getPickupItemsSize() const A_WARN_UNUSED { return static_cast<int>(mPickupItems.size()); } #define defList(list1, mob) \ - bool isIn##list1##List(const std::string &name) const\ + bool isIn##list1##List(const std::string &name) const A_WARN_UNUSED\ { return m##list1##mob##Set.find(name) != m##list1##mob##Set.end(); }\ void rebuild##list1##mob();\ - std::set<std::string> get##list1##mob##Set() const\ + std::set<std::string> get##list1##mob##Set() const A_WARN_UNUSED\ { return m##list1##mob##Set; }\ - std::list<std::string> get##list1##mob() const\ + std::list<std::string> get##list1##mob() const A_WARN_UNUSED\ { return m##list1##mob; } defList(Attack, Mobs) @@ -277,36 +281,37 @@ class ActorSpriteManager final: public ConfigListener defList(Pickup, Items) defList(IgnorePickup, Items) - std::map<std::string, int> getAttackMobsMap() const + std::map<std::string, int> getAttackMobsMap() const A_WARN_UNUSED { return mAttackMobsMap; } - std::map<std::string, int> getPriorityAttackMobsMap() const + std::map<std::string, int> getPriorityAttackMobsMap() + const A_WARN_UNUSED { return mPriorityAttackMobsMap; } - int getAttackMobIndex(std::string name); + int getAttackMobIndex(std::string name) A_WARN_UNUSED; - int getPriorityAttackMobIndex(std::string name); + int getPriorityAttackMobIndex(std::string name) A_WARN_UNUSED; - int getPickupItemIndex(std::string name); + int getPickupItemIndex(std::string name) A_WARN_UNUSED; int getIndexByName(std::string name, std::map<std::string, - int> &map) const; + int> &map) const A_WARN_UNUSED; - bool checkForPickup(const FloorItem *const item) const; + bool checkForPickup(const FloorItem *const item) const A_WARN_UNUSED; protected: bool validateBeing(const Being *const aroundBeing, Being *const being, const Being::Type type, const Being *const excluded = nullptr, - const int maxCost = 20) const; + const int maxCost = 20) const A_WARN_UNUSED; Being *findNearestLivingBeing(const Being *const aroundBeing, const int maxdist, const Being::Type type, const int x, const int y, const Being *const - excluded = nullptr) const; + excluded = nullptr) const A_WARN_UNUSED; void loadAttackList(); void storeAttackList(); diff --git a/src/animatedsprite.h b/src/animatedsprite.h index 7d3fefefb..d96555ff4 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -54,10 +54,11 @@ class AnimatedSprite final : public Sprite * @param variant the sprite variant */ static AnimatedSprite *load(const std::string &filename, - int variant = 0); + int variant = 0) A_WARN_UNUSED; static AnimatedSprite *delayedLoad(const std::string &filename, - const int variant = 0); + const int variant = 0) + A_WARN_UNUSED; virtual ~AnimatedSprite(); @@ -69,26 +70,26 @@ class AnimatedSprite final : public Sprite bool draw(Graphics* graphics, int posX, int posY) const; - int getWidth() const; + int getWidth() const A_WARN_UNUSED; - int getHeight() const; + int getHeight() const A_WARN_UNUSED; - const Image* getImage() const; + const Image* getImage() const A_WARN_UNUSED; bool setSpriteDirection(const SpriteDirection direction); - int getNumberOfLayers() const + int getNumberOfLayers() const A_WARN_UNUSED { return 1; } - std::string getIdPath() const; + std::string getIdPath() const A_WARN_UNUSED; - unsigned int getCurrentFrame() const; + unsigned int getCurrentFrame() const A_WARN_UNUSED; - unsigned int getFrameCount() const; + unsigned int getFrameCount() const A_WARN_UNUSED; virtual void setAlpha(float alpha) override; - virtual void *getHash() override; + virtual void *getHash() override A_WARN_UNUSED; bool updateNumber(const unsigned num); diff --git a/src/auctionmanager.h b/src/auctionmanager.h index b61858efa..1d716f9c4 100644 --- a/src/auctionmanager.h +++ b/src/auctionmanager.h @@ -42,9 +42,7 @@ class AuctionManager final static void send(const std::string &msg); -// static bool processAuctionMessage(const std::string &msg); - - static bool getEnableAuctionBot() + static bool getEnableAuctionBot() A_WARN_UNUSED { return mEnableAuctionBot; } void clear(); diff --git a/src/avatar.h b/src/avatar.h index b4c7d271a..e28a901fb 100644 --- a/src/avatar.h +++ b/src/avatar.h @@ -45,7 +45,7 @@ public: /** * Returns the avatar's name. */ - std::string getName() const + std::string getName() const A_WARN_UNUSED { return mName; } /** @@ -57,12 +57,12 @@ public: /** * Returns the avatar's original name. */ - std::string getOriginalName() const + std::string getOriginalName() const A_WARN_UNUSED { return mOriginalName; } - std::string getComplexName() const; + std::string getComplexName() const A_WARN_UNUSED; - virtual std::string getAdditionString() const; + virtual std::string getAdditionString() const A_WARN_UNUSED; /** * Set the avatar's original name. @@ -73,7 +73,7 @@ public: /** * Returns the avatar's online status. */ - bool getOnline() const + bool getOnline() const A_WARN_UNUSED { return mOnline; } /** @@ -82,91 +82,91 @@ public: void setOnline(const bool online) { mOnline = online; } - int getHp() const + int getHp() const A_WARN_UNUSED { return mHp; } void setHp(const int hp) { mHp = hp; } - int getMaxHp() const + int getMaxHp() const A_WARN_UNUSED { return mMaxHp; } void setMaxHp(const int maxHp) { mMaxHp = maxHp; } - int getDamageHp() const + int getDamageHp() const A_WARN_UNUSED { return mDamageHp; } void setDamageHp(const int damageHp) { mDamageHp = damageHp; } - bool getDisplayBold() const + bool getDisplayBold() const A_WARN_UNUSED { return mDisplayBold; } void setDisplayBold(const bool displayBold) { mDisplayBold = displayBold; } - int getLevel() const + int getLevel() const A_WARN_UNUSED { return mLevel; } void setLevel(const int level) { mLevel = level; } - std::string getMap() const + std::string getMap() const A_WARN_UNUSED { return mMap; } void setMap(std::string map) { mMap = map; } - int getX() const + int getX() const A_WARN_UNUSED { return mX; } void setX(const int x) { mX = x; } - int getY() const + int getY() const A_WARN_UNUSED { return mY; } void setY(const int y) { mY = y; } - int getType() const + int getType() const A_WARN_UNUSED { return mType; } void setType(const int n) { mType = n; } - int getExp() const + int getExp() const A_WARN_UNUSED { return mExp; } void setExp(const int n) { mExp = n; } - int getID() const + int getID() const A_WARN_UNUSED { return mId; } void setID(const int id) { mId = id; } - int getCharId() const + int getCharId() const A_WARN_UNUSED { return mCharId; } void setCharId(const int id) { mCharId = id; } - int getGender() const + int getGender() const A_WARN_UNUSED { return mGender; } void setGender(const int g) { mGender = g; } - int getRace() const + int getRace() const A_WARN_UNUSED { return mRace; } void setRace(const int r) { mRace = r; } - const std::string &getIp() const + const std::string &getIp() const A_WARN_UNUSED { return mIp; } void setIp(std::string ip) diff --git a/src/being.h b/src/being.h index c7d8c3609..6413a1059 100644 --- a/src/being.h +++ b/src/being.h @@ -34,6 +34,8 @@ #include <map> #include <set> +#include "localconsts.h" + static const unsigned int FIRST_IGNORE_EMOTE = 14; static const unsigned int STATUS_EFFECTS = 32; @@ -47,7 +49,6 @@ static const int DEFAULT_BEING_HEIGHT = 32; class AnimatedSprite; class BeingCacheEntry; class Being; -//class BeingInfo; class FlashText; class Guild; class Inventory; @@ -80,7 +81,7 @@ class BeingEquipBackend final : public Equipment::Backend virtual ~BeingEquipBackend(); - Item *getEquipment(const int index) const; + Item *getEquipment(const int index) const A_WARN_UNUSED; void clear(); @@ -175,7 +176,7 @@ class Being : public ActorSprite, public ConfigListener virtual ~Being(); - Type getType() const + Type getType() const A_WARN_UNUSED { return mType; } /** @@ -186,7 +187,7 @@ class Being : public ActorSprite, public ConfigListener /** * Returns the time spent in the current action. */ - int getActionTime() const + int getActionTime() const A_WARN_UNUSED { return mActionTime; } /** @@ -206,14 +207,14 @@ class Being : public ActorSprite, public ConfigListener * Get the current X pixel offset. * TODO: Used by eAthena only? */ - int getXOffset() const + int getXOffset() const A_WARN_UNUSED { return getOffset(LEFT, RIGHT); } /** * Get the current Y pixel offset. * TODO: Used by eAthena only? */ - int getYOffset() const + int getYOffset() const A_WARN_UNUSED { return getOffset(UP, DOWN); } /** @@ -224,19 +225,19 @@ class Being : public ActorSprite, public ConfigListener /** * Returns the destination for this being. */ - const Vector &getDestination() const + const Vector &getDestination() const A_WARN_UNUSED { return mDest; } /** * Returns the tile x coord */ - int getTileX() const + int getTileX() const A_WARN_UNUSED { return mX; } /** * Returns the tile y coord */ - int getTileY() const + int getTileY() const A_WARN_UNUSED { return mY; } /** @@ -278,13 +279,13 @@ class Being : public ActorSprite, public ConfigListener virtual void handleSkill(Being *const victim, const int damage, const int skillId); - const ItemInfo *getEquippedWeapon() const + const ItemInfo *getEquippedWeapon() const A_WARN_UNUSED { return mEquippedWeapon; } /** * Returns the name of the being. */ - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } /** @@ -294,7 +295,7 @@ class Being : public ActorSprite, public ConfigListener */ void setName(const std::string &name); - bool getShowName() const + bool getShowName() const A_WARN_UNUSED { return mShowName; } void setShowName(const bool doShowName); @@ -305,10 +306,10 @@ class Being : public ActorSprite, public ConfigListener void setPartyName(const std::string &name) { mPartyName = name; } - const std::string &getPartyName() const + const std::string &getPartyName() const A_WARN_UNUSED { return mPartyName; } - const std::string &getGuildName() const + const std::string &getGuildName() const A_WARN_UNUSED { return mGuildName; } /** @@ -332,22 +333,22 @@ class Being : public ActorSprite, public ConfigListener /** * Returns a pointer to the specified guild that the being is in. */ - Guild *getGuild(const std::string &guildName) const; + Guild *getGuild(const std::string &guildName) const A_WARN_UNUSED; /** * Returns a pointer to the specified guild that the being is in. */ - Guild *getGuild(const int id) const; + Guild *getGuild(const int id) const A_WARN_UNUSED; /** * Returns a pointer to the specified guild that the being is in. */ - Guild *getGuild() const; + Guild *getGuild() const A_WARN_UNUSED; /** * Returns all guilds the being is in. */ - const std::map<int, Guild*> &getGuilds() const + const std::map<int, Guild*> &getGuilds() const A_WARN_UNUSED { return mGuilds; } /** @@ -358,10 +359,10 @@ class Being : public ActorSprite, public ConfigListener /** * Get number of guilds the being belongs to. */ - short getNumberOfGuilds() const + short getNumberOfGuilds() const A_WARN_UNUSED { return static_cast<short>(mGuilds.size()); } - bool isInParty() const + bool isInParty() const A_WARN_UNUSED { return mParty; } void setParty(Party *const party); @@ -373,7 +374,7 @@ class Being : public ActorSprite, public ConfigListener Party *getParty() const { return mParty; } - int getSpritesCount() const + int getSpritesCount() const A_WARN_UNUSED { return static_cast<int>(size()); } /** @@ -393,13 +394,13 @@ class Being : public ActorSprite, public ConfigListener /** * Get the number of hairstyles implemented */ - static int getNumOfHairstyles() + static int getNumOfHairstyles() A_WARN_UNUSED { return mNumberOfHairstyles; } /** * Get the number of layers used to draw the being */ - int getNumberOfLayers() const + int getNumberOfLayers() const A_WARN_UNUSED { return CompoundSprite::getNumberOfLayers(); } /** @@ -426,19 +427,19 @@ class Being : public ActorSprite, public ConfigListener */ void setSubtype(const uint16_t subtype); - const BeingInfo *getInfo() const + const BeingInfo *getInfo() const A_WARN_UNUSED { return mInfo; } - TargetCursorSize getTargetCursorSize() const; + TargetCursorSize getTargetCursorSize() const A_WARN_UNUSED; - int getTargetOffsetX() const + int getTargetOffsetX() const A_WARN_UNUSED { if (!mInfo) return 0; return mInfo->getTargetOffsetX(); } - int getTargetOffsetY() const + int getTargetOffsetY() const A_WARN_UNUSED { if (!mInfo) return 0; @@ -448,7 +449,7 @@ class Being : public ActorSprite, public ConfigListener /** * Gets the way the object is blocked by other objects. */ - virtual unsigned char getWalkMask() const + virtual unsigned char getWalkMask() const A_WARN_UNUSED { if (!mInfo) return 0; @@ -458,7 +459,7 @@ class Being : public ActorSprite, public ConfigListener /** * Gets the way the monster blocks pathfinding for other objects */ - Map::BlockType getBlockType() const + Map::BlockType getBlockType() const A_WARN_UNUSED { if (!mInfo) return Map::BLOCKTYPE_NONE; @@ -478,7 +479,7 @@ class Being : public ActorSprite, public ConfigListener * in pixels per second for eAthena, * in tiles per second for Manaserv (0.1 precision). */ - Vector getWalkSpeed() const + Vector getWalkSpeed() const A_WARN_UNUSED { return mWalkSpeed; } /** @@ -492,7 +493,7 @@ class Being : public ActorSprite, public ConfigListener * Gets the attack speed. * @todo In what unit? */ - int getAttackSpeed() const + int getAttackSpeed() const A_WARN_UNUSED { return mAttackSpeed; } /** @@ -503,19 +504,19 @@ class Being : public ActorSprite, public ConfigListener /** * Get the being's action currently performed. */ - Action getCurrentAction() const + Action getCurrentAction() const A_WARN_UNUSED { return mAction; } /** * Returns whether this being is still alive. */ - bool isAlive() const + bool isAlive() const A_WARN_UNUSED { return mAction != DEAD; } /** * Returns the current direction. */ - uint8_t getDirection() const + uint8_t getDirection() const A_WARN_UNUSED { return mDirection; } /** @@ -526,13 +527,13 @@ class Being : public ActorSprite, public ConfigListener virtual void setDirectionDelayed(const uint8_t direction) { mDirectionDelayed = direction; } - uint8_t getDirectionDelayed() const + uint8_t getDirectionDelayed() const A_WARN_UNUSED { return mDirectionDelayed; } /** * Returns the direction the being is facing. */ - SpriteDirection getSpriteDirection() const + SpriteDirection getSpriteDirection() const A_WARN_UNUSED { return static_cast<SpriteDirection>(mSpriteDirection); } void setPosition(const Vector &pos); @@ -549,19 +550,19 @@ class Being : public ActorSprite, public ConfigListener /** * Returns the horizontal size of the current base sprite of the being. */ - virtual int getWidth() const override + virtual int getWidth() const override A_WARN_UNUSED { return std::max(CompoundSprite::getWidth(), DEFAULT_BEING_WIDTH); } /** * Returns the vertical size of the current base sprite of the being. */ - virtual int getHeight() const override + virtual int getHeight() const override A_WARN_UNUSED { return std::max(CompoundSprite::getHeight(), DEFAULT_BEING_HEIGHT); } /** * Returns the being's pixel radius used to detect collisions. */ - virtual int getCollisionRadius() const + virtual int getCollisionRadius() const A_WARN_UNUSED { return 16; } /** @@ -574,10 +575,10 @@ class Being : public ActorSprite, public ConfigListener * 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 + const Path &getPath() const A_WARN_UNUSED { return mPath; } - int getDistance() const + int getDistance() const A_WARN_UNUSED { return mDistance; } void setDistance(const int n) @@ -595,7 +596,7 @@ class Being : public ActorSprite, public ConfigListener * Get the current Emoticon type displayed above * the being. */ - int getEmotion() const + int getEmotion() const A_WARN_UNUSED { return mEmotion; } virtual void drawSprites(Graphics* graphics, @@ -615,7 +616,7 @@ class Being : public ActorSprite, public ConfigListener void flashName(const int time); - int getDamageTaken() const + int getDamageTaken() const A_WARN_UNUSED { return mDamageTaken; } void setDamageTaken(const int damage) @@ -626,18 +627,18 @@ class Being : public ActorSprite, public ConfigListener void setLevel(const int n) { mLevel = n; } - virtual int getLevel() const + virtual int getLevel() const A_WARN_UNUSED { return mLevel; } void setIsReachable(const int n) { mIsReachable = n; } - int isReachable() const + int isReachable() const A_WARN_UNUSED { return mIsReachable; } static void reReadConfig(); - static BeingCacheEntry* getCacheEntry(const int id); + static BeingCacheEntry* getCacheEntry(const int id) A_WARN_UNUSED; void addToCache() const; @@ -648,18 +649,18 @@ class Being : public ActorSprite, public ConfigListener */ virtual void setGender(const Gender gender); - Gender getGender() const + Gender getGender() const A_WARN_UNUSED { return mGender; } /** * Return sprite sit action for current environment. */ - std::string getSitAction() const; + std::string getSitAction() const A_WARN_UNUSED; /** * Whether or not this player is a GM. */ - bool isGM() const + bool isGM() const A_WARN_UNUSED { return mIsGM; } /** @@ -667,7 +668,7 @@ class Being : public ActorSprite, public ConfigListener */ void setGM(const bool gm); - bool canTalk() const + bool canTalk() const A_WARN_UNUSED { return mType == NPC; } void talkTo(); @@ -714,13 +715,13 @@ class Being : public ActorSprite, public ConfigListener void setEnemy(const bool n) { mEnemy = n; } - const std::string &getIp() const + const std::string &getIp() const A_WARN_UNUSED { return mIp; } void setIp(std::string ip) { mIp = ip; } - unsigned int getPvpRank() const + unsigned int getPvpRank() const A_WARN_UNUSED { return mPvpRank; } void setPvpRank(const unsigned int rank) @@ -730,32 +731,33 @@ class Being : public ActorSprite, public ConfigListener void setMaxHP(const int hp); - int getHP() const + int getHP() const A_WARN_UNUSED { return mHP; } - uint8_t calcDirection(const int dstX, const int dstY) const; + uint8_t calcDirection(const int dstX, + const int dstY) const A_WARN_UNUSED; - uint8_t calcDirection() const; + uint8_t calcDirection() const A_WARN_UNUSED; void setAttackDelay(const int n) { mAttackDelay = n; } - int getAttackDelay() const + int getAttackDelay() const A_WARN_UNUSED { return mAttackDelay; } - int getMinHit() const + int getMinHit() const A_WARN_UNUSED { return mMinHit; } void setMinHit(const int n) { mMinHit = n; } - int getMaxHit() const + int getMaxHit() const A_WARN_UNUSED { return mMaxHit; } void setMaxHit(const int n) { mMaxHit = n; } - int getCriticalHit() const + int getCriticalHit() const A_WARN_UNUSED { return mCriticalHit; } void setCriticalHit(const int n) @@ -763,23 +765,23 @@ class Being : public ActorSprite, public ConfigListener void updateHit(const int amount); - Equipment *getEquipment(); + Equipment *getEquipment() A_WARN_UNUSED; void undressItemById(const int id); - int getGoodStatus() const + int getGoodStatus() const A_WARN_UNUSED { return mGoodStatus; } void setGoodStatus(const int n) { mGoodStatus = n; } - std::string getGenderSign() const; + std::string getGenderSign() const A_WARN_UNUSED; - std::string getGenderSignWithSpace() const; + std::string getGenderSignWithSpace() const A_WARN_UNUSED; void updateComment(); - const std::string getComment() const + const std::string getComment() const A_WARN_UNUSED { return mComment; } void setComment(std::string n) @@ -788,18 +790,18 @@ class Being : public ActorSprite, public ConfigListener static void clearCache(); static std::string loadComment(const std::string &name, - const int type); + const int type) A_WARN_UNUSED; static void saveComment(const std::string &name, const std::string &comment, const int type); - bool isAdvanced() const + bool isAdvanced() const A_WARN_UNUSED { return mAdvanced; } void setAdvanced(const bool n) { mAdvanced = n; addToCache(); } - bool isShopEnabled() const + bool isShopEnabled() const A_WARN_UNUSED { return mShop; } void enableShop(const bool b) @@ -822,10 +824,10 @@ class Being : public ActorSprite, public ConfigListener void setRaceName(std::string name) { mRaceName = name; } - std::string getRaceName() const + std::string getRaceName() const A_WARN_UNUSED { return mRaceName; } - int getSpriteID(const int slot) const; + int getSpriteID(const int slot) const A_WARN_UNUSED; void setHairStyle(const unsigned int slot, const int id); @@ -835,20 +837,21 @@ class Being : public ActorSprite, public ConfigListener void setHairColor(const unsigned char color) { mHairColor = color; } - unsigned char getHairColor() const + unsigned char getHairColor() const A_WARN_UNUSED { return mHairColor; } void recalcSpritesOrder(); int getHitEffect(const Being *const attacker, - const AttackType type, const int attackId) const; + const AttackType type, + const int attackId) const A_WARN_UNUSED; - Cursor::Cursor getHoverCursor() + Cursor::Cursor getHoverCursor() A_WARN_UNUSED { return mInfo ? mInfo->getHoverCursor() : Cursor::CURSOR_POINTER; } - static uint8_t genderToInt(const Gender sex); + static uint8_t genderToInt(const Gender sex) A_WARN_UNUSED; - static Gender intToGender(uint8_t sex); + static Gender intToGender(uint8_t sex) A_WARN_UNUSED; protected: /** @@ -925,9 +928,11 @@ class Being : public ActorSprite, public ConfigListener * If walking in direction 'neg' the value is negated. * TODO: Used by eAthena only? */ - int getOffset(const signed char pos, const signed char neg) const; + int getOffset(const signed char pos, + const signed char neg) const A_WARN_UNUSED; - int searchSlotValue(std::vector<int> &slotRemap, const int val) const; + int searchSlotValue(std::vector<int> &slotRemap, + const int val) const A_WARN_UNUSED; void searchSlotValueItr(std::vector<int>::iterator &it, int &idx, std::vector<int> &slotRemap, diff --git a/src/channel.h b/src/channel.h index 7dae64722..97011f154 100644 --- a/src/channel.h +++ b/src/channel.h @@ -53,19 +53,19 @@ class Channel final /** * Get the id associated witht his channel. */ - int getId() const + int getId() const A_WARN_UNUSED { return mId; } /** * Get this channel's name. */ - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } /** * Get the announcement message for this channel. */ - const std::string &getAnnouncement() const + const std::string &getAnnouncement() const A_WARN_UNUSED { return mAnnouncement; } /** @@ -80,7 +80,7 @@ class Channel final void setAnnouncement(const std::string &channelAnnouncement) { mAnnouncement = channelAnnouncement; } - const ChannelTab *getTab() const + const ChannelTab *getTab() const A_WARN_UNUSED { return mTab; } protected: diff --git a/src/channelmanager.h b/src/channelmanager.h index 3ec58df77..1666834fd 100644 --- a/src/channelmanager.h +++ b/src/channelmanager.h @@ -37,8 +37,8 @@ public: A_DELETE_COPY(ChannelManager) ~ChannelManager(); - Channel *findById(const int id) const; - Channel *findByName(const std::string &name) const; + Channel *findById(const int id) const A_WARN_UNUSED; + Channel *findByName(const std::string &name) const A_WARN_UNUSED; void addChannel(Channel *const channel); void removeChannel(Channel *const channel); diff --git a/src/chatlogger.h b/src/chatlogger.h index 57e5b7359..15db2a87f 100644 --- a/src/chatlogger.h +++ b/src/chatlogger.h @@ -53,7 +53,7 @@ class ChatLogger final void loadLast(std::string name, std::list<std::string> &list, const unsigned n) const; - std::string getDir() const; + std::string getDir() const A_WARN_UNUSED; std::string secureName(std::string &str) const; diff --git a/src/client.h b/src/client.h index 78e8eaf58..add0ac958 100644 --- a/src/client.h +++ b/src/client.h @@ -36,6 +36,8 @@ #include <sys/time.h> +#include "localconsts.h" + class Button; class Desktop; class Game; @@ -74,9 +76,9 @@ extern LoginData loginData; /** * Returns elapsed time. (Warning: supposes the delay is always < 100 seconds) */ -int get_elapsed_time(const int startTime); +int get_elapsed_time(const int startTime) A_WARN_UNUSED; -int get_elapsed_time1(const int startTime); +int get_elapsed_time1(const int startTime) A_WARN_UNUSED; /** * All client states. @@ -207,7 +209,7 @@ public: /** * Provides access to the client instance. */ - static Client *instance() + static Client *instance() A_WARN_UNUSED { return mInstance; } void gameInit(); @@ -221,53 +223,53 @@ public: static void setState(const State state) { instance()->mState = state; } - static State getState() + static State getState() A_WARN_UNUSED { return instance()->mState; } - static const std::string &getPackageDirectory() + static const std::string &getPackageDirectory() A_WARN_UNUSED { return instance()->mPackageDir; } - static const std::string &getConfigDirectory() + static const std::string &getConfigDirectory() A_WARN_UNUSED { return instance()->mConfigDir; } - static const std::string &getLocalDataDirectory() + static const std::string &getLocalDataDirectory() A_WARN_UNUSED { return instance()->mLocalDataDir; } - static const std::string &getTempDirectory() + static const std::string &getTempDirectory() A_WARN_UNUSED { return instance()->mTempDir; } - static const std::string &getScreenshotDirectory() + static const std::string &getScreenshotDirectory() A_WARN_UNUSED { return instance()->mScreenshotDir; } - static const std::string getServerConfigDirectory(); + static const std::string getServerConfigDirectory() A_WARN_UNUSED; - static const std::string getUsersDirectory(); + static const std::string getUsersDirectory() A_WARN_UNUSED; - static const std::string getNpcsDirectory(); + static const std::string getNpcsDirectory() A_WARN_UNUSED; - static bool getIsMinimized() + static bool getIsMinimized() A_WARN_UNUSED { return instance()->mIsMinimized; } static void setIsMinimized(const bool n); static void newChatMessage(); - static bool getInputFocused() + static bool getInputFocused() A_WARN_UNUSED { return instance()->mInputFocused; } static void setInputFocused(const bool n) { instance()->mInputFocused = n; } - static bool getMouseFocused() + static bool getMouseFocused() A_WARN_UNUSED { return instance()->mMouseFocused; } static void setMouseFocused(const bool n) { instance()->mMouseFocused = n; } - static std::string getUpdatesDir() + static std::string getUpdatesDir() A_WARN_UNUSED { return instance()->mUpdatesDir; } - static std::string getServerName() + static std::string getServerName() A_WARN_UNUSED { return instance()->mServerName; } static void resize(const int width, const int height, @@ -276,15 +278,15 @@ public: static void setGuiAlpha(const float n); - static float getGuiAlpha(); + static float getGuiAlpha() A_WARN_UNUSED; static void closeDialogs(); static void setFramerate(const int fpsLimit); - static int getFramerate(); + static int getFramerate() A_WARN_UNUSED; - static bool isTmw(); + static bool isTmw() A_WARN_UNUSED; static void applyGrabMode(); @@ -308,9 +310,9 @@ public: void resizeVideo(int width, int height, const bool always); - static bool limitPackets(const int type); + static bool limitPackets(const int type) A_WARN_UNUSED; - static bool checkPackets(const int type); + static bool checkPackets(const int type) A_WARN_UNUSED; PacketLimit mPacketLimits[PACKET_SIZE + 1]; diff --git a/src/compoundsprite.h b/src/compoundsprite.h index 5781bf171..0676ad479 100644 --- a/src/compoundsprite.h +++ b/src/compoundsprite.h @@ -27,6 +27,8 @@ #include <list> #include <vector> +#include "localconsts.h" + class Image; typedef std::list <void*> VectorPointers; @@ -40,7 +42,6 @@ class CompoundItem final ~CompoundItem(); -// float alpha; VectorPointers data; Image *image; Image *alphaImage; @@ -69,34 +70,34 @@ public: /** * Gets the width in pixels of the first sprite in the list. */ - virtual int getWidth() const override; + virtual int getWidth() const override A_WARN_UNUSED; /** * Gets the height in pixels of the first sprite in the list. */ - virtual int getHeight() const override; + virtual int getHeight() const override A_WARN_UNUSED; - virtual const Image *getImage() const override; + virtual const Image *getImage() const override A_WARN_UNUSED; virtual bool setSpriteDirection(const SpriteDirection direction) override; - int getNumberOfLayers() const; + int getNumberOfLayers() const A_WARN_UNUSED; - unsigned int getCurrentFrame() const override; + unsigned int getCurrentFrame() const override A_WARN_UNUSED; - unsigned int getFrameCount() const override; + unsigned int getFrameCount() const override A_WARN_UNUSED; - size_t size() const + size_t size() const A_WARN_UNUSED { return mSprites.size(); } - bool empty() const + bool empty() const A_WARN_UNUSED { return mSprites.empty(); } void addSprite(Sprite *const sprite); void setSprite(const int layer, Sprite *const sprite); - Sprite *getSprite(int layer) const + Sprite *getSprite(int layer) const A_WARN_UNUSED { return mSprites.at(layer); } void removeSprite(const int layer); @@ -114,12 +115,12 @@ public: /** * Returns the curent frame in the current animation of the given layer. */ - virtual unsigned int getCurrentFrame(unsigned int layer); + virtual unsigned int getCurrentFrame(unsigned int layer) A_WARN_UNUSED; /** * Returns the frame count in the current animation of the given layer. */ - virtual unsigned int getFrameCount(unsigned int layer); + virtual unsigned int getFrameCount(unsigned int layer) A_WARN_UNUSED; virtual void setAlpha(float alpha) override; diff --git a/src/configuration.h b/src/configuration.h index e351c05bf..8f16c23c0 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -66,7 +66,7 @@ class ConfigurationListManager * \param container The container to insert the object to */ virtual CONT readConfigItem(ConfigurationObject *const obj, - CONT container) = 0; + CONT container) A_WARN_UNUSED = 0; virtual ~ConfigurationListManager() {} }; @@ -102,17 +102,22 @@ class ConfigurationObject * \param deflt Default option if not there or error. */ std::string getValue(const std::string &key, - const std::string &deflt) const; + const std::string &deflt) const A_WARN_UNUSED; - int getValue(const std::string &key, const int deflt) const; + int getValue(const std::string &key, + const int deflt) const A_WARN_UNUSED; - int getValueInt(const std::string &key, const int deflt) const; + int getValueInt(const std::string &key, + const int deflt) const A_WARN_UNUSED; - bool getValueBool(const std::string &key, const bool deflt) const; + bool getValueBool(const std::string &key, + const bool deflt) const A_WARN_UNUSED; - unsigned getValue(const std::string &key, const unsigned deflt) const; + unsigned getValue(const std::string &key, + const unsigned deflt) const A_WARN_UNUSED; - double getValue(const std::string &key, const double deflt) const; + double getValue(const std::string &key, + const double deflt) const A_WARN_UNUSED; /** * Re-sets all data in the configuration @@ -304,7 +309,7 @@ class Configuration final : public ConfigurationObject bool resetBoolValue(const std::string &key); - const std::string getConfigPath() const + const std::string getConfigPath() const A_WARN_UNUSED { return mConfigPath; } /** @@ -312,12 +317,12 @@ class Configuration final : public ConfigurationObject * The default value returned in based on fallbacks registry. * @see defaults.h */ - int getIntValue(const std::string &key) const; - float getFloatValue(const std::string &key) const; - std::string getStringValue(const std::string &key) const; - bool getBoolValue(const std::string &key) const; + int getIntValue(const std::string &key) const A_WARN_UNUSED; + float getFloatValue(const std::string &key) const A_WARN_UNUSED; + std::string getStringValue(const std::string &key) const A_WARN_UNUSED; + bool getBoolValue(const std::string &key) const A_WARN_UNUSED; - std::string getDirectory() const + std::string getDirectory() const A_WARN_UNUSED { return mDirectory; } void removeOldKeys(); diff --git a/src/defaults.h b/src/defaults.h index 45a050eb7..6edf3a404 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -22,20 +22,23 @@ #ifndef DEFAULTS_H #define DEFAULTS_H +#include "variabledata.h" + #include <map> #include <string> -#include "variabledata.h" + +#include "localconsts.h" typedef std::map<std::string, VariableData*> DefaultsData; -VariableData* createData(const int defData); -VariableData* createData(const double defData); -VariableData* createData(const float defData); -VariableData* createData(const std::string &defData); -VariableData* createData(const char *const defData); -VariableData* createData(const bool defData); -DefaultsData* getConfigDefaults(); -DefaultsData* getBrandingDefaults(); -DefaultsData* getPathsDefaults(); +VariableData* createData(const int defData) A_WARN_UNUSED; +VariableData* createData(const double defData) A_WARN_UNUSED; +VariableData* createData(const float defData) A_WARN_UNUSED; +VariableData* createData(const std::string &defData) A_WARN_UNUSED; +VariableData* createData(const char *const defData) A_WARN_UNUSED; +VariableData* createData(const bool defData) A_WARN_UNUSED; +DefaultsData* getConfigDefaults() A_WARN_UNUSED; +DefaultsData* getBrandingDefaults() A_WARN_UNUSED; +DefaultsData* getPathsDefaults() A_WARN_UNUSED; #endif diff --git a/src/depricatedevent.h b/src/depricatedevent.h index 7c2ebed79..baaecc70b 100644 --- a/src/depricatedevent.h +++ b/src/depricatedevent.h @@ -129,15 +129,15 @@ class DepricatedEvent final ~DepricatedEvent(); - DepricatedEvents getName() const + DepricatedEvents getName() const A_WARN_UNUSED { return mDepricatedEventName; } // Sets or gets a interger with a key to identify void setInt(const std::string &key, int value) - throw (BadDepricatedEvent); + throw (BadDepricatedEvent); int getInt(const std::string &key) - const throw (BadDepricatedEvent); + const throw (BadDepricatedEvent) A_WARN_UNUSED; // Sets or gets a string with a key to identify void setString(const std::string &key, @@ -145,13 +145,13 @@ class DepricatedEvent final throw (BadDepricatedEvent); const std::string &getString(const std::string &key) - const throw (BadDepricatedEvent); + const throw (BadDepricatedEvent) A_WARN_UNUSED; // Sets or gets a floating point number with key to identify void setFloat(const std::string &key, double value) - throw (BadDepricatedEvent); + throw (BadDepricatedEvent); double getFloat(const std::string &key) - const throw (BadDepricatedEvent); + const throw (BadDepricatedEvent) A_WARN_UNUSED; // Sends event to all listener on the channel static void trigger(const Channels channel, diff --git a/src/dropshortcut.h b/src/dropshortcut.h index 7f4443638..7f3ec46eb 100644 --- a/src/dropshortcut.h +++ b/src/dropshortcut.h @@ -62,22 +62,22 @@ class DropShortcut final * * @param index Index of the shortcut item. */ - int getItem(const int index) const + int getItem(const int index) const A_WARN_UNUSED { return mItems[index]; } - unsigned char getItemColor(const int index) const + unsigned char getItemColor(const int index) const A_WARN_UNUSED { return mItemColors[index]; } /** * Returns the amount of shortcut items. */ - int getItemCount() const + int getItemCount() const A_WARN_UNUSED { return DROP_SHORTCUT_ITEMS; } /** * Returns the item ID that is currently selected. */ - int getItemSelected() const + int getItemSelected() const A_WARN_UNUSED { return mItemSelected; } /** @@ -110,7 +110,7 @@ class DropShortcut final /** * A flag to check if the item is selected. */ - bool isItemSelected() const + bool isItemSelected() const A_WARN_UNUSED { return mItemSelected > -1; } /** diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h index a90e1f723..fe3d77e12 100644 --- a/src/emoteshortcut.h +++ b/src/emoteshortcut.h @@ -54,19 +54,19 @@ class EmoteShortcut final * * @param index Index of the shortcut Emote. */ - unsigned char getEmote(const int index) const + unsigned char getEmote(const int index) const A_WARN_UNUSED { return mEmotes[index]; } /** * Returns the amount of shortcut Emotes. */ - unsigned int getEmoteCount() const + unsigned int getEmoteCount() const A_WARN_UNUSED { return SHORTCUT_EMOTES; } /** * Returns the emote ID that is currently selected. */ - unsigned char getEmoteSelected() const + unsigned char getEmoteSelected() const A_WARN_UNUSED { return mEmoteSelected; } /** @@ -97,7 +97,7 @@ class EmoteShortcut final /** * A flag to check if the Emote is selected. */ - bool isEmoteSelected() const + bool isEmoteSelected() const A_WARN_UNUSED { return mEmoteSelected; } /** diff --git a/src/equipment.h b/src/equipment.h index d0aa8a785..c814e802f 100644 --- a/src/equipment.h +++ b/src/equipment.h @@ -67,7 +67,7 @@ class Equipment class Backend { public: - virtual Item *getEquipment(int index) const = 0; + virtual Item *getEquipment(int index) const A_WARN_UNUSED = 0; virtual void clear() = 0; @@ -78,7 +78,7 @@ class Equipment /** * Get equipment at the given slot. */ - Item *getEquipment(const int index) const + Item *getEquipment(const int index) const A_WARN_UNUSED { return mBackend ? mBackend->getEquipment(index) : nullptr; } /** @@ -95,7 +95,7 @@ class Equipment void setBackend(Backend *const backend) { mBackend = backend; } - const Backend *getBackend() const + const Backend *getBackend() const A_WARN_UNUSED { return mBackend; } private: diff --git a/src/flooritem.h b/src/flooritem.h index e497d0bc6..f4b843a8c 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -54,7 +54,7 @@ class FloorItem final : public ActorSprite A_DELETE_COPY(FloorItem) - Type getType() const override + Type getType() const override A_WARN_UNUSED { return FLOOR_ITEM; } bool draw(Graphics *graphics, int offsetX, int offsetY) const override; @@ -62,33 +62,33 @@ class FloorItem final : public ActorSprite /** * Returns the item ID. */ - int getItemId() const + int getItemId() const A_WARN_UNUSED { return mItemId; } /** * Returns the item info for this floor item. Useful for adding an item * link for the floor item to chat. */ - const ItemInfo &getInfo() const; + const ItemInfo &getInfo() const A_WARN_UNUSED; - std::string getName() const; + std::string getName() const A_WARN_UNUSED; - virtual int getTileX() const override + virtual int getTileX() const override A_WARN_UNUSED { return mX; } - virtual int getTileY() const override + virtual int getTileY() const override A_WARN_UNUSED { return mY; } void incrementPickup() { mPickupCount ++; } - unsigned getPickupCount() const + unsigned getPickupCount() const A_WARN_UNUSED { return mPickupCount; } - unsigned char getColor() const + unsigned char getColor() const A_WARN_UNUSED { return mColor; } - bool getShowMsg() const + bool getShowMsg() const A_WARN_UNUSED { return mShowMsg; } void setShowMsg(const bool n) @@ -97,15 +97,13 @@ class FloorItem final : public ActorSprite void disableHightlight() { mHighlight = false; } - Cursor::Cursor getHoverCursor() const + Cursor::Cursor getHoverCursor() const A_WARN_UNUSED { return mCursor; } private: int mItemId; int mX, mY; -// Item *mItem; Map *mMap; -// float mAlpha; int mDropTime; int mAmount; unsigned mPickupCount; diff --git a/src/game.h b/src/game.h index 001c7c348..59fa68012 100644 --- a/src/game.h +++ b/src/game.h @@ -67,7 +67,7 @@ class Game final /** * Provides access to the game instance. */ - static Game *instance() + static Game *instance() A_WARN_UNUSED { return mInstance; } static void clearInstance() @@ -92,10 +92,10 @@ class Game final /** * Returns the currently active map. */ - Map *getCurrentMap() const + Map *getCurrentMap() const A_WARN_UNUSED { return mCurrentMap; } - const std::string &getCurrentMapName() const + const std::string &getCurrentMapName() const A_WARN_UNUSED { return mMapName; } void setValidSpeed(); @@ -111,7 +111,7 @@ class Game final void videoResized(const int width, const int height) const; - bool getValidSpeed() const + bool getValidSpeed() const A_WARN_UNUSED { return mValidSpeed; } static bool createScreenshot(); @@ -125,11 +125,8 @@ class Game final void clearKeysArray(); - int mLastTarget; -// WindowMenu *mWindowMenu; - Map *mCurrentMap; std::string mMapName; bool mValidSpeed; diff --git a/src/graphics.h b/src/graphics.h index d6fd015f9..d538ef7af 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -108,7 +108,7 @@ class Graphics : public gcn::SDLGraphics */ void setSync(const bool sync); - bool getSync() const + bool getSync() const A_WARN_UNUSED { return mSync; } /** @@ -244,7 +244,7 @@ class Graphics : public gcn::SDLGraphics void setBlitMode(const BlitMode mode) { mBlitMode = mode; } - BlitMode getBlitMode() const + BlitMode getBlitMode() const A_WARN_UNUSED { return mBlitMode; } void fillRectangle(const gcn::Rectangle& rectangle) override; @@ -258,64 +258,64 @@ class Graphics : public gcn::SDLGraphics /** * Returns the width of the screen. */ - int getWidth() const; + int getWidth() const A_WARN_UNUSED; /** * Returns the height of the screen. */ - int getHeight() const; + int getHeight() const A_WARN_UNUSED; /** * Takes a screenshot and returns it as SDL surface. */ - virtual SDL_Surface *getScreenshot(); + virtual SDL_Surface *getScreenshot() A_WARN_UNUSED; virtual void prepareScreenshot() { } - int getMemoryUsage() const; + int getMemoryUsage() const A_WARN_UNUSED; virtual bool drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height); - gcn::Font *getFont() const + gcn::Font *getFont() const A_WARN_UNUSED { return mFont; } - gcn::ClipRectangle &getTopClip() + gcn::ClipRectangle &getTopClip() A_WARN_UNUSED { return mClipStack.top(); } void setRedraw(const bool n) { mRedraw = n; } - bool getRedraw() const + bool getRedraw() const A_WARN_UNUSED { return mRedraw; } void setSecure(const bool n) { mSecure = n; } - bool getSecure() const + bool getSecure() const A_WARN_UNUSED { return mSecure; } - int getBpp() const + int getBpp() const A_WARN_UNUSED { return mBpp; } - bool getFullScreen() const + bool getFullScreen() const A_WARN_UNUSED { return mFullscreen; } - bool getHWAccel() const + bool getHWAccel() const A_WARN_UNUSED { return mHWAccel; } - bool getDoubleBuffer() const + bool getDoubleBuffer() const A_WARN_UNUSED { return mDoubleBuffer; } - int getOpenGL() const + int getOpenGL() const A_WARN_UNUSED { return mOpenGL; } void setNoFrame(const bool n) { mNoFrame = n; } - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } virtual void initArrays() @@ -341,9 +341,9 @@ class Graphics : public gcn::SDLGraphics void setMainFlags(int w, int h, int bpp, bool fs, bool hwaccel, bool resize, bool noFrame); - int getOpenGLFlags() const; + int getOpenGLFlags() const A_WARN_UNUSED; - int getSoftwareFlags() const; + int getSoftwareFlags() const A_WARN_UNUSED; bool setOpenGLMode(); diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 655040aab..a63bfd254 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -769,15 +769,17 @@ void GraphicsManager::initOpenGL() void GraphicsManager::createTextureSampler() { + GLenum err = getLastError(); + if (err) + logger->log(errorToString(err)); if (mUseTextureSampler) { - logger->log("using texture sampler"); - getLastError(); + logger->log1("using texture sampler"); mglGenSamplers(1, &mTextureSampler); if (getLastError() != GL_NO_ERROR) { mUseTextureSampler = false; - logger->log("texture sampler error"); + logger->log1("texture sampler error"); OpenGLImageHelper::setUseTextureSampler(mUseTextureSampler); return; } @@ -786,13 +788,13 @@ void GraphicsManager::createTextureSampler() if (getLastError() != GL_NO_ERROR) { mUseTextureSampler = false; - logger->log("texture sampler error"); + logger->log1("texture sampler error"); } } OpenGLImageHelper::setUseTextureSampler(mUseTextureSampler); } -unsigned int GraphicsManager::getLastError() +GLenum GraphicsManager::getLastError() { GLenum tmp = glGetError(); GLenum error = GL_NO_ERROR; diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h index 7dbd5ea4d..68e032425 100644 --- a/src/graphicsmanager.h +++ b/src/graphicsmanager.h @@ -62,22 +62,22 @@ class GraphicsManager final void setVideoMode(); - Graphics *createGraphics(); + Graphics *createGraphics() A_WARN_UNUSED; bool getAllVideoModes(StringVect &modeList); #ifdef USE_OPENGL - TestMain *startDetection(); + TestMain *startDetection() A_WARN_UNUSED; - int detectGraphics(); + int detectGraphics() A_WARN_UNUSED; - bool supportExtension(const std::string &ext); + bool supportExtension(const std::string &ext) A_WARN_UNUSED; void updateTextureFormat(); - bool checkGLVersion(int major, int minor) const; + bool checkGLVersion(int major, int minor) const A_WARN_UNUSED; - bool checkPlatformVersion(int major, int minor) const; + bool checkPlatformVersion(int major, int minor) const A_WARN_UNUSED; void createFBO(int width, int height, FBOInfo *fbo); @@ -93,17 +93,17 @@ class GraphicsManager final void updateLimits(); - int getMaxVertices() const + int getMaxVertices() const A_WARN_UNUSED { return mMaxVertices; } - bool getUseAtlases() const + bool getUseAtlases() const A_WARN_UNUSED { return mUseAtlases; } void logVersion(); void setGLVersion(); - std::string getGLString(int num) const; + std::string getGLString(int num) const A_WARN_UNUSED; void logString(const char *format, int num); @@ -111,12 +111,12 @@ class GraphicsManager final void createTextureSampler(); - bool isUseTextureSampler() const + bool isUseTextureSampler() const A_WARN_UNUSED { return mUseTextureSampler; } - unsigned int getLastError(); + GLenum getLastError() A_WARN_UNUSED; - static std::string errorToString(GLenum error); + static std::string errorToString(GLenum error) A_WARN_UNUSED; void updateDebugLog(); #endif diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h index 6a2e30664..dbec25395 100644 --- a/src/graphicsvertexes.h +++ b/src/graphicsvertexes.h @@ -88,16 +88,16 @@ class NormalOpenGLGraphicsVertexes final GLshort *switchShortVertArray(); - std::vector<GLfloat*> *getFloatTexPool() + std::vector<GLfloat*> *getFloatTexPool() A_WARN_UNUSED { return &mFloatTexPool; } - std::vector<GLint*> *getIntVertPool() + std::vector<GLint*> *getIntVertPool() A_WARN_UNUSED { return &mIntVertPool; } - std::vector<GLshort*> *getShortVertPool() + std::vector<GLshort*> *getShortVertPool() A_WARN_UNUSED { return &mShortVertPool; } - std::vector<GLint*> *getIntTexPool() + std::vector<GLint*> *getIntTexPool() A_WARN_UNUSED { return &mIntTexPool; } void switchVp(int n); @@ -114,7 +114,7 @@ class NormalOpenGLGraphicsVertexes final void updateVp(int n); - std::vector<int> *getVp() + std::vector<int> *getVp() A_WARN_UNUSED { return &mVp; } void init(); @@ -188,20 +188,20 @@ class GraphicsVertexes final { mPtr = num; } #ifdef USE_OPENGL - NormalOpenGLGraphicsVertexes &getOGL() + NormalOpenGLGraphicsVertexes &getOGL() A_WARN_UNUSED { return ogl[mPtr]; } #endif - int getX() const + int getX() const A_WARN_UNUSED { return mX; } - int getY() const + int getY() const A_WARN_UNUSED { return mY; } - int getW() const + int getW() const A_WARN_UNUSED { return mW; } - int getH() const + int getH() const A_WARN_UNUSED { return mH; } int mX, mY, mW, mH; diff --git a/src/gui/buydialog.h b/src/gui/buydialog.h index c3f061af4..3b1b05d4d 100644 --- a/src/gui/buydialog.h +++ b/src/gui/buydialog.h @@ -92,7 +92,7 @@ class BuyDialog final : public Window, /** * Returns the number of items in the shop inventory. */ - int getNumberOfElements(); + int getNumberOfElements() A_WARN_UNUSED; /** * Updates the labels according to the selected item. @@ -112,7 +112,7 @@ class BuyDialog final : public Window, /** * Returns true if any instances exist. */ - static bool isActive() + static bool isActive() A_WARN_UNUSED { return !instances.empty(); } /** diff --git a/src/gui/buyselldialog.h b/src/gui/buyselldialog.h index 0d43563f7..c0aa1f643 100644 --- a/src/gui/buyselldialog.h +++ b/src/gui/buyselldialog.h @@ -63,7 +63,7 @@ class BuySellDialog final : public Window, public gcn::ActionListener /** * Returns true if any instances exist. */ - static bool isActive() + static bool isActive() A_WARN_UNUSED { return !instances.empty(); } /** diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h index d2bd57c61..d15812484 100644 --- a/src/gui/charcreatedialog.h +++ b/src/gui/charcreatedialog.h @@ -80,14 +80,14 @@ class CharCreateDialog final : public Window, void keyPressed(gcn::KeyEvent &keyEvent) override; private: - int getDistributedPoints() const; + int getDistributedPoints() const A_WARN_UNUSED; void updateSliders(); /** * Returns the name of the character to create. */ - std::string getName() const; + std::string getName() const A_WARN_UNUSED; /** * Communicate character creation to the server. diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h index 82b1cae0d..6e819da47 100644 --- a/src/gui/charselectdialog.h +++ b/src/gui/charselectdialog.h @@ -102,7 +102,7 @@ class CharSelectDialog final : public Window, void unlock(); void setLocked(const bool locked); - bool getFocusedContainer(int &container, int &idx); + bool getFocusedContainer(int &container, int &idx) A_WARN_UNUSED; void setFocusedContainer(const int i, const int button); diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 911b1b1ff..6ffd039ab 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -107,7 +107,7 @@ class ChatWindow final : public Window, /** * Gets the focused tab. */ - ChatTab *getFocused() const; + ChatTab *getFocused() const A_WARN_UNUSED; /** * Clear the given tab. @@ -155,7 +155,7 @@ class ChatWindow final : public Window, /** * Checks whether ChatWindow is Focused or not. */ - bool isInputFocused() const; + bool isInputFocused() const A_WARN_UNUSED; /** * Passes the text to the current tab as input @@ -215,7 +215,7 @@ class ChatWindow final : public Window, */ void setRecordingFile(const std::string &msg); - bool getReturnTogglesChat() const + bool getReturnTogglesChat() const A_WARN_UNUSED { return mReturnToggles; } void setReturnTogglesChat(const bool toggles) @@ -227,9 +227,9 @@ class ChatWindow final : public Window, const Own own = BY_OTHER); WhisperTab *addWhisperTab(const std::string &nick, - const bool switchTo = false); + const bool switchTo = false) A_WARN_UNUSED; - WhisperTab *getWhisperTab(const std::string &nick) const; + WhisperTab *getWhisperTab(const std::string &nick) const A_WARN_UNUSED; void removeAllWhispers(); @@ -253,7 +253,7 @@ class ChatWindow final : public Window, void loadGMCommands(); - std::string doReplace(const std::string &msg) const; + std::string doReplace(const std::string &msg) const A_WARN_UNUSED; void adjustTabSize(); @@ -266,7 +266,7 @@ class ChatWindow final : public Window, void parseHighlights(); - bool findHighlight(const std::string &str); + bool findHighlight(const std::string &str) A_WARN_UNUSED; void copyToClipboard(const int x, const int y) const; diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h index 4d32c1ff9..3c9a0948b 100644 --- a/src/gui/editdialog.h +++ b/src/gui/editdialog.h @@ -58,7 +58,7 @@ class EditDialog final : public Window, public gcn::ActionListener */ void action(const gcn::ActionEvent &event) override; - std::string getMsg() const + std::string getMsg() const A_WARN_UNUSED { return mTextField->getText(); } private: diff --git a/src/gui/editserverdialog.h b/src/gui/editserverdialog.h index 722c0a009..a5a998ab8 100644 --- a/src/gui/editserverdialog.h +++ b/src/gui/editserverdialog.h @@ -49,7 +49,7 @@ class TypeListModel : public gcn::ListModel /** * Used to get number of line in the list */ - int getNumberOfElements() override + int getNumberOfElements() override A_WARN_UNUSED #ifdef EATHENA_SUPPORT #ifdef MANASERV_SUPPORT { return 4; } @@ -67,7 +67,7 @@ class TypeListModel : public gcn::ListModel /** * Used to get an element from the list */ - std::string getElementAt(int elementIndex) override; + std::string getElementAt(int elementIndex) override A_WARN_UNUSED; }; /** diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 3fa5f68cf..6d7baff40 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -429,7 +429,7 @@ void EquipmentWindow::loadSlot(const XmlNodePtr slotNode, mMaxY = y + mBoxSize; } -int EquipmentWindow::parseSlotName(std::string name) const +int EquipmentWindow::parseSlotName(const std::string &name) const { int id = -1; if (name == "shoes" || name == "boot" || name == "boots") diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index c8cc36fbd..d79ff950f 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -88,7 +88,7 @@ class EquipmentWindow final : public Window, public gcn::ActionListener void mousePressed(gcn::MouseEvent& mouseEvent) override; - Item* getEquipment(int i) const + Item* getEquipment(int i) const A_WARN_UNUSED { return mEquipment ? mEquipment->getEquipment(i) : nullptr; } void setBeing(Being *const being); @@ -104,7 +104,7 @@ class EquipmentWindow final : public Window, public gcn::ActionListener void recalcSize(); private: - Item *getItem(const int x, const int y) const; + Item *getItem(const int x, const int y) const A_WARN_UNUSED; void setSelected(const int index); @@ -121,7 +121,7 @@ class EquipmentWindow final : public Window, public gcn::ActionListener void loadSlot(const XmlNodePtr slotNode, const ImageSet *const imageset); - int parseSlotName(std::string name) const; + int parseSlotName(const std::string &name) const A_WARN_UNUSED; Equipment *mEquipment; diff --git a/src/gui/gui.h b/src/gui/gui.h index e8969d666..74c5404aa 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -84,38 +84,38 @@ class Gui final : public gcn::Gui */ void videoResized() const; - gcn::FocusHandler *getFocusHandler() const + gcn::FocusHandler *getFocusHandler() const A_WARN_UNUSED { return mFocusHandler; } /** * Return game font. */ - SDLFont *getFont() const + SDLFont *getFont() const A_WARN_UNUSED { return mGuiFont; } /** * Return help font. */ - SDLFont *getHelpFont() const + SDLFont *getHelpFont() const A_WARN_UNUSED { return mHelpFont; } /** * Return secure font. */ - SDLFont *getSecureFont() const + SDLFont *getSecureFont() const A_WARN_UNUSED { return mSecureFont; } /** * Return npc font. */ - SDLFont *getNpcFont() const + SDLFont *getNpcFont() const A_WARN_UNUSED { return mNpcFont; } /** * Return the Font used for "Info Particles", i.e. ones showing, what * you picked up, etc. */ - SDLFont *getInfoParticleFont() const + SDLFont *getInfoParticleFont() const A_WARN_UNUSED { return mInfoParticleFont; } /** @@ -137,7 +137,7 @@ class Gui final : public gcn::Gui void resetClickCount(); - MouseEvent *createMouseEvent(Window *widget); + MouseEvent *createMouseEvent(Window *widget) A_WARN_UNUSED; void getAbsolutePosition(gcn::Widget *widget, int &x, int &y); diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 2340e60ed..426a4f6ee 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -79,7 +79,7 @@ class InventoryWindow final : public Window, /** * Returns the selected item. */ - Item* getSelectedItem() const; + Item* getSelectedItem() const A_WARN_UNUSED; /** * Unselect item @@ -124,13 +124,13 @@ class InventoryWindow final : public Window, void slotsChanged(Inventory *const inventory); - bool isMainInventory() const + bool isMainInventory() const A_WARN_UNUSED { return mInventory->isMainInventory(); } /** * Returns true if any instances exist. */ - static bool isStorageActive() + static bool isStorageActive() A_WARN_UNUSED { return instances.size() > 1; } void updateDropButton(); @@ -140,7 +140,7 @@ class InventoryWindow final : public Window, void updateButtons(const Item *item = nullptr); - bool isInputFocused() const; + bool isInputFocused() const A_WARN_UNUSED; void widgetResized(const gcn::Event &event) override; diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index eb0471aeb..234218e8c 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -134,8 +134,9 @@ MiniStatusWindow::~MiniStatusWindow() ProgressBar *MiniStatusWindow::createBar(const float progress, const int width, const int height, - const int color, std::string name, - std::string description) + const int color, + const std::string &name, + const std::string &description) { ProgressBar *const bar = new ProgressBar(this, progress, width, height, color); diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index 36acb7fb9..16d010669 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -84,17 +84,18 @@ class MiniStatusWindow final : public Popup, void slotsChanged(Inventory *const inventory); - std::vector <ProgressBar*> &getBars() + std::vector <ProgressBar*> &getBars() A_WARN_UNUSED { return mBars; } - gcn::Rectangle getChildrenArea(); + gcn::Rectangle getChildrenArea() A_WARN_UNUSED; private: bool isInBar(ProgressBar *bar, int x, int y) const; ProgressBar *createBar(const float progress, const int width, const int height, const int color, - std::string name, std::string description); + const std::string &name, + const std::string &description) A_WARN_UNUSED; void loadBars(); diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index a3e9eec9c..79999aa07 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -110,17 +110,17 @@ class NpcDialog final : public Window, public gcn::ActionListener, /** * Returns the number of items in the choices list. */ - int getNumberOfElements() override; + int getNumberOfElements() override A_WARN_UNUSED; /** * Returns the name of item number i of the choices list. */ - std::string getElementAt(int i) override; + std::string getElementAt(int i) override A_WARN_UNUSED; /** * Returns the image of item number i of the choices list. */ - const Image *getImageAt(int i) override; + const Image *getImageAt(int i) override A_WARN_UNUSED; /** * Makes this dialog request a choice selection from the user. @@ -144,11 +144,11 @@ class NpcDialog final : public Window, public gcn::ActionListener, */ void textRequest(const std::string &defaultText = ""); - bool isInputFocused() const; + bool isInputFocused() const A_WARN_UNUSED; - bool isTextInputFocused() const; + bool isTextInputFocused() const A_WARN_UNUSED; - static bool isAnyInputFocused(); + static bool isAnyInputFocused() A_WARN_UNUSED; /** * Requests a interger from the user. @@ -165,14 +165,14 @@ class NpcDialog final : public Window, public gcn::ActionListener, /** * Returns true if any instances exist. */ - static bool isActive() + static bool isActive() A_WARN_UNUSED { return !instances.empty(); } /** * Returns the first active instance. Useful for pushing user * interaction. */ - static NpcDialog *getActive(); + static NpcDialog *getActive() A_WARN_UNUSED; /** * Closes all instances. diff --git a/src/gui/npcpostdialog.h b/src/gui/npcpostdialog.h index 8e2bdd588..71dffb2f6 100644 --- a/src/gui/npcpostdialog.h +++ b/src/gui/npcpostdialog.h @@ -52,7 +52,7 @@ public: /** * Returns true if any instances exist. */ - static bool isActive() + static bool isActive() A_WARN_UNUSED { return !instances.empty(); } /** diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index e6e910042..c70d97fa6 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -74,7 +74,7 @@ class OutfitWindow final : public Window, private gcn::ActionListener void setItemSelected(const Item *const item); - bool isItemSelected() const + bool isItemSelected() const A_WARN_UNUSED { return mItemSelected > 0; } void wearOutfit(const int outfit, const bool unwearEmpty = true, @@ -104,7 +104,7 @@ class OutfitWindow final : public Window, private gcn::ActionListener void showCurrentOutfit(); - std::string keyName(const int number) const; + std::string keyName(const int number) const A_WARN_UNUSED; void clearCurrentOutfit(); @@ -117,7 +117,8 @@ class OutfitWindow final : public Window, private gcn::ActionListener CheckBox *mAwayOutfitCheck; Label *mKeyLabel; - int getIndexFromGrid(const int pointX, const int pointY) const; + int getIndexFromGrid(const int pointX, + const int pointY) const A_WARN_UNUSED; int mBoxWidth; int mBoxHeight; diff --git a/src/gui/palette.h b/src/gui/palette.h index f18e4ed38..e36f59aae 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -67,9 +67,9 @@ class Palette * * @return the requested color or Palette::BLACK */ - const gcn::Color &getCharColor(const signed char c, bool &valid); + const gcn::Color &getCharColor(const signed char c, bool &valid) A_WARN_UNUSED; - int getIdByChar(const signed char c, bool &valid); + int getIdByChar(const signed char c, bool &valid) A_WARN_UNUSED; /** * Gets the color associated with the type. Sets the alpha channel @@ -80,7 +80,7 @@ class Palette * * @return the requested color */ - inline const gcn::Color &getColor(int type, int alpha = 255) + inline const gcn::Color &getColor(int type, int alpha = 255) A_WARN_UNUSED { if (type >= static_cast<signed>(mColors.size()) || type < 0) { @@ -93,7 +93,7 @@ class Palette return *col; } - inline const gcn::Color &getColorWithAlpha(int type) + inline const gcn::Color &getColorWithAlpha(int type) A_WARN_UNUSED { gcn::Color* col = &mColors[type].color; col->a = mColors[type].delay; @@ -107,7 +107,7 @@ class Palette * * @return the gradient type of the color with the given index */ - inline GradientType getGradientType(int type) const + inline GradientType getGradientType(int type) const A_WARN_UNUSED { return mColors[type].grad; } /** @@ -117,7 +117,7 @@ class Palette * * @return the color char of the color with the given index */ - inline char getColorChar(int type) const + inline char getColorChar(int type) const A_WARN_UNUSED { return mColors[type].ch; } /** @@ -127,7 +127,7 @@ class Palette * * @return the gradient delay of the color with the given index */ - inline int getGradientDelay(int type) const + inline int getGradientDelay(int type) const A_WARN_UNUSED { return mColors[type].delay; } /** @@ -135,7 +135,8 @@ class Palette */ static void advanceGradients(); - static gcn::Color produceHPColor(int hp, int maxHp, int alpha = 255); + static gcn::Color produceHPColor(int hp, int maxHp, + int alpha = 255) A_WARN_UNUSED; protected: /** Colors used for the rainbow gradient */ @@ -200,7 +201,7 @@ class Palette gradientIndex = rand(); } - inline int getRGB() const + inline int getRGB() const A_WARN_UNUSED { return (committedColor.r << 16) | (committedColor.g << 8) | committedColor.b; diff --git a/src/gui/registerdialog.h b/src/gui/registerdialog.h index 7d375c691..0c7cf9f77 100644 --- a/src/gui/registerdialog.h +++ b/src/gui/registerdialog.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef REGISTER_H -#define REGISTER_H +#ifndef REGISTERDIALOG_H +#define REGISTERDIALOG_H #include "gui/widgets/window.h" diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h index 818ef7541..3086abf0a 100644 --- a/src/gui/sdlfont.h +++ b/src/gui/sdlfont.h @@ -69,11 +69,11 @@ class SDLFont final : public gcn::Font void createSDLTextChunk(SDLTextChunk *const chunk); - virtual int getWidth(const std::string &text) const; + virtual int getWidth(const std::string &text) const A_WARN_UNUSED; - virtual int getHeight() const; + virtual int getHeight() const A_WARN_UNUSED; - std::list<SDLTextChunk> *getCache() + std::list<SDLTextChunk> *getCache() A_WARN_UNUSED { return mCache; } /** @@ -89,10 +89,10 @@ class SDLFont final : public gcn::Font void slowLogic(); - int getCreateCounter() const + int getCreateCounter() const A_WARN_UNUSED { return mCreateCounter; } - int getDeleteCounter() const + int getDeleteCounter() const A_WARN_UNUSED { return mDeleteCounter; } private: diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index cb9e50f30..c3b0d14e7 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -155,18 +155,18 @@ public: virtual void _pollInput() { } - virtual KeyInput dequeueKeyInput2(); + virtual KeyInput dequeueKeyInput2() A_WARN_UNUSED; - virtual gcn::KeyInput dequeueKeyInput() + virtual gcn::KeyInput dequeueKeyInput() A_WARN_UNUSED { return gcn::KeyInput(); } // Inherited from Input - virtual bool isKeyQueueEmpty(); + virtual bool isKeyQueueEmpty() A_WARN_UNUSED; - virtual bool isMouseQueueEmpty(); + virtual bool isMouseQueueEmpty() A_WARN_UNUSED; - virtual gcn::MouseInput dequeueMouseInput(); + virtual gcn::MouseInput dequeueMouseInput() A_WARN_UNUSED; protected: /** @@ -176,7 +176,7 @@ protected: * @param button an SDL mouse button. * @return a Guichan mouse button. */ - static int convertMouseButton(const int button); + static int convertMouseButton(const int button) A_WARN_UNUSED; /** * Converts an SDL event key to a key value. @@ -185,7 +185,7 @@ protected: * @return a key value. * @see Key */ - static int convertKeyCharacter(const SDL_Event &event); + static int convertKeyCharacter(const SDL_Event &event) A_WARN_UNUSED; std::queue<KeyInput> mKeyInputQueue; std::queue<gcn::MouseInput> mMouseInputQueue; diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h index 2e257ec52..447665bf7 100644 --- a/src/gui/selldialog.h +++ b/src/gui/selldialog.h @@ -107,7 +107,7 @@ class SellDialog final : public Window, /** * Returns true if any instances exist. */ - static bool isActive() + static bool isActive() A_WARN_UNUSED { return !instances.empty(); } /** diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index 0e5764865..740c35a95 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -63,17 +63,17 @@ class ServersListModel final : public gcn::ListModel /** * Used to get number of line in the list */ - int getNumberOfElements() override; + int getNumberOfElements() override A_WARN_UNUSED; /** * Used to get an element from the list */ - std::string getElementAt(int elementIndex) override; + std::string getElementAt(int elementIndex) override A_WARN_UNUSED; /** * Used to get the corresponding Server struct */ - const ServerInfo &getServer(const int elementIndex) const + const ServerInfo &getServer(const int elementIndex) const A_WARN_UNUSED { return mServers->at(elementIndex); } void setVersionString(const int index, const std::string &version); diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h index 188be4a26..186c094be 100644 --- a/src/gui/setup_input.h +++ b/src/gui/setup_input.h @@ -32,6 +32,7 @@ class Button; class ListBox; +class KeyListModel; class TabStrip; struct SetupActionData; @@ -77,9 +78,9 @@ class Setup_Input final : public SetupTab */ void keyUnresolved(); - int keyToSetupData(const int index) const; + int keyToSetupData(const int index) const A_WARN_UNUSED; - std::string keyToString(const int index) const; + std::string keyToString(const int index) const A_WARN_UNUSED; private: void fixTranslations() const; @@ -88,7 +89,7 @@ class Setup_Input final : public SetupTab const int actionStart, const int actionEnd, const std::string &text) const; - class KeyListModel *mKeyListModel; + KeyListModel *mKeyListModel; ListBox *mKeyList; Button *mAssignKeyButton; diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h index b04a3a474..90fd09b6c 100644 --- a/src/gui/shopwindow.h +++ b/src/gui/shopwindow.h @@ -90,7 +90,7 @@ class ShopWindow final : public Window, public gcn::ActionListener, /** * Returns true if any instances exist. */ - static bool isActive() + static bool isActive() A_WARN_UNUSED { return !instances.empty(); } void setItemSelected(const int id) @@ -113,7 +113,7 @@ class ShopWindow final : public Window, public gcn::ActionListener, void setAcceptPlayer(std::string name) { mAcceptPlayer = name; } - const std::string &getAcceptPlayer() const + const std::string &getAcceptPlayer() const A_WARN_UNUSED { return mAcceptPlayer; } void sendMessage(const std::string &nick, std::string data, @@ -124,15 +124,16 @@ class ShopWindow final : public Window, public gcn::ActionListener, void processRequest(std::string nick, std::string data, const int mode); - bool findShopItem(const ShopItem *const shopItem, const int mode); + bool findShopItem(const ShopItem *const shopItem, + const int mode) A_WARN_UNUSED; - static int sumAmount(const Item *const shopItem); + static int sumAmount(const Item *const shopItem) A_WARN_UNUSED; void updateTimes(); - bool checkFloodCounter(int &counterTime) const; + bool checkFloodCounter(int &counterTime) const A_WARN_UNUSED; - bool isShopEmpty() const; + bool isShopEmpty() const A_WARN_UNUSED; private: void startTrade(); diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h index e87d4706e..f5d0fbab3 100644 --- a/src/gui/shortcutwindow.h +++ b/src/gui/shortcutwindow.h @@ -57,7 +57,7 @@ class ShortcutWindow final : public Window void addTab(std::string name, ShortcutContainer *const content); - int getTabIndex() const; + int getTabIndex() const A_WARN_UNUSED; void widgetHidden(const gcn::Event &event) override; diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index ccbb20064..6b33207b7 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -114,9 +114,9 @@ class SkillDialog final : public Window, public gcn::ActionListener void addSkill(const int id, const int level, const int range, const bool modifiable); - SkillInfo* getSkill(int id); + SkillInfo* getSkill(int id) A_WARN_UNUSED; - bool hasSkills() const + bool hasSkills() const A_WARN_UNUSED { return !mSkills.empty(); } void widgetResized(const gcn::Event &event) override; diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h index 06d00b9f0..20e4861d0 100644 --- a/src/gui/socialwindow.h +++ b/src/gui/socialwindow.h @@ -93,7 +93,7 @@ public: void updatePortalNames(); - int getPortalIndex(const int x, const int y); + int getPortalIndex(const int x, const int y) A_WARN_UNUSED; void addPortal(const int x, const int y); @@ -103,13 +103,13 @@ public: void prevTab(); - Map* getMap() const + Map* getMap() const A_WARN_UNUSED { return mMap; } void setMap(Map *const map) { mMap = map; mProcessedPortals = false; } - bool getProcessedPortals() const + bool getProcessedPortals() const A_WARN_UNUSED { return mProcessedPortals; } void setProcessedPortals(const bool n) diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h index 7f3f7119f..07aa22bf6 100644 --- a/src/gui/textdialog.h +++ b/src/gui/textdialog.h @@ -59,11 +59,11 @@ public: /** * Get the text in the textfield */ - const std::string &getText() const; + const std::string &getText() const A_WARN_UNUSED; void setText(std::string text); - static bool isActive() + static bool isActive() A_WARN_UNUSED { return instances; } void close(); diff --git a/src/gui/theme.h b/src/gui/theme.h index 5cf1a50f4..a19e93812 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -64,55 +64,55 @@ class Skin final * name if a dialog for skin selection for a specific window type is * done. */ - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } /** * Returns the skin's xml file path. */ - const std::string &getFilePath() const + const std::string &getFilePath() const A_WARN_UNUSED { return mFilePath; } /** * Returns the background skin. */ - ImageRect &getBorder() const + ImageRect &getBorder() const A_WARN_UNUSED { return *mBorder; } /** * Returns the image used by a close button for this skin. */ - Image *getCloseImage(const bool state) const + Image *getCloseImage(const bool state) const A_WARN_UNUSED { return state ? mCloseImageHighlighted : mCloseImage; } /** * Returns the image used by a sticky button for this skin. */ - Image *getStickyImage(const bool state) const + Image *getStickyImage(const bool state) const A_WARN_UNUSED { return state ? mStickyImageDown : mStickyImageUp; } /** * Returns the minimum width which can be used with this skin. */ - int getMinWidth() const; + int getMinWidth() const A_WARN_UNUSED; /** * Returns the minimum height which can be used with this skin. */ - int getMinHeight() const; + int getMinHeight() const A_WARN_UNUSED; /** * Updates the alpha value of the skin */ void updateAlpha(const float minimumOpacityAllowed = 0.0f); - int getPadding() const + int getPadding() const A_WARN_UNUSED { return mPadding; } - int getTitlePadding() const + int getTitlePadding() const A_WARN_UNUSED { return mTitlePadding; } - int getOption(const std::string &name) const + int getOption(const std::string &name) const A_WARN_UNUSED { if (mOptions->find(name) != mOptions->end()) return (*mOptions)[name]; @@ -120,7 +120,8 @@ class Skin final return 0; } - int getOption(const std::string &name, const int def) const + int getOption(const std::string &name, + const int def) const A_WARN_UNUSED { if (mOptions->find(name) != mOptions->end()) return (*mOptions)[name]; @@ -148,7 +149,7 @@ class Theme final : public Palette, public ConfigListener public: A_DELETE_COPY(Theme) - static Theme *instance(); + static Theme *instance() A_WARN_UNUSED; static void deleteInstance(); @@ -156,10 +157,10 @@ class Theme final : public Palette, public ConfigListener static void selectSkin(); - static std::string getThemePath() + static std::string getThemePath() A_WARN_UNUSED { return mThemePath; } - static std::string getThemeName() + static std::string getThemeName() A_WARN_UNUSED { return mThemeName; } static void fillSkinsList(StringVect &list); @@ -172,16 +173,19 @@ class Theme final : public Palette, public ConfigListener * Returns the patch to the given gui resource relative to the theme * or, if it isn't in the theme, relative to 'graphics/gui'. */ - static std::string resolveThemePath(const std::string &path); + static std::string resolveThemePath(const std::string &path) + A_WARN_UNUSED; - static Image *getImageFromTheme(const std::string &path); + static Image *getImageFromTheme(const std::string &path) A_WARN_UNUSED; static ImageSet *getImageSetFromTheme(const std::string &path, - const int w, const int h); + const int w, + const int h) A_WARN_UNUSED; ImageSet *getImageSetFromThemeXml(const std::string &name, const std::string &name2, - const int w, const int h) const; + const int w, + const int h) const A_WARN_UNUSED; enum ThemePalette { BROWSERBOX = 0, @@ -298,28 +302,30 @@ class Theme final : public Palette, public ConfigListener */ inline static const gcn::Color &getThemeColor(const int type, const int alpha = 255) + A_WARN_UNUSED { return mInstance->getColor(type, alpha); } static const gcn::Color &getThemeCharColor(const signed char c, - bool &valid) + bool &valid) A_WARN_UNUSED { return mInstance->getCharColor(c, valid); } - static int getThemeIdByChar(const signed char c, bool &valid) + static int getThemeIdByChar(const signed char c, + bool &valid) A_WARN_UNUSED { return mInstance->getIdByChar(c, valid); } static gcn::Color getProgressColor(const int type, - const float progress); + const float progress) A_WARN_UNUSED; /** * Loads a skin. */ Skin *load(const std::string &filename, const std::string &filename2, const bool full = true, const std::string - &defaultPath = getThemePath()); + &defaultPath = getThemePath()) A_WARN_UNUSED; Skin *loadSkinRect(ImageRect &image, const std::string &name, const std::string &name2, const int start = 0, - const int end = 8); + const int end = 8) A_WARN_UNUSED; void unload(Skin *const skin); @@ -331,7 +337,7 @@ class Theme final : public Palette, public ConfigListener /** * Get the minimum opacity allowed to skins. */ - float getMinimumOpacity() const + float getMinimumOpacity() const A_WARN_UNUSED { return mMinimumOpacity; } /** @@ -350,16 +356,18 @@ class Theme final : public Palette, public ConfigListener const int end = 8) const; static Image *getImageFromThemeXml(const std::string &name, - const std::string &name2); + const std::string &name2) + A_WARN_UNUSED; - static ThemeInfo *loadInfo(const std::string &themeName); + static ThemeInfo *loadInfo(const std::string &themeName) A_WARN_UNUSED; private: Theme(); ~Theme(); - Skin *readSkin(const std::string &filename0, const bool full); + Skin *readSkin(const std::string &filename0, + const bool full) A_WARN_UNUSED; // Map containing all window skins typedef std::map<std::string, Skin*> Skins; @@ -371,7 +379,7 @@ class Theme final : public Palette, public ConfigListener static std::string mThemeName; static Theme *mInstance; - static bool tryThemePath(std::string themePath); + static bool tryThemePath(std::string themePath) A_WARN_UNUSED; void loadColors(std::string file = ""); diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h index 1763771f3..4636a41e9 100644 --- a/src/gui/tradewindow.h +++ b/src/gui/tradewindow.h @@ -137,12 +137,12 @@ class TradeWindow final : public Window, void initTrade(std::string nick); - std::string getAutoTradeNick() const + std::string getAutoTradeNick() const A_WARN_UNUSED { return mAutoAddToNick; } - bool checkItem(const Item *const item) const; + bool checkItem(const Item *const item) const A_WARN_UNUSED; - bool isInpupFocused() const; + bool isInpupFocused() const A_WARN_UNUSED; private: enum Status diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h index d4fc1257e..1eb2c38f9 100644 --- a/src/gui/updaterwindow.h +++ b/src/gui/updaterwindow.h @@ -151,7 +151,7 @@ private: void *stream); static bool validateFile(const std::string &filePath, - const unsigned long hash); + const unsigned long hash) A_WARN_UNUSED; enum UpdateDownloadStatus { diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index 1242554d7..43decd601 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -98,7 +98,8 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the requested committed color */ - inline const gcn::Color &getCommittedColor(const int type) const + inline const gcn::Color &getCommittedColor(const int type) + const A_WARN_UNUSED { return mColors[type].committedColor; } @@ -110,7 +111,8 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the requested test color */ - inline const gcn::Color &getTestColor(const int type) const + inline const gcn::Color &getTestColor(const int type) + const A_WARN_UNUSED { return mColors[type].testColor; } /** @@ -152,7 +154,7 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the number of colors known */ - inline int getNumberOfElements() override + inline int getNumberOfElements() override A_WARN_UNUSED { return static_cast<int>(mColors.size()); } /** @@ -162,7 +164,7 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the name of the color */ - std::string getElementAt(int i) override; + std::string getElementAt(int i) override A_WARN_UNUSED; /** * Commit the colors @@ -183,7 +185,7 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the color type of the color with the given index */ - int getColorTypeAt(int i); + int getColorTypeAt(int i) A_WARN_UNUSED; private: /** @@ -212,7 +214,8 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the transformed string */ - static std::string getConfigName(const std::string &typeName); + static std::string getConfigName(const std::string &typeName) + A_WARN_UNUSED; /** * Initialise color diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 2803b1b97..c370f1e3b 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -196,25 +196,25 @@ class Viewport final : public WindowContainer, /** * Returns camera x offset in pixels. */ - int getCameraX() const + int getCameraX() const A_WARN_UNUSED { return mPixelViewX; } /** * Returns camera y offset in pixels. */ - int getCameraY() const + int getCameraY() const A_WARN_UNUSED { return mPixelViewY; } /** * Returns mouse x in pixels. */ - int getMouseX() const + int getMouseX() const A_WARN_UNUSED { return mMouseX; } /** * Returns mouse y in pixels. */ - int getMouseY() const + int getMouseY() const A_WARN_UNUSED { return mMouseY; } /** @@ -226,16 +226,16 @@ class Viewport final : public WindowContainer, /** * Returns the current map object. */ - Map *getCurrentMap() const + Map *getCurrentMap() const A_WARN_UNUSED { return mMap; } - int getDebugPath() const + int getDebugPath() const A_WARN_UNUSED { return mShowDebugPath; } void setDebugPath(const int n) { mShowDebugPath = n; } - int getCameraMode() const + int getCameraMode() const A_WARN_UNUSED { return mCameraMode; } /** @@ -248,15 +248,15 @@ class Viewport final : public WindowContainer, */ void cleanHoverItems(); - Map *getMap() const + Map *getMap() const A_WARN_UNUSED { return mMap; } void moveCamera(const int dx, const int dy); - int getCameraRelativeX() const + int getCameraRelativeX() const A_WARN_UNUSED { return mCameraRelativeX; } - int getCameraRelativeY() const + int getCameraRelativeY() const A_WARN_UNUSED { return mCameraRelativeY; } void setCameraRelativeX(const int n) @@ -265,7 +265,7 @@ class Viewport final : public WindowContainer, void setCameraRelativeY(const int n) { mCameraRelativeY = n; } - bool isPopupMenuVisible() const; + bool isPopupMenuVisible() const A_WARN_UNUSED; void moveCameraToActor(const int actorId, const int x = 0, const int y = 0); diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index 2b26ad393..fa2955e40 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -58,22 +58,22 @@ class OnlinePlayer final A_DELETE_COPY(OnlinePlayer) - const std::string getNick() const + const std::string getNick() const A_WARN_UNUSED { return mNick; } - unsigned char getStaus() const + unsigned char getStaus() const A_WARN_UNUSED { return mStatus; } void setIsGM(const bool b) { mIsGM = b; } - char getVersion() const + char getVersion() const A_WARN_UNUSED { return mVersion; } - char getLevel() const + char getLevel() const A_WARN_UNUSED { return mLevel; } - const std::string getText() const + const std::string getText() const A_WARN_UNUSED { return mText; } void setText(std::string str); @@ -137,10 +137,10 @@ public: void widgetResized(const gcn::Event &event) override; - const std::set<OnlinePlayer*> &getOnlinePlayers() const + const std::set<OnlinePlayer*> &getOnlinePlayers() const A_WARN_UNUSED { return mOnlinePlayers; } - const std::set<std::string> &getOnlineNicks() const + const std::set<std::string> &getOnlineNicks() const A_WARN_UNUSED { return mOnlineNicks; } void setAllowUpdate(const bool n) @@ -169,7 +169,7 @@ private: FILE *stream); const std::string prepareNick(std::string nick, int level, - std::string color) const; + std::string color) const A_WARN_UNUSED; void updateWindow(std::vector<OnlinePlayer*> &friends, std::vector<OnlinePlayer*> &neutral, diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index a1192acce..fb5d3af10 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -65,10 +65,10 @@ class WindowMenu final : public Container, void mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) override; - std::map <std::string, Button*> &getButtonNames() + std::map <std::string, Button*> &getButtonNames() A_WARN_UNUSED { return mButtonNames; } - std::vector <Button*> &getButtons() + std::vector <Button*> &getButtons() A_WARN_UNUSED { return mButtons; } void showButton(const std::string &name, const bool visible); diff --git a/src/guild.h b/src/guild.h index c2eee3cb4..db7d0df1e 100644 --- a/src/guild.h +++ b/src/guild.h @@ -41,16 +41,16 @@ class GuildMember final : public Avatar public: A_DELETE_COPY(GuildMember) - Guild *getGuild() const + Guild *getGuild() const A_WARN_UNUSED { return mGuild; } - int getPos() const + int getPos() const A_WARN_UNUSED { return mPos; } void setPos(const int pos) { mPos = pos; } - std::string getAdditionString() const override; + std::string getAdditionString() const override A_WARN_UNUSED; protected: friend class Guild; @@ -100,27 +100,28 @@ public: * * @return the member with the given ID, or NULL if they don't exist. */ - GuildMember *getMember(const int accountId, const int charId) const; + GuildMember *getMember(const int accountId, const int charId) + const A_WARN_UNUSED; /** * Find a member by name. * * @return the member with the given name, or NULL if they don't exist. */ - GuildMember *getMember(const std::string &name) const; + GuildMember *getMember(const std::string &name) const A_WARN_UNUSED; /** * Get the name of the guild. * @return returns name of the guild */ - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } /** * Get the id of the guild. * @return Returns the id of the guild */ - short getId() const + short getId() const A_WARN_UNUSED { return mId; } /** @@ -147,25 +148,25 @@ public: * Get size of members list. * @return Returns the number of members in the guild. */ - int getNumberOfElements() override + int getNumberOfElements() override A_WARN_UNUSED { return static_cast<int>(mMembers.size()); } - Avatar *getAvatarAt(const int i) override; + Avatar *getAvatarAt(const int i) override A_WARN_UNUSED; /** * Get whether user can invite users to this guild. * @return Returns true if user can invite users */ - bool getInviteRights() const + bool getInviteRights() const A_WARN_UNUSED { return mCanInviteUsers; } void setRights(const short rights); - bool isMember(const GuildMember *const member) const; + bool isMember(const GuildMember *const member) const A_WARN_UNUSED; - bool isMember(const int id) const; + bool isMember(const int id) const A_WARN_UNUSED; - bool isMember(const std::string &name) const; + bool isMember(const std::string &name) const A_WARN_UNUSED; void getNames(StringVect &names) const; @@ -173,17 +174,17 @@ public: void sort(); - std::string getPos(int id) const; + std::string getPos(int id) const A_WARN_UNUSED; - static Guild *getGuild(const short id); + static Guild *getGuild(const short id) A_WARN_UNUSED; - const PositionsMap &getPositions() const + const PositionsMap &getPositions() const A_WARN_UNUSED { return mPositions; } void setEmblemId(const int id) { mEmblemId = id; } - int getEmblemId() const + int getEmblemId() const A_WARN_UNUSED { return mEmblemId; } static void clearGuilds(); @@ -191,7 +192,7 @@ public: void setServerGuild(const bool b) { mServerGuild = b; } - bool getServerGuild() const + bool getServerGuild() const A_WARN_UNUSED { return mServerGuild; } private: diff --git a/src/guildmanager.h b/src/guildmanager.h index b8504313a..d4dcb0d59 100644 --- a/src/guildmanager.h +++ b/src/guildmanager.h @@ -53,7 +53,7 @@ class GuildManager final void updateList(); - static bool getEnableGuildBot() + static bool getEnableGuildBot() A_WARN_UNUSED { return mEnableGuildBot; } void kick(std::string msg) const; @@ -66,7 +66,7 @@ class GuildManager final void createTab(Guild *const guild); - Guild *createGuild() const; + Guild *createGuild() const A_WARN_UNUSED; void clear() const; @@ -76,7 +76,7 @@ class GuildManager final bool afterRemove(); - bool havePower() const + bool havePower() const A_WARN_UNUSED { return mHavePower; } private: diff --git a/src/imagesprite.h b/src/imagesprite.h index 0522533d7..0b6557a7d 100644 --- a/src/imagesprite.h +++ b/src/imagesprite.h @@ -48,26 +48,26 @@ public: bool draw(Graphics* graphics, int posX, int posY) const override; - int getWidth() const override + int getWidth() const override A_WARN_UNUSED { return mImage ? mImage->getWidth() : 0; } - int getHeight() const override + int getHeight() const override A_WARN_UNUSED { return mImage ? mImage->getHeight() : 0; } - const Image* getImage() const + const Image* getImage() const A_WARN_UNUSED { return mImage; } virtual bool setSpriteDirection(const SpriteDirection direction A_UNUSED) override { return false; } - int getNumberOfLayers() const + int getNumberOfLayers() const A_WARN_UNUSED { return 1; } - unsigned int getCurrentFrame() const override + unsigned int getCurrentFrame() const override A_WARN_UNUSED { return 0; } - unsigned int getFrameCount() const override + unsigned int getFrameCount() const override A_WARN_UNUSED { return 1; } bool updateNumber(const unsigned num A_UNUSED) override diff --git a/src/inputmanager.h b/src/inputmanager.h index b315ec00c..4f1733ae4 100644 --- a/src/inputmanager.h +++ b/src/inputmanager.h @@ -100,7 +100,7 @@ class InputManager final bool handleEvent(const SDL_Event &event); - bool checkKey(const KeyData *const key) const; + bool checkKey(const KeyData *const key) const A_WARN_UNUSED; void retrieve(); @@ -110,15 +110,15 @@ class InputManager final void makeDefault(const int i); - bool hasConflicts(int &key1, int &key2) const; + bool hasConflicts(int &key1, int &key2) const A_WARN_UNUSED; void callbackNewKey(); - KeyFunction &getKey(int index); + KeyFunction &getKey(int index) A_WARN_UNUSED; - std::string getKeyValueString(const int index) const; + std::string getKeyValueString(const int index) const A_WARN_UNUSED; - std::string getKeyStringLong(const int index) const; + std::string getKeyStringLong(const int index) const A_WARN_UNUSED; void addActionKey(const int action, const int type, const int val); @@ -126,7 +126,7 @@ class InputManager final void unassignKey(); - bool isActionActive(const int index) const; + bool isActionActive(const int index) const A_WARN_UNUSED; /** * Set the index of the new key to be assigned. @@ -143,7 +143,7 @@ class InputManager final /** * Get the index of the new key to be assigned. */ - int getNewKeyIndex() const + int getNewKeyIndex() const A_WARN_UNUSED { return mNewKeyIndex; } void updateKeyActionMap(KeyToActionMap &actionMap, @@ -158,13 +158,14 @@ class InputManager final bool triggerAction(const KeysVector *const ptrs); - int getKeyIndex(const int value, const int grp, const int type) const; + int getKeyIndex(const int value, const int grp, + const int type) const A_WARN_UNUSED; void update() const; void updateConditionMask(); - int getActionByKey(const SDL_Event &event) const; + int getActionByKey(const SDL_Event &event) const A_WARN_UNUSED; protected: Setup_Input *mSetupInput; /**< Reference to setup window */ diff --git a/src/inventory.h b/src/inventory.h index ff4ffa3d7..db9e94769 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -76,13 +76,13 @@ class Inventory final /** * Returns the size that this instance is configured for. */ - unsigned getSize() const + unsigned getSize() const A_WARN_UNUSED { return mSize; } /** * Returns the item at the specified index. */ - Item *getItem(const int index) const; + Item *getItem(const int index) const A_WARN_UNUSED; /** * Searches for the specified item by it's id. @@ -91,7 +91,8 @@ class Inventory final * @param color The color of the item to be searched. * @return Item found on success, NULL on failure. */ - Item *findItem(const int itemId, const unsigned char color) const; + Item *findItem(const int itemId, + const unsigned char color) const A_WARN_UNUSED; /** * Adds a new item in a free slot. @@ -119,12 +120,12 @@ class Inventory final /** * Checks if the given item is in the inventory. */ - bool contains(const Item *const item) const; + bool contains(const Item *const item) const A_WARN_UNUSED; /** * Returns id of next free slot or -1 if all occupied. */ - int getFreeSlot() const; + int getFreeSlot() const A_WARN_UNUSED; /** * Reset all item slots. @@ -134,28 +135,29 @@ class Inventory final /** * Get the number of slots filled with an item */ - int getNumberOfSlotsUsed() const + int getNumberOfSlotsUsed() const A_WARN_UNUSED { return mUsed; } /** * Returns the index of the last occupied slot or 0 if none occupied. */ - int getLastUsedSlot() const; + int getLastUsedSlot() const A_WARN_UNUSED; void addInventoyListener(InventoryListener *const listener); void removeInventoyListener(InventoryListener *const listener); - int getType() const + int getType() const A_WARN_UNUSED { return mType; } - bool isMainInventory() const + bool isMainInventory() const A_WARN_UNUSED { return mType == INVENTORY; } Item *findItemBySprite(std::string spritePath, - const Gender gender, const int race) const; + const Gender gender, + const int race) const A_WARN_UNUSED; - std::string getName() const; + std::string getName() const A_WARN_UNUSED; protected: typedef std::list<InventoryListener*> InventoryListenerList; diff --git a/src/item.h b/src/item.h index fd66681de..0fb715547 100644 --- a/src/item.h +++ b/src/item.h @@ -59,19 +59,19 @@ class Item /** * Returns the item id. */ - int getId() const + int getId() const A_WARN_UNUSED { return mId; } /** * Returns the item image. */ - Image *getImage() const + Image *getImage() const A_WARN_UNUSED { return mImage; } /** * Returns the item image. */ - Image *getDrawImage() const + Image *getDrawImage() const A_WARN_UNUSED { return mDrawImage; } /** @@ -89,7 +89,7 @@ class Item /** * Returns the number of items. */ - int getQuantity() const + int getQuantity() const A_WARN_UNUSED { return mQuantity; } /** @@ -101,7 +101,7 @@ class Item /** * Returns whether this item is considered equipment. */ - bool isEquipment() const + bool isEquipment() const A_WARN_UNUSED { return mEquipment; } /** @@ -113,7 +113,7 @@ class Item /** * Returns whether this item is equipped. */ - bool isEquipped() const + bool isEquipped() const A_WARN_UNUSED { return mEquipped; } /** @@ -125,7 +125,7 @@ class Item /** * Returns this item refine level. */ - int getRefine() const + int getRefine() const A_WARN_UNUSED { return mRefine; } /** @@ -137,7 +137,7 @@ class Item /** * Returns whether this item is in equipment. */ - bool isInEquipment() const + bool isInEquipment() const A_WARN_UNUSED { return mInEquipment; } /** @@ -149,25 +149,26 @@ class Item /** * Returns the inventory index of this item. */ - int getInvIndex() const + int getInvIndex() const A_WARN_UNUSED { return mInvIndex; } /** * Returns information about this item type. */ - const ItemInfo &getInfo() const + const ItemInfo &getInfo() const A_WARN_UNUSED { return ItemDB::get(mId); } - std::string getName(); + std::string getName() A_WARN_UNUSED; - static Image *getImage(const int id, const unsigned char color); + static Image *getImage(const int id, + const unsigned char color) A_WARN_UNUSED; - bool isHaveTag(const int tagId); + bool isHaveTag(const int tagId) A_WARN_UNUSED; - unsigned char getColor() const + unsigned char getColor() const A_WARN_UNUSED { return mColor; } - std::string &getDescription() + std::string &getDescription() A_WARN_UNUSED { return mDescription; } int mId; /**< Item type id. */ diff --git a/src/itemshortcut.h b/src/itemshortcut.h index 8b587cd59..bf24fa0d0 100644 --- a/src/itemshortcut.h +++ b/src/itemshortcut.h @@ -63,22 +63,22 @@ class ItemShortcut final * * @param index Index of the shortcut item. */ - int getItem(const int index) const + int getItem(const int index) const A_WARN_UNUSED { return mItems[index]; } - unsigned char getItemColor(const int index) const + unsigned char getItemColor(const int index) const A_WARN_UNUSED { return mItemColors[index]; } /** * Returns the amount of shortcut items. */ - int getItemCount() const + int getItemCount() const A_WARN_UNUSED { return SHORTCUT_ITEMS; } /** * Returns the item ID that is currently selected. */ - int getItemSelected() const + int getItemSelected() const A_WARN_UNUSED { return mItemSelected; } /** @@ -111,13 +111,13 @@ class ItemShortcut final /** * Returns selected shortcut item ID. */ - int getSelectedItem() const + int getSelectedItem() const A_WARN_UNUSED { return mItemSelected; } /** * A flag to check if the item is selected. */ - bool isItemSelected() const + bool isItemSelected() const A_WARN_UNUSED { return mItemSelected > -1; } /** diff --git a/src/joystick.h b/src/joystick.h index a3a609d2f..75e62fa33 100644 --- a/src/joystick.h +++ b/src/joystick.h @@ -60,7 +60,7 @@ class Joystick final /** * Returns the number of available joysticks. */ - static int getNumberOfJoysticks() + static int getNumberOfJoysticks() A_WARN_UNUSED { return joystickCount; } /** @@ -77,7 +77,7 @@ class Joystick final void close(); - bool isEnabled() const + bool isEnabled() const A_WARN_UNUSED { return mEnabled; } void setNumber(const int n); @@ -96,24 +96,24 @@ class Joystick final void finishCalibration(); - bool isCalibrating() const + bool isCalibrating() const A_WARN_UNUSED { return mCalibrating; } - bool buttonPressed(const unsigned char no) const; + bool buttonPressed(const unsigned char no) const A_WARN_UNUSED; - bool isUp() const + bool isUp() const A_WARN_UNUSED { return mEnabled && (mDirection & UP); } - bool isDown() const + bool isDown() const A_WARN_UNUSED { return mEnabled && (mDirection & DOWN); } - bool isLeft() const + bool isLeft() const A_WARN_UNUSED { return mEnabled && (mDirection & LEFT); } - bool isRight() const + bool isRight() const A_WARN_UNUSED { return mEnabled && (mDirection & RIGHT); } - int getNumber() const + int getNumber() const A_WARN_UNUSED { return mNumber; } void setUseInactive(const bool b) @@ -121,15 +121,15 @@ class Joystick final void update(); - KeysVector *getActionVector(const SDL_Event &event); + KeysVector *getActionVector(const SDL_Event &event) A_WARN_UNUSED; - KeysVector *getActionVectorByKey(const int i); + KeysVector *getActionVectorByKey(const int i) A_WARN_UNUSED; - int getButtonFromEvent(const SDL_Event &event) const; + int getButtonFromEvent(const SDL_Event &event) const A_WARN_UNUSED; - bool isActionActive(const int index) const; + bool isActionActive(const int index) const A_WARN_UNUSED; - bool validate() const; + bool validate() const A_WARN_UNUSED; void handleRepeat(const int time); diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index ee373911f..e101a65e0 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -51,13 +51,14 @@ class KeyboardConfig final /** * Get the enable flag, which will stop the user from doing actions. */ - bool isEnabled() const + bool isEnabled() const A_WARN_UNUSED { return mEnabled; } /** * Get the key function index by providing the keys value. */ - int getKeyIndex(const SDL_Event &event, const int grp = 1) const; + int getKeyIndex(const SDL_Event &event, + const int grp = 1) const A_WARN_UNUSED; /** * Set the enable flag, which will stop the user from doing actions. @@ -70,19 +71,20 @@ class KeyboardConfig final */ void refreshActiveKeys(); - std::string getKeyShortString(const std::string &key) const; + std::string getKeyShortString(const std::string &key) + const A_WARN_UNUSED; - SDLKey getKeyFromEvent(const SDL_Event &event) const; + SDLKey getKeyFromEvent(const SDL_Event &event) const A_WARN_UNUSED; - int getKeyValueFromEvent(const SDL_Event &event) const; + int getKeyValueFromEvent(const SDL_Event &event) const A_WARN_UNUSED; - KeysVector *getActionVector(const SDL_Event &event); + KeysVector *getActionVector(const SDL_Event &event) A_WARN_UNUSED; - KeysVector *getActionVectorByKey(const int i); + KeysVector *getActionVectorByKey(const int i) A_WARN_UNUSED; - std::string getKeyName(const int key) const; + std::string getKeyName(const int key) const A_WARN_UNUSED; - bool isActionActive(const int index) const; + bool isActionActive(const int index) const A_WARN_UNUSED; void update(); @@ -90,7 +92,7 @@ class KeyboardConfig final void handleDeActicateKey(const SDL_Event &event); - int getActionId(const SDL_Event &event); + int getActionId(const SDL_Event &event) A_WARN_UNUSED; void handleRepeat(const int time); diff --git a/src/keyevent.h b/src/keyevent.h index dd2235cea..01fe39f1e 100644 --- a/src/keyevent.h +++ b/src/keyevent.h @@ -46,7 +46,7 @@ class KeyEvent final : public gcn::KeyEvent virtual ~KeyEvent(); - int getActionId() const + int getActionId() const A_WARN_UNUSED { return mActionId; } protected: diff --git a/src/keyinput.h b/src/keyinput.h index ae57408de..25d77636d 100644 --- a/src/keyinput.h +++ b/src/keyinput.h @@ -37,7 +37,7 @@ class KeyInput final : public gcn::KeyInput void setActionId(const int n) { mActionId = n; } - int getActionId() const + int getActionId() const A_WARN_UNUSED { return mActionId; } protected: diff --git a/src/localconsts.h b/src/localconsts.h index 5bc4c6fb3..7db758697 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -44,8 +44,10 @@ #ifdef __GNUC__ #define A_UNUSED __attribute__ ((unused)) +#define A_WARN_UNUSED __attribute__ ((warn_unused_result)) #else #define A_UNUSED +#define A_WARN_UNUSED #define gnu_printf printf #endif #ifdef __clang__ diff --git a/src/localplayer.h b/src/localplayer.h index c5767aa76..b56aefb0a 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -94,7 +94,8 @@ class LocalPlayer final : public Being, * Compute the next pathnode location when walking using keyboard. * used by nextTile(). */ - Position getNextWalkPosition(const unsigned char dir) const; + Position getNextWalkPosition(const unsigned char dir) + const A_WARN_UNUSED; /** * Adds a new tile to the path when walking. @@ -110,7 +111,8 @@ class LocalPlayer final : public Being, /** * Check the player has permission to invite users to specific guild */ - bool checkInviteRights(const std::string &guildName) const; + bool checkInviteRights(const std::string &guildName) + const A_WARN_UNUSED; /** * Invite a player to join guild @@ -131,9 +133,9 @@ class LocalPlayer final : public Being, /** * Gets the attack range. */ - int getAttackRange() const; + int getAttackRange() const A_WARN_UNUSED; - int getAttackRange2() const; + int getAttackRange2() const A_WARN_UNUSED; void attack(Being *const target = nullptr, const bool keep = false, const bool dontChangeEquipment = false); @@ -143,7 +145,7 @@ class LocalPlayer final : public Being, void setGMLevel(const int level); - int getGMLevel() const + int getGMLevel() const A_WARN_UNUSED { return mGMLevel; } void stopAttack(const bool keepAttack = false); @@ -154,7 +156,7 @@ class LocalPlayer final : public Being, * Returns the current target of the player. Returns 0 if no being is * currently targeted. */ - Being *getTarget() const; + Being *getTarget() const A_WARN_UNUSED; /** * Sets the target being of the player. @@ -174,7 +176,7 @@ class LocalPlayer final : public Being, /** * Gets the walking direction */ - unsigned char getWalkingDir() const + unsigned char getWalkingDir() const A_WARN_UNUSED { return mWalkingDir; } /** @@ -187,7 +189,7 @@ class LocalPlayer final : public Being, */ bool withinAttackRange(const Being *const target, const bool fixDistance = false, - const int addRange = 0) const; + const int addRange = 0) const A_WARN_UNUSED; /** * Stops the player dead in his tracks @@ -207,24 +209,19 @@ class LocalPlayer final : public Being, const unsigned char color, const int floorItemId, const unsigned char fail); - int getLevel() const override; + int getLevel() const override A_WARN_UNUSED; - int getTargetTime(); - -// int getSkillPoints() const -// { return mSkillPoints; } - -// void setSkillPoints(int points); + int getTargetTime() A_WARN_UNUSED; /** Tells that the path has been set by mouse. */ void pathSetByMouse() { mPathSetByMouse = true; } /** Tells if the path has been set by mouse. */ - bool isPathSetByMouse() const + bool isPathSetByMouse() const A_WARN_UNUSED { return mPathSetByMouse; } - int getInvertDirection() const + int getInvertDirection() const A_WARN_UNUSED { return mInvertDirection; } void setInvertDirection(const int n) @@ -232,16 +229,16 @@ class LocalPlayer final : public Being, void invertDirection(); - int getAttackWeaponType() const + int getAttackWeaponType() const A_WARN_UNUSED { return mAttackWeaponType; } - int getAttackType() const + int getAttackType() const A_WARN_UNUSED { return mAttackType; } - int getFollowMode() const + int getFollowMode() const A_WARN_UNUSED { return mFollowMode; } - int getImitationMode() const + int getImitationMode() const A_WARN_UNUSED { return mImitationMode; } void changeAttackWeaponType(); @@ -254,20 +251,20 @@ class LocalPlayer final : public Being, void changePickUpType(); - int getCrazyMoveType() const + int getCrazyMoveType() const A_WARN_UNUSED { return mCrazyMoveType; } - int getPickUpType() const + int getPickUpType() const A_WARN_UNUSED { return mPickUpType; } - int getQuickDropCounter() const + int getQuickDropCounter() const A_WARN_UNUSED { return mQuickDropCounter; } void setQuickDropCounter(const int n); void changeQuickDropCounter(); - int getMoveState() const + int getMoveState() const A_WARN_UNUSED { return mMoveState; } void setMoveState(const int n) @@ -277,19 +274,19 @@ class LocalPlayer final : public Being, void switchPvpAttack(); - int getMagicAttackType() const + int getMagicAttackType() const A_WARN_UNUSED { return mMagicAttackType; } - int getPvpAttackType() const + int getPvpAttackType() const A_WARN_UNUSED { return mPvpAttackType; } - int getMoveToTargetType() const + int getMoveToTargetType() const A_WARN_UNUSED { return mMoveToTargetType; } - int getDisableGameModifiers() const + int getDisableGameModifiers() const A_WARN_UNUSED { return mDisableGameModifiers; } - int getPingTime() const + int getPingTime() const A_WARN_UNUSED { return mPingTime; } void tryPingRequest(); @@ -320,13 +317,11 @@ class LocalPlayer final : public Being, void debugMsg(std::string str) const; -// int getSkillLv(int id); - bool isReachable(const int x, const int y, - const int maxCost = 0) const; + const int maxCost = 0) const A_WARN_UNUSED; bool isReachable(Being *const being, - const int maxCost = 0); + const int maxCost = 0) A_WARN_UNUSED; void setHome(); @@ -340,16 +335,16 @@ class LocalPlayer final : public Being, void setPseudoAway(const std::string &message); - bool getAway() const + bool getAway() const A_WARN_UNUSED { return mAwayMode; } - bool getPseudoAway() const + bool getPseudoAway() const A_WARN_UNUSED { return mPseudoAwayMode; } void setHalfAway(const bool n) { mInactive = n; } - bool getHalfAway() const + bool getHalfAway() const A_WARN_UNUSED { return mInactive; } void afkRespond(ChatTab *const tab, const std::string &nick); @@ -376,13 +371,13 @@ class LocalPlayer final : public Being, void followMoveTo(const Being *const being, const int x1, const int y1, const int x2, const int y2); - bool allowAction(); + bool allowAction() A_WARN_UNUSED; - bool allowMove() const; + bool allowMove() const A_WARN_UNUSED; void setRealPos(const int x, const int y); - bool isServerBuggy() const + bool isServerBuggy() const A_WARN_UNUSED { return mIsServerBuggy; } void fixPos(const int maxDist = 1); @@ -418,16 +413,15 @@ class LocalPlayer final : public Being, */ void setNextDest(const int x, const int y); - - int getNextDestX() const + int getNextDestX() const A_WARN_UNUSED { return mNextDestX; } - int getNextDestY() const + int getNextDestY() const A_WARN_UNUSED { return mNextDestY; } void respawn(); - FloorItem *getPickUpTarget() const + FloorItem *getPickUpTarget() const A_WARN_UNUSED { return mPickUpTarget; } void unSetPickUpTarget() @@ -441,13 +435,13 @@ class LocalPlayer final : public Being, /** * Get the playername followed by the current player. */ - std::string getFollow() const + const std::string &getFollow() const A_WARN_UNUSED { return mPlayerFollowed; } /** * Get the playername imitated by the current player. */ - std::string getImitate() const + const std::string &getImitate() const A_WARN_UNUSED { return mPlayerImitated; } /** @@ -461,14 +455,14 @@ class LocalPlayer final : public Being, * Gets if the engine has to check * if the Player Name is to be displayed. */ - bool getCheckNameSetting() const + bool getCheckNameSetting() const A_WARN_UNUSED { return mUpdateName; } void fixAttackTarget(); void updateNavigateList(); - int getPathLength(const Being *const being); + int getPathLength(const Being *const being) A_WARN_UNUSED; void targetMoved() const; @@ -481,7 +475,7 @@ class LocalPlayer final : public Being, void resetYellowBar(); - virtual unsigned char getWalkMask() const override; + unsigned char getWalkMask() const override A_WARN_UNUSED; void saveHomes(); @@ -489,7 +483,8 @@ class LocalPlayer final : public Being, void stopAdvert(); - bool checAttackPermissions(const Being *const target) const; + bool checAttackPermissions(const Being *const target) + const A_WARN_UNUSED; void updateStatus() const; @@ -541,7 +536,7 @@ class LocalPlayer final : public Being, const char *getVarItem(const char *const *const arr, const unsigned index, - const unsigned sz) const; + const unsigned sz) const A_WARN_UNUSED; void changeMode(unsigned *const var, const unsigned limit, const char *const conf, @@ -208,12 +208,12 @@ class Map final : public Properties, public ConfigListener /** * Finds the tile set that a tile with the given global id is part of. */ - Tileset *getTilesetWithGid(const int gid) const; + Tileset *getTilesetWithGid(const int gid) const A_WARN_UNUSED; /** * Get tile reference. */ - MetaTile *getMetaTile(const int x, const int y) const; + MetaTile *getMetaTile(const int x, const int y) const A_WARN_UNUSED; /** * Marks a tile as occupied. @@ -226,58 +226,54 @@ class Map final : public Properties, public ConfigListener */ bool getWalk(const int x, const int y, const unsigned char walkmask = BLOCKMASK_WALL - | BLOCKMASK_AIR | BLOCKMASK_WATER) const; + | BLOCKMASK_AIR | BLOCKMASK_WATER) const A_WARN_UNUSED; void setWalk(const int x, const int y, const bool walkable); /** - * Tells whether a tile is occupied by a being. - */ -// bool occupied(const int x, const int y) const; - - /** * Returns the width of this map in tiles. */ - int getWidth() const + int getWidth() const A_WARN_UNUSED { return mWidth; } /** * Returns the height of this map in tiles. */ - int getHeight() const + int getHeight() const A_WARN_UNUSED { return mHeight; } /** * Returns the tile width of this map. */ - int getTileWidth() const + int getTileWidth() const A_WARN_UNUSED { return mTileWidth; } /** * Returns the tile height used by this map. */ - int getTileHeight() const + int getTileHeight() const A_WARN_UNUSED { return mTileHeight; } - const std::string getMusicFile() const; + const std::string getMusicFile() const A_WARN_UNUSED; - const std::string getName() const; + const std::string getName() const A_WARN_UNUSED; /** * Gives the map id based on filepath (ex: 009-1) */ - const std::string getFilename() const; + const std::string getFilename() const A_WARN_UNUSED; /** * Check the current position against surrounding blocking tiles, and * correct the position offset within tile when needed. */ Position checkNodeOffsets(int radius, const unsigned char walkMask, - const Position &position) const; + const Position &position) + const A_WARN_UNUSED; Position checkNodeOffsets(const int radius, const unsigned char walkMask, - const int x, const int y) const + const int x, const int y) const A_WARN_UNUSED { return checkNodeOffsets(radius, walkMask, Position(x, y)); } /** @@ -286,14 +282,15 @@ class Map final : public Properties, public ConfigListener Path findPixelPath(const int startPixelX, const int startPixelY, const int destPixelX, const int destPixelY, const int radius, const unsigned char walkmask, - const int maxCost = 20); + const int maxCost = 20) A_WARN_UNUSED; /** * Find a path from one location to the next. */ Path findPath(const int startX, const int startY, const int destX, const int destY, - const unsigned char walkmask, const int maxCost = 20); + const unsigned char walkmask, + const int maxCost = 20) A_WARN_UNUSED; /** * Adds a particle effect @@ -316,26 +313,26 @@ class Map final : public Properties, public ConfigListener void setDebugFlags(const int n) { mDebugFlags = n; } - int getDebugFlags() const + int getDebugFlags() const A_WARN_UNUSED { return mDebugFlags; } void addExtraLayer(); void saveExtraLayer() const; - SpecialLayer *getTempLayer() const + SpecialLayer *getTempLayer() const A_WARN_UNUSED { return mTempLayer; } - SpecialLayer *getSpecialLayer() const + SpecialLayer *getSpecialLayer() const A_WARN_UNUSED { return mSpecialLayer; } void setHasWarps(const bool n) { mHasWarps = n; } - bool getHasWarps() const + bool getHasWarps() const A_WARN_UNUSED { return mHasWarps; } - std::string getUserMapDirectory() const; + std::string getUserMapDirectory() const A_WARN_UNUSED; void addPortal(const std::string &name, const int type, const int x, const int y, const int dx, const int dy); @@ -350,28 +347,28 @@ class Map final : public Properties, public ConfigListener const int x, const int y, const bool addNew = true); - std::vector<MapItem*> &getPortals() + std::vector<MapItem*> &getPortals() A_WARN_UNUSED { return mMapPortals; } /** * Gets the tile animation for a specific gid */ - TileAnimation *getAnimationForGid(const int gid) const; + TileAnimation *getAnimationForGid(const int gid) const A_WARN_UNUSED; void optionChanged(const std::string &value) override; - MapItem *findPortalXY(const int x, const int y) const; + MapItem *findPortalXY(const int x, const int y) const A_WARN_UNUSED; - int getActorsCount() const + int getActorsCount() const A_WARN_UNUSED { return static_cast<int>(mActors.size()); } void setPvpMode(const int mode); - ObjectsLayer* getObjectsLayer() const + ObjectsLayer* getObjectsLayer() const A_WARN_UNUSED { return mObjects; } std::string getObjectData(const unsigned x, const unsigned y, - const int type) const; + const int type) const A_WARN_UNUSED; void indexTilesets(); @@ -380,7 +377,7 @@ class Map final : public Properties, public ConfigListener void setActorsFix(const int x, const int y) { mActorFixX = x; mActorFixY = y; } - int getVersion() const + int getVersion() const A_WARN_UNUSED { return mVersion; } void setVersion(const int n) @@ -390,16 +387,16 @@ class Map final : public Properties, public ConfigListener void redrawMap(); - bool empty() const + bool empty() const A_WARN_UNUSED { return mLayers.empty(); } void setCustom(const bool b) { mCustom = b; } - bool isCustom() const + bool isCustom() const A_WARN_UNUSED { return mCustom; } - std::map<int, TileAnimation*> &getTileAnimations() + std::map<int, TileAnimation*> &getTileAnimations() A_WARN_UNUSED { return mTileAnimations; } void setAtlas(Resource *const atlas) @@ -441,7 +438,7 @@ class Map final : public Properties, public ConfigListener /** * Tells whether the given coordinates fall within the map boundaries. */ - bool contains(const int x, const int y) const; + bool contains(const int x, const int y) const A_WARN_UNUSED; /** * Blockmasks for different entities diff --git a/src/maplayer.h b/src/maplayer.h index 134a7ac39..e7f9d866f 100644 --- a/src/maplayer.h +++ b/src/maplayer.h @@ -149,7 +149,7 @@ class MapLayer final: public ConfigListener const Actors *const actors, const int mDebugFlags, const int yFix) const; - bool isFringeLayer() const + bool isFringeLayer() const A_WARN_UNUSED { return mIsFringeLayer; } void setSpecialLayer(SpecialLayer *const val) @@ -158,22 +158,16 @@ class MapLayer final: public ConfigListener void setTempLayer(SpecialLayer *const val) { mTempLayer = val; } - int getWidth() const + int getWidth() const A_WARN_UNUSED { return mWidth; } - int getHeight() const + int getHeight() const A_WARN_UNUSED { return mHeight; } -// void setTileInfo(int x, int y, int width, int cnt); - -// void getTileInfo(int x, int y, int &width, int &cnt) const; - void optionChanged(const std::string &value) override; int getTileDrawWidth(const Image *img, - const int endX, int &width) const; - -// void initTileInfo(); + const int endX, int &width) const A_WARN_UNUSED; private: int mX, mY; @@ -206,7 +200,7 @@ class SpecialLayer final int endX, int endY, const int scrollX, const int scrollY) const; - MapItem* getTile(const int x, const int y) const; + MapItem* getTile(const int x, const int y) const A_WARN_UNUSED; void setTile(const int x, const int y, MapItem *const item); @@ -263,26 +257,26 @@ class MapItem final ~MapItem(); - int getType() const + int getType() const A_WARN_UNUSED { return mType; } void setType(const int type); void setPos(const int x, const int y); - int getX() const + int getX() const A_WARN_UNUSED { return mX; } - int getY() const + int getY() const A_WARN_UNUSED { return mY; } - const std::string &getComment() const + const std::string &getComment() const A_WARN_UNUSED { return mComment; } void setComment(std::string comment) { mComment = comment; } - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } void setName(std::string name) @@ -313,7 +307,8 @@ class ObjectsLayer final const unsigned x, const unsigned y, unsigned dx, unsigned dy); - MapObjectList *getAt(const unsigned x, const unsigned y) const; + MapObjectList *getAt(const unsigned x, + const unsigned y) const A_WARN_UNUSED; private: MapObjectList **mTiles; unsigned mWidth; diff --git a/src/mobileopenglgraphics.h b/src/mobileopenglgraphics.h index 350c21a59..4402904b7 100644 --- a/src/mobileopenglgraphics.h +++ b/src/mobileopenglgraphics.h @@ -144,7 +144,7 @@ class MobileOpenGLGraphics final : public Graphics /** * Takes a screenshot and returns it as SDL surface. */ - SDL_Surface *getScreenshot() override; + SDL_Surface *getScreenshot() override A_WARN_UNUSED; void prepareScreenshot() override; diff --git a/src/mumblemanager.h b/src/mumblemanager.h index f8e25974a..03878be80 100644 --- a/src/mumblemanager.h +++ b/src/mumblemanager.h @@ -58,7 +58,7 @@ class MumbleManager final void setServer(const std::string &serverName); private: - uint16_t getMapId(std::string mapName) const; + uint16_t getMapId(std::string mapName) const A_WARN_UNUSED; void setMapBase(uint16_t mapid); diff --git a/src/normalopenglgraphics.h b/src/normalopenglgraphics.h index 2e07de42f..4c9d9e417 100644 --- a/src/normalopenglgraphics.h +++ b/src/normalopenglgraphics.h @@ -152,14 +152,14 @@ class NormalOpenGLGraphics final : public Graphics /** * Takes a screenshot and returns it as SDL surface. */ - SDL_Surface *getScreenshot() override; + SDL_Surface *getScreenshot() override A_WARN_UNUSED; void prepareScreenshot() override; bool drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height) override; - int getMemoryUsage(); + int getMemoryUsage() A_WARN_UNUSED; void updateTextureFormat(); diff --git a/src/particle.h b/src/particle.h index 4dc419aea..9d510b9ae 100644 --- a/src/particle.h +++ b/src/particle.h @@ -113,13 +113,13 @@ class Particle : public Actor /** * Necessary for sorting with the other sprites. */ - virtual int getPixelY() const override + virtual int getPixelY() const override A_WARN_UNUSED { return static_cast<int>(mPos.y) - 16; } /** * Necessary for sorting with the other sprites for sorting only. */ - virtual int getSortPixelY() const override + virtual int getSortPixelY() const override A_WARN_UNUSED { return static_cast<int>(mPos.y) - 16; } /** @@ -230,7 +230,7 @@ class Particle : public Actor /** * Gets the flag if the particle is supposed to be moved by its parent */ - bool doesFollow() const + bool doesFollow() const A_WARN_UNUSED { return mFollow; } /** @@ -258,13 +258,13 @@ class Particle : public Actor void setAllowSizeAdjust(const bool adjust) { mAllowSizeAdjust = adjust; } - bool isAlive() const + bool isAlive() const A_WARN_UNUSED { return mAlive == ALIVE; } /** * Determines whether the particle and its children are all dead */ - bool isExtinct() const + bool isExtinct() const A_WARN_UNUSED { return !isAlive() && mChildParticles.empty(); } /** diff --git a/src/party.h b/src/party.h index 278097eed..e95aab543 100644 --- a/src/party.h +++ b/src/party.h @@ -37,10 +37,10 @@ class PartyMember final : public Avatar public: A_DELETE_COPY(PartyMember) - Party *getParty() const + Party *getParty() const A_WARN_UNUSED { return mParty; } - bool getLeader() const + bool getLeader() const A_WARN_UNUSED { return mLeader; } void setLeader(const bool leader) @@ -76,27 +76,27 @@ public: * * @return the member with the given ID, or NULL if they don't exist. */ - PartyMember *getMember(const int id) const; + PartyMember *getMember(const int id) const A_WARN_UNUSED; /** * Find a member by name. * * @return the member with the given name, or NULL if they don't exist. */ - PartyMember *getMember(const std::string &name) const; + PartyMember *getMember(const std::string &name) const A_WARN_UNUSED; /** * Get the name of the party. * @return returns name of the party */ - const std::string &getName() const + const std::string &getName() const A_WARN_UNUSED { return mName; } /** * Get the id of the party. * @return Returns the id of the party */ - short getId() const + short getId() const A_WARN_UNUSED { return mId; } /** @@ -123,7 +123,7 @@ public: * Get size of members list. * @return Returns the number of members in the party. */ - int getNumberOfElements() override + int getNumberOfElements() override A_WARN_UNUSED { return static_cast<int>(mMembers.size()); } Avatar *getAvatarAt(const int i) override; @@ -132,16 +132,16 @@ public: * Get whether user can invite users to this party. * @return Returns true if user can invite users */ - bool getInviteRights() const + bool getInviteRights() const A_WARN_UNUSED { return mCanInviteUsers; } void setRights(const short rights); - bool isMember(const PartyMember *const member) const; + bool isMember(const PartyMember *const member) const A_WARN_UNUSED; - bool isMember(const int id) const; + bool isMember(const int id) const A_WARN_UNUSED; - bool isMember(const std::string &name) const; + bool isMember(const std::string &name) const A_WARN_UNUSED; void getNames(StringVect &names) const; @@ -151,10 +151,10 @@ public: typedef std::vector<PartyMember*> MemberList; - MemberList *getMembers() + MemberList *getMembers() A_WARN_UNUSED { return &mMembers; } - static Party *getParty(const short id); + static Party *getParty(const short id) A_WARN_UNUSED; static void clearParties(); diff --git a/src/playerinfo.h b/src/playerinfo.h index ebfdba4c6..fcae0bd87 100644 --- a/src/playerinfo.h +++ b/src/playerinfo.h @@ -103,7 +103,7 @@ namespace PlayerInfo /** * Returns the value of the given attribute. */ - int getAttribute(const Attribute id); + int getAttribute(const Attribute id) A_WARN_UNUSED; /** * Changes the value of the given attribute. @@ -116,7 +116,7 @@ namespace PlayerInfo /** * Returns the base value of the given stat. */ - int getStatBase(const Attribute id); + int getStatBase(const Attribute id) A_WARN_UNUSED; /** * Changes the base value of the given stat. @@ -127,7 +127,7 @@ namespace PlayerInfo /** * Returns the modifier for the given stat. */ - int getStatMod(const Attribute id); + int getStatMod(const Attribute id) A_WARN_UNUSED; /** * Changes the modifier for the given stat. @@ -139,7 +139,7 @@ namespace PlayerInfo * Returns the current effective value of the given stat. Effective is base * + mod */ - int getStatEffective(const Attribute id); + int getStatEffective(const Attribute id) A_WARN_UNUSED; /** * Changes the level of the given stat. @@ -149,7 +149,7 @@ namespace PlayerInfo /** * Returns the experience of the given stat. */ - std::pair<int, int> getStatExperience(const Attribute id); + std::pair<int, int> getStatExperience(const Attribute id) A_WARN_UNUSED; /** * Changes the experience of the given stat. @@ -162,7 +162,7 @@ namespace PlayerInfo /** * Returns the player's inventory. */ - Inventory *getInventory(); + Inventory *getInventory() A_WARN_UNUSED; /** * Clears the player's inventory and equipment. @@ -178,12 +178,12 @@ namespace PlayerInfo /** * Returns the player's equipment. */ - Equipment *getEquipment(); + Equipment *getEquipment() A_WARN_UNUSED; /** * Returns the player's equipment at the given slot. */ - Item *getEquipment(const unsigned int slot); + Item *getEquipment(const unsigned int slot) A_WARN_UNUSED; // --- Specials --------------------------------------------------------------- diff --git a/src/playerrelations.h b/src/playerrelations.h index 5df8f8ded..363444f34 100644 --- a/src/playerrelations.h +++ b/src/playerrelations.h @@ -98,6 +98,7 @@ class PlayerRelationsListener { } virtual void updatedPlayer(const std::string &name) = 0; + virtual void updateAll() = 0; }; @@ -135,16 +136,19 @@ class PlayerRelationsManager final * the specified flags. */ unsigned int checkPermissionSilently(const std::string &player_name, - const unsigned int flags); + const unsigned int flags) + A_WARN_UNUSED; /** * Tests whether the player in question is being ignored for any of the * actions in the specified flags. If so, trigger appropriate side effects * if requested by the player. */ - bool hasPermission(const Being *const being, const unsigned int flags); + bool hasPermission(const Being *const being, + const unsigned int flags) A_WARN_UNUSED; - bool hasPermission(const std::string &being, const unsigned int flags); + bool hasPermission(const std::string &being, + const unsigned int flags) A_WARN_UNUSED; /** * Updates the relationship with this player. @@ -155,7 +159,8 @@ class PlayerRelationsManager final /** * Updates the relationship with this player. */ - PlayerRelation::Relation getRelation(const std::string &name); + PlayerRelation::Relation getRelation(const std::string &name) + A_WARN_UNUSED; /** * Deletes the information recorded for a player. @@ -165,7 +170,7 @@ class PlayerRelationsManager final /** * Retrieves the default permissions. */ - unsigned int getDefault() const; + unsigned int getDefault() const A_WARN_UNUSED; /** * Sets the default permissions. @@ -178,14 +183,15 @@ class PlayerRelationsManager final * The player ignore strategies are allocated statically and must * not be deleted. */ - std::vector<PlayerIgnoreStrategy *> *getPlayerIgnoreStrategies(); + std::vector<PlayerIgnoreStrategy *> *getPlayerIgnoreStrategies() + A_WARN_UNUSED; /** * Return the current player ignore strategy. * * \return A player ignore strategy, or nullptr */ - PlayerIgnoreStrategy *getPlayerIgnoreStrategy() const + PlayerIgnoreStrategy *getPlayerIgnoreStrategy() const A_WARN_UNUSED { return mIgnoreStrategy; } /** @@ -201,15 +207,17 @@ class PlayerRelationsManager final * \param The short name of the ignore strategy to look up * \return The appropriate index, or -1 */ - int getPlayerIgnoreStrategyIndex(const std::string &shortname); + int getPlayerIgnoreStrategyIndex(const std::string &shortname) + A_WARN_UNUSED; /** * Retrieves a sorted vector of all players for which we have any * relations recorded. */ - StringVect *getPlayers(); + StringVect *getPlayers() A_WARN_UNUSED; - StringVect *getPlayersByRelation(const PlayerRelation::Relation rel); + StringVect *getPlayersByRelation(const PlayerRelation::Relation rel) + A_WARN_UNUSED; /** * Removes all recorded player info. @@ -224,9 +232,9 @@ class PlayerRelationsManager final void ignoreTrade(std::string name); - bool isGoodName(Being *const being); + bool isGoodName(Being *const being) A_WARN_UNUSED; - bool isGoodName(std::string name); + bool isGoodName(std::string name) A_WARN_UNUSED; /** * Change the `ignore persist' flag. @@ -242,7 +250,7 @@ class PlayerRelationsManager final void removeListener(PlayerRelationsListener *const listener) { mListeners.remove(listener); } - bool checkBadRelation(std::string name); + bool checkBadRelation(std::string name) A_WARN_UNUSED; private: void signalUpdate(const std::string &name); @@ -251,7 +259,7 @@ class PlayerRelationsManager final // ignored data upon reloading unsigned int mDefaultPermissions; - bool checkName(const std::string &name) const; + bool checkName(const std::string &name) const A_WARN_UNUSED; PlayerIgnoreStrategy *mIgnoreStrategy; std::map<std::string, PlayerRelation *> mRelations; diff --git a/src/properties.h b/src/properties.h index 63dcd9afc..82664c600 100644 --- a/src/properties.h +++ b/src/properties.h @@ -48,7 +48,8 @@ class Properties * doesn't exist. */ const std::string getProperty(const std::string &name, - const std::string &def = "") const + const std::string &def = "") + const A_WARN_UNUSED { const PropertyMap::const_iterator i = mProperties.find(name); return (i != mProperties.end()) ? i->second : def; @@ -63,7 +64,7 @@ class Properties * doesn't exist. */ float getFloatProperty(const std::string &name, - const float def = 0.0f) const + const float def = 0.0f) const A_WARN_UNUSED { const PropertyMap::const_iterator i = mProperties.find(name); float ret = def; @@ -85,7 +86,7 @@ class Properties * doesn't exist. */ bool getBoolProperty(const std::string &name, - const bool def = false) const + const bool def = false) const A_WARN_UNUSED { const PropertyMap::const_iterator i = mProperties.find(name); bool ret = def; @@ -106,7 +107,7 @@ class Properties * @return <code>true</code> when a property is defined, * <code>false</code> otherwise. */ - bool hasProperty(const std::string &name) const + bool hasProperty(const std::string &name) const A_WARN_UNUSED { return (mProperties.find(name) != mProperties.end()); } /** diff --git a/src/safeopenglgraphics.h b/src/safeopenglgraphics.h index e0f2d390a..b377874ad 100644 --- a/src/safeopenglgraphics.h +++ b/src/safeopenglgraphics.h @@ -131,7 +131,7 @@ class SafeOpenGLGraphics final : public Graphics /** * Takes a screenshot and returns it as SDL surface. */ - SDL_Surface *getScreenshot() override; + SDL_Surface *getScreenshot() override A_WARN_UNUSED; void prepareScreenshot() override; diff --git a/src/shopitem.h b/src/shopitem.h index f42f9ca9c..decaa3ad0 100644 --- a/src/shopitem.h +++ b/src/shopitem.h @@ -86,7 +86,7 @@ class ShopItem final : public Item * * @return the quantity of the currently topmost duplicate */ - int getCurrentQuantity() const + int getCurrentQuantity() const A_WARN_UNUSED { return mDuplicates.empty() ? 0 : mDuplicates.top()->quantity; } @@ -96,7 +96,7 @@ class ShopItem final : public Item * * @return the inventory index of the currently topmost duplicate */ - int getCurrentInvIndex() const + int getCurrentInvIndex() const A_WARN_UNUSED { return mDuplicates.empty() ? mInvIndex : mDuplicates.top()->inventoryIndex; @@ -120,7 +120,7 @@ class ShopItem final : public Item * * @return the price of the item */ - int getPrice() const + int getPrice() const A_WARN_UNUSED { return mPrice; } /** @@ -128,7 +128,7 @@ class ShopItem final : public Item * * @return the display name for the item in the shop list */ - const std::string &getDisplayName() const + const std::string &getDisplayName() const A_WARN_UNUSED { return mDisplayName; } protected: diff --git a/src/simpleanimation.h b/src/simpleanimation.h index 8a68f478f..4d10f3fee 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -58,7 +58,7 @@ class SimpleAnimation final void setFrame(int frame); - int getLength() const; + int getLength() const A_WARN_UNUSED; bool update(const int timePassed); @@ -70,7 +70,7 @@ class SimpleAnimation final */ void reset(); - Image *getCurrentImage() const; + Image *getCurrentImage() const A_WARN_UNUSED; private: void initializeAnimation(const XmlNodePtr animationNode, diff --git a/src/sound.h b/src/sound.h index eb81bf028..7aba7e7be 100644 --- a/src/sound.h +++ b/src/sound.h @@ -105,7 +105,7 @@ class Sound final : public ConfigListener void fadeOutAndPlayMusic(const std::string &fileName, const int ms = 1000); - int getMaxVolume() const + int getMaxVolume() const A_WARN_UNUSED { return MIX_MAX_VOLUME; } void setMusicVolume(const int volume); @@ -135,7 +135,7 @@ class Sound final : public ConfigListener void volumeRestore(); - std::string getCurrentMusicFile() const + std::string getCurrentMusicFile() const A_WARN_UNUSED { return mCurrentMusicFile; } /** diff --git a/src/spellmanager.h b/src/spellmanager.h index d232c4408..e3c580913 100644 --- a/src/spellmanager.h +++ b/src/spellmanager.h @@ -42,15 +42,15 @@ class SpellManager final ~SpellManager(); - TextCommand *getSpell(const int spellId); + TextCommand *getSpell(const int spellId) A_WARN_UNUSED; - TextCommand* getSpellByItem(const int itemId); + TextCommand* getSpellByItem(const int itemId) A_WARN_UNUSED; bool addSpell(TextCommand *const spell); - TextCommand *createNewSpell() const; + TextCommand *createNewSpell() const A_WARN_UNUSED; - std::vector<TextCommand*> getAll() const; + std::vector<TextCommand*> getAll() const A_WARN_UNUSED; void useItem(const int itemId); @@ -60,7 +60,7 @@ class SpellManager final void save(); - std::string autoComplete(std::string partName); + std::string autoComplete(std::string partName) A_WARN_UNUSED; private: void fillSpells(); @@ -71,7 +71,8 @@ class SpellManager final void invokeSpell(const TextCommand *const spell) const; std::string parseCommand(std::string command, - const Being *const target) const; + const Being *const target) + const A_WARN_UNUSED; std::map<unsigned int, TextCommand*> mSpells; std::vector<TextCommand*> mSpellsVector; diff --git a/src/spellshortcut.h b/src/spellshortcut.h index d4c77023b..5c86e6b96 100644 --- a/src/spellshortcut.h +++ b/src/spellshortcut.h @@ -50,7 +50,7 @@ class SpellShortcut final */ void load(); - unsigned int getSpellsCount() const; + unsigned int getSpellsCount() const A_WARN_UNUSED; /** * Set the item that is selected. @@ -63,13 +63,13 @@ class SpellShortcut final /** * A flag to check if the item is selected. */ - bool isItemSelected() const + bool isItemSelected() const A_WARN_UNUSED { return mItemSelected > -1; } /** * Returns selected shortcut item ID. */ - int getSelectedItem() const + int getSelectedItem() const A_WARN_UNUSED { return mItemSelected; } /** diff --git a/src/sprite.h b/src/sprite.h index 2d7b7c0a6..8c6c2b559 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -66,17 +66,17 @@ class Sprite /** * Gets the width in pixels of the image of the current frame */ - virtual int getWidth() const = 0; + virtual int getWidth() const A_WARN_UNUSED = 0; /** * Gets the height in pixels of the image of the current frame */ - virtual int getHeight() const = 0; + virtual int getHeight() const A_WARN_UNUSED = 0; /** * Returns a reference to the current image being drawn. */ - virtual const Image* getImage() const = 0; + virtual const Image* getImage() const A_WARN_UNUSED = 0; /** * Sets the direction. @@ -94,23 +94,23 @@ class Sprite /** * Returns the current alpha opacity of the animated sprite. */ - virtual float getAlpha() const + virtual float getAlpha() const A_WARN_UNUSED { return mAlpha; } /** * Returns the current frame number for the sprite. */ - virtual unsigned int getCurrentFrame() const = 0; + virtual unsigned int getCurrentFrame() const A_WARN_UNUSED = 0; /** * Returns the frame count for the sprite. */ - virtual unsigned int getFrameCount() const = 0; + virtual unsigned int getFrameCount() const A_WARN_UNUSED = 0; - virtual void *getHash() + virtual void *getHash() A_WARN_UNUSED { return nullptr; } - virtual void *getHash2() + virtual void *getHash2() A_WARN_UNUSED { return this; } virtual bool updateNumber(const unsigned num) = 0; diff --git a/src/statuseffect.h b/src/statuseffect.h index 1d36ed6cd..e807fe5f3 100644 --- a/src/statuseffect.h +++ b/src/statuseffect.h @@ -52,23 +52,23 @@ public: * Creates the particle effect associated with this status effect, if * possible. */ - Particle *getParticle() const; + Particle *getParticle() const A_WARN_UNUSED; /** * Retrieves the status icon for this effect, if applicable */ - AnimatedSprite *getIcon() const; + AnimatedSprite *getIcon() const A_WARN_UNUSED; /** * Retrieves an action to perform, or SpriteAction::INVALID */ - std::string getAction() const; + std::string getAction() const A_WARN_UNUSED; /** * Determines whether the particle effect should be restarted when the * being changes maps */ - bool particleEffectIsPersistent() const + bool particleEffectIsPersistent() const A_WARN_UNUSED { return mPersistentParticleEffect; } @@ -79,7 +79,8 @@ public: * \param enabling Whether to retrieve the activating effect (true) or * the deactivating effect (false). */ - static StatusEffect *getStatusEffect(const int index, const bool enabling); + static StatusEffect *getStatusEffect(const int index, + const bool enabling) A_WARN_UNUSED; /** * Retrieves a stun effect. @@ -88,7 +89,7 @@ public: * \param enabling Whether to retrieve the activating effect (true) or * the deactivating effect (false). */ - static StatusEffect *getStunEffect(int index, bool enabling); + static StatusEffect *getStunEffect(int index, bool enabling) A_WARN_UNUSED; /** * Maps a block effect index to its corresponding effect index. Block @@ -97,7 +98,8 @@ public: * * Returns -1 on failure. */ - static int blockEffectIndexToEffectIndex(const int blocKIndex); + static int blockEffectIndexToEffectIndex(const int blocKIndex) + A_WARN_UNUSED; static void load(); diff --git a/src/text.h b/src/text.h index 115713eef..f42c564a9 100644 --- a/src/text.h +++ b/src/text.h @@ -53,10 +53,10 @@ class Text void setColor(const gcn::Color *const color); - int getWidth() const + int getWidth() const A_WARN_UNUSED { return mWidth; } - int getHeight() const + int getHeight() const A_WARN_UNUSED { return mHeight; } /** diff --git a/src/textcommand.h b/src/textcommand.h index acf443588..5aa8176ec 100644 --- a/src/textcommand.h +++ b/src/textcommand.h @@ -89,37 +89,37 @@ class TextCommand final */ ~TextCommand(); - std::string getName() const + std::string getName() const A_WARN_UNUSED { return mCommand; } - std::string getCommand() const + std::string getCommand() const A_WARN_UNUSED { return mCommand; } - std::string getComment() const + std::string getComment() const A_WARN_UNUSED { return mComment; } - std::string getSymbol() const + std::string getSymbol() const A_WARN_UNUSED { return mSymbol; } - unsigned int getId() const + unsigned int getId() const A_WARN_UNUSED { return mId; } - SpellTarget getTargetType() const + SpellTarget getTargetType() const A_WARN_UNUSED { return mTargetType; } - std::string getIcon() const + std::string getIcon() const A_WARN_UNUSED { return mIcon; } - int getMana() const + int getMana() const A_WARN_UNUSED { return mMana; } - MagicSchool getSchool() const + MagicSchool getSchool() const A_WARN_UNUSED { return mSchool; } - unsigned getBaseLvl() const + unsigned getBaseLvl() const A_WARN_UNUSED { return mBaseLvl; } - unsigned getSchoolLvl() const + unsigned getSchoolLvl() const A_WARN_UNUSED { return mSchoolLvl; } TextCommandType getCommandType() const @@ -158,10 +158,10 @@ class TextCommand final void setCommandType(const TextCommandType commandType) { mCommandType = commandType; } - bool isEmpty() const + bool isEmpty() const A_WARN_UNUSED { return mCommand == "" && mSymbol == ""; } - Image *getImage() const + Image *getImage() const A_WARN_UNUSED { return mImage; } private: diff --git a/src/textparticle.h b/src/textparticle.h index 1b19c62be..a9f1a86ad 100644 --- a/src/textparticle.h +++ b/src/textparticle.h @@ -44,11 +44,11 @@ class TextParticle final : public Particle int offsetX, int offsetY) const override; // hack to improve text visibility - virtual int getPixelY() const override + virtual int getPixelY() const override A_WARN_UNUSED { return static_cast<int>(mPos.y + mPos.z); } // hack to improve text visibility (for sorting only) - virtual int getSortPixelY() const override + virtual int getSortPixelY() const override A_WARN_UNUSED { return static_cast<int>(mPos.y + mPos.z); } private: diff --git a/src/tileset.h b/src/tileset.h index 0bd2c48f2..f88c3ee4d 100644 --- a/src/tileset.h +++ b/src/tileset.h @@ -48,7 +48,7 @@ class Tileset final : public ImageSet /** * Returns the first gid. */ - int getFirstGid() const + int getFirstGid() const A_WARN_UNUSED { return mFirstGid; } /** @@ -60,7 +60,7 @@ class Tileset final : public ImageSet /** * Returns property value. */ - std::string getProperty(std::string name) + std::string getProperty(std::string name) A_WARN_UNUSED { const std::map<std::string, std::string>::const_iterator it = mProperties.find(name); diff --git a/src/units.h b/src/units.h index e40c1aa6f..0665bf992 100644 --- a/src/units.h +++ b/src/units.h @@ -40,12 +40,12 @@ class Units final /** * Formats the given number in the correct currency format. */ - static std::string formatCurrency(const int value); + static std::string formatCurrency(const int value) A_WARN_UNUSED; /** * Formats the given number in the correct weight/mass format. */ - static std::string formatWeight(const int value); + static std::string formatWeight(const int value) A_WARN_UNUSED; }; #endif // UNITS_H diff --git a/src/utils/langs.h b/src/utils/langs.h index 5cde62927..38fa2c8e1 100644 --- a/src/utils/langs.h +++ b/src/utils/langs.h @@ -27,13 +27,15 @@ #include <set> #include <vector> +#include "localconsts.h" + typedef std::vector<std::string> LangVect; typedef LangVect::const_iterator LangIter; -LangVect getLang(); +LangVect getLang() A_WARN_UNUSED; -std::string getLangSimple(); +std::string getLangSimple() A_WARN_UNUSED; -std::string getLangShort(); +std::string getLangShort() A_WARN_UNUSED; #endif // UTILS_LANGS_H diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index aa6dcecea..1fc55e859 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -27,6 +27,8 @@ #include <stdint.h> #include <cstring> +#include "localconsts.h" + static const uint16_t crc_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, @@ -63,6 +65,14 @@ static const uint16_t crc_table[256] = 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; +inline uint16_t getCrc16(const std::string &str) A_WARN_UNUSED; +inline float fastInvSqrt(float x) A_WARN_UNUSED; +inline float fastSqrt(const float x) A_WARN_UNUSED; +inline float weightedAverage(const float n1, const float n2, + const float w) A_WARN_UNUSED; +inline int roundDouble(const double v) A_WARN_UNUSED; +inline int powerOfTwo(const int input) A_WARN_UNUSED; + inline uint16_t getCrc16(const std::string &str) { size_t f = str.size(); diff --git a/src/utils/paths.h b/src/utils/paths.h index 05b4fef07..82e7c6a17 100644 --- a/src/utils/paths.h +++ b/src/utils/paths.h @@ -23,18 +23,20 @@ #include <string> -std::string getRealPath(const std::string &str); +#include "localconsts.h" -bool isRealPath(const std::string &str); +std::string getRealPath(const std::string &str) A_WARN_UNUSED; -bool checkPath(std::string path); +bool isRealPath(const std::string &str) A_WARN_UNUSED; + +bool checkPath(std::string path) A_WARN_UNUSED; std::string &fixDirSeparators(std::string &str); -std::string removeLast(std::string str); +std::string removeLast(std::string str) A_WARN_UNUSED; -std::string getSelfName(); +std::string getSelfName() A_WARN_UNUSED; -std::string getDesktopDir(); +std::string getDesktopDir() A_WARN_UNUSED; #endif // UTILS_PATHS_H diff --git a/src/utils/physfsrwops.h b/src/utils/physfsrwops.h index 1f52f40aa..f6d335390 100644 --- a/src/utils/physfsrwops.h +++ b/src/utils/physfsrwops.h @@ -28,6 +28,8 @@ #include <physfs.h> #include <SDL.h> +#include "localconsts.h" + /** * Open a platform-independent filename for reading, and make it accessible * via an SDL_RWops structure. The file will be closed in PhysicsFS when the @@ -38,7 +40,7 @@ * @return A valid SDL_RWops structure on success, NULL on error. Specifics * of the error can be gleaned from PHYSFS_getLastError(). */ -SDL_RWops *PHYSFSRWOPS_openRead(const char *fname); +SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) A_WARN_UNUSED; /** * Open a platform-independent filename for writing, and make it accessible @@ -50,7 +52,7 @@ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname); * @return A valid SDL_RWops structure on success, NULL on error. Specifics * of the error can be gleaned from PHYSFS_getLastError(). */ -SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname); +SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) A_WARN_UNUSED; /** * Open a platform-independent filename for appending, and make it accessible @@ -62,7 +64,7 @@ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname); * @return A valid SDL_RWops structure on success, NULL on error. Specifics * of the error can be gleaned from PHYSFS_getLastError(). */ -SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname); +SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname) A_WARN_UNUSED; /** * Make a SDL_RWops from an existing PhysicsFS file handle. You should @@ -74,7 +76,7 @@ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname); * @return A valid SDL_RWops structure on success, NULL on error. Specifics * of the error can be gleaned from PHYSFS_getLastError(). */ -SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle); +SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle) A_WARN_UNUSED; #endif /* include-once blocker */ diff --git a/src/utils/sha256.h b/src/utils/sha256.h index 54bb92f3c..a2a852614 100644 --- a/src/utils/sha256.h +++ b/src/utils/sha256.h @@ -25,12 +25,14 @@ #include <string> +#include "localconsts.h" + /** * Returns the SHA-256 hash for the given string. * * @param string the string to create the SHA-256 hash for * @return the SHA-256 hash for the given string. */ -std::string sha256(const std::string &string); +std::string sha256(const std::string &string) A_WARN_UNUSED; #endif // UTILS_SHA256_H diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h index 8eb00a637..f8de79ebe 100644 --- a/src/utils/specialfolder.h +++ b/src/utils/specialfolder.h @@ -25,7 +25,9 @@ #ifdef WIN32 #include <shlobj.h> #include <string> -std::string getSpecialFolderLocation(int folderId); + +#include "localconsts.h" +std::string getSpecialFolderLocation(int folderId) A_WARN_UNUSED; #endif #endif diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 2b10b7631..cef7a9ccf 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -62,9 +62,9 @@ std::string &toUpper(std::string &str); * @param str the hex string to convert to an int * @return the integer representation of the hex string */ -unsigned int atox(const std::string &str); +unsigned int atox(const std::string &str) A_WARN_UNUSED; -template<typename T> std::string toString(const T &arg); +template<typename T> std::string toString(const T &arg) A_WARN_UNUSED; /** * Converts the given value to a string using std::stringstream. @@ -88,12 +88,12 @@ template<typename T> std::string toString(const T &arg) * @param address the address to convert to a string * @return the string representation of the address */ -const char *ipToString(const int address); +const char *ipToString(const int address) A_WARN_UNUSED; /** * A safe version of sprintf that returns a std::string of the result. */ -std::string strprintf(const char *const format, ...) +std::string strprintf(const char *const format, ...) A_WARN_UNUSED #ifdef __GNUC__ /* This attribute is nice: it even works through gettext invokation. For example, gcc will complain that strprintf(_("%s"), 42) is ill-formed. */ @@ -115,7 +115,7 @@ std::string strprintf(const char *const format, ...) * @param msg the string to remove the colors from * @return string without colors */ -std::string removeColors(std::string msg); +std::string removeColors(std::string msg) A_WARN_UNUSED; const std::string findSameSubstring(const std::string &str1, const std::string &str2); @@ -131,32 +131,33 @@ const std::string findSameSubstringI(const std::string &str1, * @return 0 if the strings are equal, positive if the first is greater, * negative if the second is greater */ -int compareStrI(const std::string &a, const std::string &b); +int compareStrI(const std::string &a, const std::string &b) A_WARN_UNUSED; /** * Tells wether the character is a word separator. */ -bool isWordSeparator(const signed char chr); +bool isWordSeparator(const signed char chr) A_WARN_UNUSED; -size_t findI(std::string str, std::string subStr); +size_t findI(std::string str, std::string subStr) A_WARN_UNUSED; -size_t findI(std::string text, StringVect &list); +size_t findI(std::string text, StringVect &list) A_WARN_UNUSED; -const std::string encodeStr(unsigned int value, const unsigned int size = 0); +const std::string encodeStr(unsigned int value, + const unsigned int size = 0) A_WARN_UNUSED; -unsigned int decodeStr(const std::string &str); +unsigned int decodeStr(const std::string &str) A_WARN_UNUSED; -std::string extractNameFromSprite(std::string str); +std::string extractNameFromSprite(std::string str) A_WARN_UNUSED; -std::string removeSpriteIndex(std::string str); +std::string removeSpriteIndex(std::string str) A_WARN_UNUSED; -const char* getSafeUtf8String(std::string text); +const char* getSafeUtf8String(std::string text) A_WARN_UNUSED; void getSafeUtf8String(std::string text, char *const buf); -std::string getFileName(std::string path); +std::string getFileName(std::string path) A_WARN_UNUSED; -std::string getFileDir(std::string path); +std::string getFileDir(std::string path) A_WARN_UNUSED; std::string& replaceAll(std::string& context, const std::string& from, const std::string& to); @@ -167,23 +168,23 @@ std::string& replaceAll(std::string& context, const std::string& from, * @param text the string used to get the bool value * @return a boolean value.. */ -bool getBoolFromString(const std::string &text); +bool getBoolFromString(const std::string &text) A_WARN_UNUSED; void replaceSpecialChars(std::string &text); /** * Normalize a string, which means lowercase and trim it. */ -std::string normalize(const std::string &name); +std::string normalize(const std::string &name) A_WARN_UNUSED; std::set<int> splitToIntSet(const std::string &text, - const char separator); + const char separator) A_WARN_UNUSED; std::list<int> splitToIntList(const std::string &text, - const char separator); + const char separator) A_WARN_UNUSED; std::list<std::string> splitToStringList(const std::string &text, - const char separator); + const char separator) A_WARN_UNUSED; void splitToStringVector(StringVect &tokens, const std::string &text, const char separator); @@ -194,30 +195,30 @@ void splitToStringSet(std::set<std::string> &tokens, void splitToIntVector(std::vector<int> &tokens, const std::string &text, const char separator); -std::string combineDye(std::string file, std::string dye); +std::string combineDye(std::string file, std::string dye) A_WARN_UNUSED; -std::string combineDye2(std::string file, std::string dye); +std::string combineDye2(std::string file, std::string dye) A_WARN_UNUSED; -std::string packList(std::list<std::string> &list); +std::string packList(std::list<std::string> &list) A_WARN_UNUSED; -std::list<std::string> unpackList(const std::string &str); +std::list<std::string> unpackList(const std::string &str) A_WARN_UNUSED; -std::string stringToHexPath(const std::string &str); +std::string stringToHexPath(const std::string &str) A_WARN_UNUSED; void deleteCharLeft(std::string &str, unsigned *const pos); -bool findLast(const std::string &str1, const std::string &str2); +bool findLast(const std::string &str1, const std::string &str2) A_WARN_UNUSED; -bool findFirst(const std::string &str1, const std::string &str2); +bool findFirst(const std::string &str1, const std::string &str2) A_WARN_UNUSED; -bool findCutLast(std::string &str1, std::string str2); +bool findCutLast(std::string &str1, std::string str2) A_WARN_UNUSED; -bool findCutFirst(std::string &str1, std::string str2); +bool findCutFirst(std::string &str1, std::string str2) A_WARN_UNUSED; std::string &removeProtocol(std::string &url); -bool strStartWith(std::string str, std::string start); +bool strStartWith(std::string str, std::string start) A_WARN_UNUSED; -std::string getDateString(); +std::string getDateString() A_WARN_UNUSED; #endif // UTILS_STRINGUTILS_H diff --git a/src/utils/xml.h b/src/utils/xml.h index cba9e0a0e..ee010dde0 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -87,7 +87,7 @@ namespace XML * Returns the root node of the document (or NULL if there was a * load error). */ - XmlNodePtr rootNode(); + XmlNodePtr rootNode() A_WARN_UNUSED; private: xmlDocPtr mDoc; @@ -97,42 +97,43 @@ namespace XML * Gets an floating point property from an XmlNodePtr. */ double getFloatProperty(const XmlNodePtr node, const char *const name, - double def); + double def) A_WARN_UNUSED; /** * Gets an integer property from an XmlNodePtr. */ - int getProperty(const XmlNodePtr node, const char *const name, int def); + int getProperty(const XmlNodePtr node, const char *const name, + int def) A_WARN_UNUSED; /** * Gets an integer property from an XmlNodePtr. */ int getIntProperty(const XmlNodePtr node, const char *const name, int def, - const int min, const int max); + const int min, const int max) A_WARN_UNUSED; /** * Gets a string property from an XmlNodePtr. */ std::string getProperty(const XmlNodePtr node, const char *const name, - const std::string &def); + const std::string &def) A_WARN_UNUSED; /** * Gets a translated string property from an XmlNodePtr. */ std::string langProperty(const XmlNodePtr node, const char *const name, - const std::string &def); + const std::string &def) A_WARN_UNUSED; /** * Gets a boolean property from an XmlNodePtr. */ bool getBoolProperty(const XmlNodePtr node, const char *const name, - const bool def); + const bool def) A_WARN_UNUSED; /** * Finds the first child node with the given name */ XmlNodePtr findFirstChildByName(const XmlNodePtr parent, - const char *const name); + const char *const name) A_WARN_UNUSED; void initXML(); diff --git a/src/variabledata.h b/src/variabledata.h index 483eab951..625c077e7 100644 --- a/src/variabledata.h +++ b/src/variabledata.h @@ -41,7 +41,7 @@ class VariableData virtual ~VariableData() {}; - virtual int getType() const = 0; + virtual int getType() const A_WARN_UNUSED = 0; }; class IntData final : public VariableData @@ -51,10 +51,10 @@ class IntData final : public VariableData mData(value) { } - int getData() const + int getData() const A_WARN_UNUSED { return mData; } - int getType() const override + int getType() const override A_WARN_UNUSED { return DATA_INT; } private: @@ -68,10 +68,10 @@ class StringData final : public VariableData mData(value) { } - const std::string &getData() const + const std::string &getData() const A_WARN_UNUSED { return mData; } - int getType() const override + int getType() const override A_WARN_UNUSED { return DATA_STRING; } private: @@ -85,10 +85,10 @@ class FloatData final : public VariableData mData(value) { } - double getData() const + double getData() const A_WARN_UNUSED { return mData; } - int getType() const override + int getType() const override A_WARN_UNUSED { return DATA_FLOAT; } private: @@ -102,10 +102,10 @@ class BoolData final : public VariableData mData(value) { } - bool getData() const + bool getData() const A_WARN_UNUSED { return mData; } - int getType() const override + int getType() const override A_WARN_UNUSED { return DATA_BOOL; } private: diff --git a/src/vector.h b/src/vector.h index 587344f39..1e8caec00 100644 --- a/src/vector.h +++ b/src/vector.h @@ -67,7 +67,7 @@ class Vector final * Returns true if all coordinates are set to 0, otherwise returns * false. */ - bool isNull() const + bool isNull() const A_WARN_UNUSED { return x == 0.0f && y == 0.0f && z == 0.0f; } @@ -75,7 +75,7 @@ class Vector final /** * Scale vector operator. */ - Vector operator*(const float c) const + Vector operator*(const float c) const A_WARN_UNUSED { return Vector(x * c, y * c, @@ -96,7 +96,7 @@ class Vector final /** * Scale vector operator. */ - Vector operator/(const float c) const + Vector operator/(const float c) const A_WARN_UNUSED { return Vector(x / c, y / c, @@ -106,7 +106,7 @@ class Vector final /** * In-place scale vector operator. */ - Vector &operator/=(const float c) + Vector &operator/=(const float c) A_WARN_UNUSED { x /= c; y /= c; @@ -117,7 +117,7 @@ class Vector final /** * Add vector operator. */ - Vector operator+(const Vector &v) const + Vector operator+(const Vector &v) const A_WARN_UNUSED { return Vector(x + v.x, y + v.y, @@ -138,7 +138,7 @@ class Vector final /** * Subtract vector operator. */ - Vector operator-(const Vector &v) const + Vector operator-(const Vector &v) const A_WARN_UNUSED { return Vector(x - v.x, y - v.y, @@ -160,7 +160,7 @@ class Vector final * Returns the length of this vector. This method does a relatively * slow square root. */ - float length() const + float length() const A_WARN_UNUSED { return sqrtf(x * x + y * y + z * z); } @@ -168,7 +168,7 @@ class Vector final /** * Returns the squared length of this vector. Avoids the square root. */ - float squaredLength() const + float squaredLength() const A_WARN_UNUSED { return x * x + y * y + z * z; } @@ -176,7 +176,7 @@ class Vector final /** * Returns the manhattan length of this vector. */ - float manhattanLength() const + float manhattanLength() const A_WARN_UNUSED { return fabsf(x) + fabsf(y) + fabsf(z); } @@ -185,7 +185,7 @@ class Vector final * Returns a normalized version of this vector. This is a unit vector * running parallel to it. */ - Vector normalized() const + Vector normalized() const A_WARN_UNUSED { const float len = length(); return Vector(x / len, y / len, z / len); |