diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-27 21:36:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-27 21:36:08 +0300 |
commit | ecac1a1ada766b95cef4a1ac7a2ae8280bfbf762 (patch) | |
tree | 49340cfba8c1fe7d567de18408963378e272ce56 /src/being/being.h | |
parent | 12f2ce912aa1a7e158f06aa20396f213abdd2583 (diff) | |
download | manaverse-ecac1a1ada766b95cef4a1ac7a2ae8280bfbf762.tar.gz manaverse-ecac1a1ada766b95cef4a1ac7a2ae8280bfbf762.tar.bz2 manaverse-ecac1a1ada766b95cef4a1ac7a2ae8280bfbf762.tar.xz manaverse-ecac1a1ada766b95cef4a1ac7a2ae8280bfbf762.zip |
Add restrict keyword in being.
Diffstat (limited to 'src/being/being.h')
-rw-r--r-- | src/being/being.h | 601 |
1 files changed, 312 insertions, 289 deletions
diff --git a/src/being/being.h b/src/being/being.h index a2ca63cf0..2dcb61b1c 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -106,59 +106,59 @@ class Being notfinal : public ActorSprite, virtual ~Being(); - ActorTypeT getType() const override final A_WARN_UNUSED + ActorTypeT getType() const restrict2 override final A_WARN_UNUSED { return mType; } /** * Removes all path nodes from this being. */ - void clearPath(); + void clearPath() restrict2; /** * Returns the time spent in the current action. */ - int getActionTime() const A_WARN_UNUSED + int getActionTime() const restrict2 A_WARN_UNUSED { return mActionTime; } /** * Set the current action time. * @see Ea::BeingHandler that set it to tick time. */ - void setActionTime(const int actionTime) + void setActionTime(const int actionTime) restrict2 { mActionTime = actionTime; } /** * Makes this being take the next tile of its path. */ - virtual void nextTile(); + virtual void nextTile() restrict2; /** * Creates a path for the being from current position to ex and ey */ - void setDestination(const int dstX, const int dstY); + void setDestination(const int dstX, const int dstY) restrict2; /** * Returns the destination for this being. */ - const Vector &getDestination() const A_WARN_UNUSED + const Vector &getDestination() const restrict2 A_WARN_UNUSED { return mDest; } /** * Returns the tile x coord */ - int getTileX() const override A_WARN_UNUSED + int getTileX() const restrict2 override A_WARN_UNUSED { return mX; } /** * Returns the tile y coord */ - int getTileY() const override A_WARN_UNUSED + int getTileY() const restrict2 override A_WARN_UNUSED { return mY; } /** * Sets the tile x and y coord */ - void setTileCoords(const int x, const int y); + void setTileCoords(const int x, const int y) restrict2; /** * Puts a "speech balloon" above this being for the specified amount @@ -167,9 +167,9 @@ class Being notfinal : public ActorSprite, * @param text The text that should appear. * @param time The amount of time the text should stay in milliseconds. */ - void setSpeech(const std::string &text, - const std::string &channel = "", - int time = 0); + void setSpeech(const std::string &restrict text, + const std::string &restrict channel = "", + int time = 0) restrict2; /** * Puts a damage bubble above this being. @@ -179,11 +179,11 @@ class Being notfinal : public ActorSprite, * @param type the attack type * @param id skill id */ - void takeDamage(Being *const attacker, + void takeDamage(Being *restrict const attacker, const int damage, const AttackTypeT type, const int attackId = 1, - const int level = 1); + const int level = 1) restrict2; /** * Handles an attack of another being by this being. @@ -192,19 +192,22 @@ class Being notfinal : public ActorSprite, * @param damage the amount of damage dealt (0 means miss) * @param type the attack type */ - void handleAttack(Being *const victim, const int damage, - const int attackId = 1); + void handleAttack(Being *restrict const victim, + const int damage, + const int attackId = 1) restrict2; - void handleSkill(Being *const victim, const int damage, - const int skillId, const int skillLevel); + void handleSkill(Being *restrict const victim, + const int damage, + const int skillId, + const int skillLevel) restrict2; - const ItemInfo *getEquippedWeapon() const A_WARN_UNUSED + const ItemInfo *getEquippedWeapon() const restrict2 A_WARN_UNUSED { return mEquippedWeapon; } /** * Returns the name of the being. */ - const std::string &getName() const A_WARN_UNUSED + const std::string &getName() const restrict2 A_WARN_UNUSED { return mName; } /** @@ -212,109 +215,112 @@ class Being notfinal : public ActorSprite, * * @param name The name that should appear. */ - void setName(const std::string &name); + void setName(const std::string &restrict name) restrict2; bool getShowName() const A_WARN_UNUSED { return mShowName; } - void setShowName(const bool doShowName); + void setShowName(const bool doShowName) restrict2; /** * Sets the name of the party the being is in. Shown in BeingPopup. */ - void setPartyName(const std::string &name); + void setPartyName(const std::string &restrict name) restrict2; - const std::string &getPartyName() const A_WARN_UNUSED + const std::string &getPartyName() const restrict2 A_WARN_UNUSED { return mPartyName; } - const std::string &getGuildName() const A_WARN_UNUSED + const std::string &getGuildName() const restrict2 A_WARN_UNUSED { return mGuildName; } /** * Sets the name of the primary guild the being is in. Shown in * BeingPopup (eventually). */ - void setGuildName(const std::string &name); + void setGuildName(const std::string &restrict name) restrict2; - void setGuildPos(const std::string &pos) A_CONST; + void setGuildPos(const std::string &restrict pos) restrict2 A_CONST; /** * Adds a guild to the being. */ - void addGuild(Guild *const guild); + void addGuild(Guild *restrict const guild) restrict2; /** * Removers a guild from the being. */ - void removeGuild(const int id); + void removeGuild(const int id) restrict2; /** * Returns a pointer to the specified guild that the being is in. */ - const Guild *getGuild(const std::string &guildName) - const A_WARN_UNUSED; + const Guild *getGuild(const std::string &restrict guildName) + const restrict2 A_WARN_UNUSED; /** * Returns a pointer to the specified guild that the being is in. */ - const Guild *getGuild(const int id) const A_WARN_UNUSED; + const Guild *getGuild(const int id) const restrict2 A_WARN_UNUSED; /** * Returns a pointer to the specified guild that the being is in. */ - Guild *getGuild() const A_WARN_UNUSED; + Guild *getGuild() const restrict2 A_WARN_UNUSED; /** * Returns all guilds the being is in. */ - const std::map<int, Guild*> &getGuilds() const A_WARN_UNUSED + const std::map<int, Guild*> &getGuilds() const restrict2 A_WARN_UNUSED { return mGuilds; } /** * Removes all guilds the being is in. */ - void clearGuilds(); + void clearGuilds() restrict2; /** * Get number of guilds the being belongs to. */ - int16_t getNumberOfGuilds() const A_WARN_UNUSED + int16_t getNumberOfGuilds() const restrict2 A_WARN_UNUSED { return static_cast<int16_t>(mGuilds.size()); } - bool isInParty() const A_WARN_UNUSED + bool isInParty() const restrict2 A_WARN_UNUSED { return mParty; } - void setParty(Party *const party); + void setParty(Party *restrict const party) restrict2; - void setGuild(Guild *const guild); + void setGuild(Guild *restrict const guild) restrict2; - void updateGuild(); + void updateGuild() restrict2; - Party *getParty() const A_WARN_UNUSED + Party *getParty() const restrict2 A_WARN_UNUSED { return mParty; } - int getSpritesCount() const A_WARN_UNUSED + int getSpritesCount() const restrict2 A_WARN_UNUSED { return static_cast<int>(size()); } /** * Sets visible equipments for this being. */ - void setSprite(const unsigned int slot, const int id, + void setSprite(const unsigned int slot, + const int id, std::string color = "", const ItemColor colorId = ItemColor_one, const bool isWeapon = false, - const bool isTempSprite = false); + const bool isTempSprite = false) restrict2; - void updateSprite(const unsigned int slot, const int id, + void updateSprite(const unsigned int slot, + const int id, std::string color = "", const ItemColor colorId = ItemColor_one, const bool isWeapon = false, - const bool isTempSprite = false); + const bool isTempSprite = false) restrict2; - void setSpriteID(const unsigned int slot, const int id); + void setSpriteID(const unsigned int slot, + const int id) restrict2; void setSpriteColor(const unsigned int slot, - const std::string &color = ""); + const std::string &restrict color = "") restrict2; /** * Get the number of hairstyles implemented @@ -331,50 +337,52 @@ class Being notfinal : public ActorSprite, /** * Get the number of layers used to draw the being */ - int getNumberOfLayers() const override A_WARN_UNUSED + int getNumberOfLayers() const restrict2 override A_WARN_UNUSED { return CompoundSprite::getNumberOfLayers(); } /** * Performs being logic. */ - void logic() override; + void logic() restrict2 override; - void petLogic(); + void petLogic() restrict2; /** * Draws the speech text above the being. */ - void drawSpeech(const int offsetX, const int offsetY); + void drawSpeech(const int offsetX, + const int offsetY) restrict2; /** * Draws the emotion picture above the being. */ - void drawEmotion(Graphics *const graphics, + void drawEmotion(Graphics *restrict const graphics, const int offsetX, - const int offsetY) const A_NONNULL(2); + const int offsetY) const restrict2 A_NONNULL(2); - BeingTypeId getSubType() const + BeingTypeId getSubType() const restrict2 { return mSubType; } /** * Set Being's subtype (mostly for view for monsters and NPCs) */ - void setSubtype(const BeingTypeId subtype, const uint16_t look); + void setSubtype(const BeingTypeId subtype, + const uint16_t look) restrict2; - const BeingInfo *getInfo() const A_WARN_UNUSED + const BeingInfo *getInfo() const restrict2 A_WARN_UNUSED { return mInfo; } - TargetCursorSizeT getTargetCursorSize() const override final - A_WARN_UNUSED; + TargetCursorSizeT getTargetCursorSize() const restrict2 override final + A_WARN_UNUSED; - int getTargetOffsetX() const override A_WARN_UNUSED + int getTargetOffsetX() const restrict2 override A_WARN_UNUSED { if (!mInfo) return 0; return mInfo->getTargetOffsetX(); } - int getTargetOffsetY() const override A_WARN_UNUSED + int getTargetOffsetY() const restrict2 override A_WARN_UNUSED { if (!mInfo) return 0; @@ -384,7 +392,7 @@ class Being notfinal : public ActorSprite, /** * Gets the way the object is blocked by other objects. */ - virtual unsigned char getBlockWalkMask() const A_WARN_UNUSED + virtual unsigned char getBlockWalkMask() const restrict2 A_WARN_UNUSED { if (!mInfo) return 0; @@ -394,7 +402,7 @@ class Being notfinal : public ActorSprite, /** * Gets the way the monster blocks pathfinding for other objects */ - BlockTypeT getBlockType() const override A_WARN_UNUSED + BlockTypeT getBlockType() const restrict2 override A_WARN_UNUSED { if (!mInfo) return BlockType::NONE; @@ -404,136 +412,140 @@ class Being notfinal : public ActorSprite, /** * Sets the walk speed in pixels per second. */ - void setWalkSpeed(const Vector &speed) + void setWalkSpeed(const Vector &restrict speed) restrict2 { mWalkSpeed = speed; mSpeed = speed.x; } /** * Gets the walk speed in pixels per second. */ - Vector getWalkSpeed() const A_WARN_UNUSED + Vector getWalkSpeed() const restrict2 A_WARN_UNUSED { return mWalkSpeed; } /** * Sets the attack speed. * @todo In what unit? */ - void setAttackSpeed(const int speed) + void setAttackSpeed(const int speed) restrict2 { mAttackSpeed = speed; } /** * Gets the attack speed. * @todo In what unit? */ - int getAttackSpeed() const A_WARN_UNUSED + int getAttackSpeed() const restrict2 A_WARN_UNUSED { return mAttackSpeed; } /** * Sets the current action. */ - virtual void setAction(const BeingActionT &action, - const int attackType); + virtual void setAction(const BeingActionT &restrict action, + const int attackType) restrict2; /** * Get the being's action currently performed. */ - BeingActionT getCurrentAction() const A_WARN_UNUSED + BeingActionT getCurrentAction() const restrict2 A_WARN_UNUSED { return mAction; } /** * Returns whether this being is still alive. */ - bool isAlive() const A_WARN_UNUSED + bool isAlive() const restrict2 A_WARN_UNUSED { return mAction != BeingAction::DEAD; } /** * Returns the current direction. */ - uint8_t getDirection() const A_WARN_UNUSED + uint8_t getDirection() const restrict2 A_WARN_UNUSED { return mDirection; } /** * Sets the current direction. */ - virtual void setDirection(const uint8_t direction); + virtual void setDirection(const uint8_t direction) restrict2; - virtual void setDirectionDelayed(const uint8_t direction) + virtual void setDirectionDelayed(const uint8_t direction) restrict2 { mDirectionDelayed = direction; } - uint8_t getDirectionDelayed() const A_WARN_UNUSED + uint8_t getDirectionDelayed() const restrict2 A_WARN_UNUSED { return mDirectionDelayed; } /** * Returns the direction the being is facing. */ - SpriteDirection::Type getSpriteDirection() const A_WARN_UNUSED + SpriteDirection::Type getSpriteDirection() const + restrict2 A_WARN_UNUSED { return mSpriteDirection; } - void setPosition(const Vector &pos) override; + void setPosition(const Vector &restrict pos) restrict2 override; /** * Overloaded method provided for convenience. * * @see setPosition(const Vector &pos) */ - inline void setPosition(const float x, const float y, - const float z = 0.0F) + inline void setPosition(const float x, + const float y, + const float z = 0.0F) restrict2 { setPosition(Vector(x, y, z)); } /** * Returns the horizontal size of the current base sprite of the being. */ - int getWidth() const override final A_WARN_UNUSED + int getWidth() const restrict2 override final A_WARN_UNUSED { return std::max(CompoundSprite::getWidth(), DEFAULT_BEING_WIDTH); } /** * Returns the vertical size of the current base sprite of the being. */ - int getHeight() const override final A_WARN_UNUSED + int getHeight() const restrict2 override final 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 A_WARN_UNUSED + virtual int getCollisionRadius() const restrict2 A_WARN_UNUSED { return 16; } /** * Shoots a missile particle from this being, to target being */ - void fireMissile(Being *const target, - const std::string &particle) const; + void fireMissile(Being *restrict const target, + const std::string &restrict particle) const restrict2; /** * 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 A_WARN_UNUSED + const Path &getPath() const restrict2 A_WARN_UNUSED { return mPath; } - int getDistance() const A_WARN_UNUSED + int getDistance() const restrict2 A_WARN_UNUSED { return mDistance; } - void setDistance(const int n) + void setDistance(const int n) restrict2 { mDistance = n; } /** * Set the Emoticon type and time displayed above * the being. */ - void setEmote(const uint8_t emotion, const int emote_time); + void setEmote(const uint8_t emotion, + const int emote_time) restrict2; - void setState(const uint8_t state); + void setState(const uint8_t state) restrict2; - virtual void drawSprites(Graphics *const graphics, + virtual void drawSprites(Graphics *restrict const graphics, int posX, - int posY) const override final A_NONNULL(2); + int posY) const + restrict2 override final A_NONNULL(2); - virtual void drawSpritesSDL(Graphics *const graphics, + virtual void drawSpritesSDL(Graphics *restrict const graphics, int posX, - int posY) const override final + int posY) const restrict2 override final A_NONNULL(2); - void drawHpBar(Graphics *const graphics, + void drawHpBar(Graphics *restrict const graphics, const int maxHP, const int hp, const int damage, @@ -542,322 +554,332 @@ class Being notfinal : public ActorSprite, const int x, const int y, const int width, - const int height) const A_NONNULL(2); + const int height) const restrict2 A_NONNULL(2); static void load(); - void optionChanged(const std::string &value) override; + void optionChanged(const std::string &restrict value) + restrict2 override; - void flashName(const int time); + void flashName(const int time) restrict2; - int getDamageTaken() const A_WARN_UNUSED + int getDamageTaken() const restrict2 A_WARN_UNUSED { return mDamageTaken; } - void setDamageTaken(const int damage) + void setDamageTaken(const int damage) restrict2 { mDamageTaken = damage; } - void updateName(); + void updateName() restrict2; - void setLevel(const int n) + void setLevel(const int n) restrict2 { mLevel = n; } - virtual int getLevel() const A_WARN_UNUSED + virtual int getLevel() const restrict2 A_WARN_UNUSED { return mLevel; } - void setReachable(const ReachableT n) + void setReachable(const ReachableT n) restrict2 { mReachable = n; } - ReachableT getReachable() const A_WARN_UNUSED + ReachableT getReachable() const restrict2 A_WARN_UNUSED { return mReachable; } static void reReadConfig(); static BeingCacheEntry* getCacheEntry(const BeingId id) A_WARN_UNUSED; - void addToCache() const; + void addToCache() const restrict2; - bool updateFromCache(); + bool updateFromCache() restrict2; /** * Sets the gender of this being. */ - virtual void setGender(const GenderT gender); + virtual void setGender(const GenderT gender) restrict2; - GenderT getGender() const A_WARN_UNUSED + GenderT getGender() const restrict2 A_WARN_UNUSED { return mGender; } /** * Return sprite sit action for current environment. */ - std::string getSitAction() const A_WARN_UNUSED; + std::string getSitAction() const restrict2 A_WARN_UNUSED; - std::string getCastAction() const A_WARN_UNUSED; + std::string getCastAction() const restrict2 A_WARN_UNUSED; - std::string getCastAction(const SkillInfo *const skill) const - A_WARN_UNUSED; + std::string getCastAction(const SkillInfo *restrict const skill) const + restrict2 A_WARN_UNUSED; - std::string getMoveAction() const A_WARN_UNUSED; + std::string getMoveAction() const restrict2 A_WARN_UNUSED; - std::string getDeadAction() const A_WARN_UNUSED; + std::string getDeadAction() const restrict2 A_WARN_UNUSED; - std::string getStandAction() const A_WARN_UNUSED; + std::string getStandAction() const restrict2 A_WARN_UNUSED; - std::string getSpawnAction() const A_WARN_UNUSED; + std::string getSpawnAction() const restrict2 A_WARN_UNUSED; - std::string getWeaponAttackAction(const ItemInfo *const weapon) const - A_WARN_UNUSED; + std::string getWeaponAttackAction(const ItemInfo *restrict const + weapon) const + restrict2 A_WARN_UNUSED; - std::string getAttackAction() const A_WARN_UNUSED; + std::string getAttackAction() const restrict2 A_WARN_UNUSED; - std::string getAttackAction(const Attack *const attack) const - A_WARN_UNUSED; + std::string getAttackAction(const Attack *restrict const attack) const + restrict2 A_WARN_UNUSED; /** * Whether or not this player is a GM. */ - bool isGM() const A_WARN_UNUSED + bool isGM() const restrict2 A_WARN_UNUSED { return mIsGM; } /** * Triggers whether or not to show the name as a GM name. */ - void setGM(const bool gm); + void setGM(const bool gm) restrict2; - bool canTalk() const A_WARN_UNUSED + bool canTalk() const restrict2 A_WARN_UNUSED { return mType == ActorType::Npc; } - void talkTo() const; + void talkTo() const restrict2; - void draw(Graphics *const graphics, + void draw(Graphics *restrict const graphics, const int offsetX, - const int offsetY) const override final A_NONNULL(2); + const int offsetY) const + restrict2 override final A_NONNULL(2); - void drawSpriteAt(Graphics *const graphics, - const int x, const int y) const A_NONNULL(2); + void drawSpriteAt(Graphics *restrict const graphics, + const int x, + const int y) const restrict2 A_NONNULL(2); - void setMoveTime() + void setMoveTime() restrict2 { mMoveTime = cur_time; } - void setAttackTime() + void setAttackTime() restrict2 { mAttackTime = cur_time; } - void setTalkTime() + void setTalkTime() restrict2 { mTalkTime = cur_time; } - void setTestTime() + void setTestTime() restrict2 { mTestTime = cur_time; } - void setOtherTime() + void setOtherTime() restrict2 { mOtherTime = cur_time; } - unsigned int getMoveTime() const + unsigned int getMoveTime() const restrict2 { return mMoveTime; } - unsigned int getAttackTime() const + unsigned int getAttackTime() const restrict2 { return mAttackTime; } - unsigned int getTalkTime() const + unsigned int getTalkTime() const restrict2 { return mTalkTime; } - unsigned int getTestTime() const + unsigned int getTestTime() const restrict2 { return mTestTime; } - unsigned int getOtherTime() const + unsigned int getOtherTime() const restrict2 { return mOtherTime; } - void resetCounters(); + void resetCounters() restrict2; - void updateColors(); + void updateColors() restrict2; - void setEnemy(const bool n) + void setEnemy(const bool n) restrict2 { mEnemy = n; } - const std::string &getIp() const A_WARN_UNUSED + const std::string &getIp() const restrict2 A_WARN_UNUSED { return mIp; } - void setIp(const std::string &ip) + void setIp(const std::string &restrict ip) restrict2 { mIp = ip; } - unsigned int getPvpRank() const A_WARN_UNUSED + unsigned int getPvpRank() const restrict2 A_WARN_UNUSED { return mPvpRank; } - void setPvpRank(const unsigned int rank) + void setPvpRank(const unsigned int rank) restrict2 { mPvpRank = rank; } - void setHP(const int n); + void setHP(const int n) restrict2; - void setMaxHP(const int hp); + void setMaxHP(const int hp) restrict2; - int getHP() const A_WARN_UNUSED + int getHP() const restrict2 A_WARN_UNUSED { return mHP; } uint8_t calcDirection(const int dstX, - const int dstY) const A_WARN_UNUSED; + const int dstY) const restrict2 A_WARN_UNUSED; - uint8_t calcDirection() const A_WARN_UNUSED; + uint8_t calcDirection() const restrict2 A_WARN_UNUSED; - void setAttackDelay(const int n) + void setAttackDelay(const int n) restrict2 { mAttackDelay = n; } - int getAttackDelay() const A_WARN_UNUSED + int getAttackDelay() const restrict2 A_WARN_UNUSED { return mAttackDelay; } - int getMinHit() const A_WARN_UNUSED + int getMinHit() const restrict2 A_WARN_UNUSED { return mMinHit; } - void setMinHit(const int n) + void setMinHit(const int n) restrict2 { mMinHit = n; } - int getMaxHit() const A_WARN_UNUSED + int getMaxHit() const restrict2 A_WARN_UNUSED { return mMaxHit; } - void setMaxHit(const int n) + void setMaxHit(const int n) restrict2 { mMaxHit = n; } - int getCriticalHit() const A_WARN_UNUSED + int getCriticalHit() const restrict2 A_WARN_UNUSED { return mCriticalHit; } - void setCriticalHit(const int n) + void setCriticalHit(const int n) restrict2 { mCriticalHit = n; } - void updateHit(const int amount); + void updateHit(const int amount) restrict2; - Equipment *getEquipment() A_WARN_UNUSED; + Equipment *getEquipment() restrict2 A_WARN_UNUSED; - void undressItemById(const int id); + void undressItemById(const int id) restrict2; - int getGoodStatus() const A_WARN_UNUSED + int getGoodStatus() const restrict2 A_WARN_UNUSED { return mGoodStatus; } - void setGoodStatus(const int n) + void setGoodStatus(const int n) restrict2 { mGoodStatus = n; } - std::string getGenderSign() const A_WARN_UNUSED; + std::string getGenderSign() const restrict2 A_WARN_UNUSED; - std::string getGenderSignWithSpace() const A_WARN_UNUSED; + std::string getGenderSignWithSpace() const restrict2 A_WARN_UNUSED; - void updateComment(); + void updateComment() restrict2; - const std::string getComment() const A_WARN_UNUSED + const std::string getComment() const restrict2 A_WARN_UNUSED { return mComment; } - void setComment(const std::string &n) + void setComment(const std::string &restrict n) restrict2 { mComment = n; } static void clearCache(); - static std::string loadComment(const std::string &name, - const ActorTypeT &type) + static std::string loadComment(const std::string &restrict name, + const ActorTypeT &restrict type) A_WARN_UNUSED; static void saveComment(const std::string &restrict name, const std::string &restrict comment, const ActorTypeT &restrict type); - bool isAdvanced() const A_WARN_UNUSED + bool isAdvanced() const restrict2 A_WARN_UNUSED { return mAdvanced; } - void setAdvanced(const bool n) + void setAdvanced(const bool n) restrict2 { mAdvanced = n; addToCache(); } - bool isBuyShopEnabled() const A_WARN_UNUSED; + bool isBuyShopEnabled() const restrict2 A_WARN_UNUSED; - bool isSellShopEnabled() const A_WARN_UNUSED; + bool isSellShopEnabled() const restrict2 A_WARN_UNUSED; - void enableShop(const bool b); + void enableShop(const bool b) restrict2; /** * Sets the attack range. */ - void setAttackRange(const int range) + void setAttackRange(const int range) restrict2 { mAttackRange = range; } - void attack(Being *target = nullptr, bool keep = false, - bool dontChangeEquipment = false); +/* + void attack(Being *restrict target = nullptr, + bool keep = false, + bool dontChangeEquipment = false) restrict2; - void attack2(Being *target = nullptr, bool keep = false, - bool dontChangeEquipment = false); + void attack2(Being *restrict target = nullptr, + bool keep = false, + bool dontChangeEquipment = false) restrict2; +*/ - void updatePercentHP(); + void updatePercentHP() restrict2; - void setRaceName(const std::string &name) + void setRaceName(const std::string &restrict name) restrict2 { mRaceName = name; } - std::string getRaceName() const A_WARN_UNUSED + std::string getRaceName() const restrict2 A_WARN_UNUSED { return mRaceName; } - int getSpriteID(const int slot) const A_WARN_UNUSED; + int getSpriteID(const int slot) const restrict2 A_WARN_UNUSED; - ItemColor getSpriteColor(const int slot) const A_WARN_UNUSED; + ItemColor getSpriteColor(const int slot) const restrict2 A_WARN_UNUSED; - void setHairStyle(const unsigned int slot, const int id); + void setHairStyle(const unsigned int slot, + const int id) restrict2; void setHairColor(const unsigned int slot, - const ItemColor color); + const ItemColor color) restrict2; - void setHairColor(const ItemColor color) + void setHairColor(const ItemColor color) restrict2 { mHairColor = color; } ItemColor getHairColor() const A_WARN_UNUSED { return mHairColor; } - void recalcSpritesOrder(); + void recalcSpritesOrder() restrict2; - int getHitEffect(const Being *const attacker, + int getHitEffect(const Being *restrict const attacker, const AttackTypeT type, const int attackId, - const int level) const A_WARN_UNUSED; + const int level) const restrict2 A_WARN_UNUSED; - Cursor::Cursor getHoverCursor() const A_WARN_UNUSED + Cursor::Cursor getHoverCursor() const restrict2 A_WARN_UNUSED { return mInfo ? mInfo->getHoverCursor() : Cursor::CURSOR_POINTER; } - void addAfkEffect(); + void addAfkEffect() restrict2; - void removeAfkEffect(); + void removeAfkEffect() restrict2; - void updateAwayEffect(); + void updateAwayEffect() restrict2; - void addSpecialEffect(const int effect); + void addSpecialEffect(const int effect) restrict2; - void removeSpecialEffect(); + void removeSpecialEffect() restrict2; - void addEffect(const std::string &name); + void addEffect(const std::string &restrict name) restrict2; - void addPet(const BeingId id); + void addPet(const BeingId id) restrict2; - void removePet(const BeingId id); + void removePet(const BeingId id) restrict2; - void updatePets(); + void updatePets() restrict2; - void fixPetSpawnPos(int &dstX, int &dstY) const; + void fixPetSpawnPos(int &restrict dstX, + int &restrict dstY) const restrict2; - const std::vector<Being*> &getPets() const + const std::vector<Being*> &getPets() const restrict2 { return mPets; } - Being *getFirstPet() + Being *getFirstPet() restrict2 { return mPets.empty() ? nullptr : mPets[0]; } - void setOwner(Being *const owner) + void setOwner(Being *restrict const owner) restrict2 { mOwner = owner; } - Being *getOwner() const + Being *getOwner() const restrict2 { return mOwner; } - void unassignPet(const Being *const pet); + void unassignPet(const Being *restrict const pet) restrict2; - void removeAllPets(); + void removeAllPets() restrict2; - Being *findChildPet(const BeingId id); + Being *findChildPet(const BeingId id) restrict2; void playSfx(const SoundInfo &sound, - Being *const being, + Being *restrict const being, const bool main, - const int x, const int y) const; + const int x, const int y) const restrict2; - uint16_t getLook() const + uint16_t getLook() const restrict2 { return mLook; } - void setLook(const uint16_t look); + void setLook(const uint16_t look) restrict2; static uint8_t genderToInt(const GenderT sex) A_CONST A_WARN_UNUSED; @@ -868,133 +890,134 @@ class Being notfinal : public ActorSprite, /** * Sets the new path for this being. */ - void setPath(const Path &path); + void setPath(const Path &restrict path) restrict2; - int getSortPixelY() const override A_WARN_UNUSED + int getSortPixelY() const restrict2 override A_WARN_UNUSED { return static_cast<int>(mPos.y) - mYDiff - mSortOffsetY; } // { return static_cast<int>(mPos.y) - mYDiff - mSortOffsetY + 16; } - void setMap(Map *const map) override; + void setMap(Map *restrict const map) restrict2 override; - void recreateItemParticles(); + void recreateItemParticles() restrict2; - void incUsage() + void incUsage() restrict2 { mUsageCounter ++; } - int decUsage() + int decUsage() restrict2 { return --mUsageCounter; } - virtual int getLastAttackX() const + virtual int getLastAttackX() const restrict2 { return mLastAttackX; } - virtual int getLastAttackY() const + virtual int getLastAttackY() const restrict2 { return mLastAttackY; } #ifdef EATHENA_SUPPORT - void setTrickDead(const bool b) override final; + void setTrickDead(const bool b) restrict2 override final; - void setChat(ChatObject *const obj); + void setChat(ChatObject *restrict const obj) restrict2; - ChatObject *getChat() const + ChatObject *getChat() const restrict2 { return mChat; } - void setRiding(const bool b) override final; + void setRiding(const bool b) restrict2 override final; - void setHorse(const int horseId); + void setHorse(const int horseId) restrict2; - void removeHorse(); + void removeHorse() restrict2; - void setSellBoard(const std::string &text); + void setSellBoard(const std::string &restrict text) restrict2; - std::string getSellBoard() const A_WARN_UNUSED + std::string getSellBoard() const restrict2 A_WARN_UNUSED { return mSellBoard; } - void setBuyBoard(const std::string &text); + void setBuyBoard(const std::string &restrict text) restrict2; - std::string getBuyBoard() const A_WARN_UNUSED + std::string getBuyBoard() const restrict2 A_WARN_UNUSED { return mBuyBoard; } - void setSpiritBalls(const unsigned int balls); + void setSpiritBalls(const unsigned int balls) restrict2; - unsigned int getSpiritBalls() const A_WARN_UNUSED + unsigned int getSpiritBalls() const restrict2 A_WARN_UNUSED { return mSpiritBalls; } #endif - void setKarma(const int karma) + void setKarma(const int karma) restrict2 { mKarma = karma; } - int getKarma() const + int getKarma() const restrict2 { return mKarma; } - void setManner(const int manner) + void setManner(const int manner) restrict2 { mManner = manner; } - int getManner() const + int getManner() const restrict2 { return mManner; } - void disablePetAi() + void disablePetAi() restrict2 { mPetAi = false; } - void enablePetAi() + void enablePetAi() restrict2 { mPetAi = true; } - int getAreaSize() const + int getAreaSize() const restrict2 { return mAreaSize; } - void setAreaSize(const int areaSize) + void setAreaSize(const int areaSize) restrict2 { mAreaSize = areaSize; } - void setTeamId(const uint16_t teamId); + void setTeamId(const uint16_t teamId) restrict2; - void showTeamBadge(const bool show); + void showTeamBadge(const bool show) restrict2; - void showGuildBadge(const bool show); + void showGuildBadge(const bool show) restrict2; - void showGmBadge(const bool show); + void showGmBadge(const bool show) restrict2; - void showPartyBadge(const bool show); + void showPartyBadge(const bool show) restrict2; - void showNameBadge(const bool show); + void showNameBadge(const bool show) restrict2; - void showShopBadge(const bool show); + void showShopBadge(const bool show) restrict2; - void showInactiveBadge(const bool show); + void showInactiveBadge(const bool show) restrict2; - void showAwayBadge(const bool show); + void showAwayBadge(const bool show) restrict2; - void showBadges(const bool show); + void showBadges(const bool show) restrict2; - uint16_t getTeamId() const + uint16_t getTeamId() const restrict2 { return mTeamId; } - void serverRemove(); + void serverRemove() restrict2; protected: /** * Updates name's location. */ - virtual void updateCoords(); + virtual void updateCoords() restrict2; - void showName(); + void showName() restrict2; - void addItemParticles(const int id, const SpriteDisplay &display); + void addItemParticles(const int id, + const SpriteDisplay &restrict display) restrict2; - void removeAllItemsParticles(); + void removeAllItemsParticles() restrict2; - void removeItemParticles(const int id); + void removeItemParticles(const int id) restrict2; - void createSpeechBubble(); + void createSpeechBubble() restrict2; - void setDefaultNameColor(const UserColorIdT defaultColor); + void setDefaultNameColor(const UserColorIdT defaultColor) restrict2; - void updateBadgesCount(); + void updateBadgesCount() restrict2; - static int getDefaultEffectId(const AttackTypeT &type); + static int getDefaultEffectId(const AttackTypeT &restrict type); - BeingInfo *mInfo; - AnimatedSprite *mEmotionSprite; - AnimatedSprite *mAnimationEffect; - AnimatedSprite *mBadges[BadgeIndex::BadgeIndexSize]; + BeingInfo *restrict mInfo; + AnimatedSprite *restrict mEmotionSprite; + AnimatedSprite *restrict mAnimationEffect; + AnimatedSprite *restrict mBadges[BadgeIndex::BadgeIndexSize]; std::string mSpriteAction; std::string mName; /**< Name of character */ @@ -1006,18 +1029,18 @@ class Being notfinal : public ActorSprite, /** * Holds a text object when the being displays it's name, 0 otherwise */ - FlashText *mDispName; - const Color *mNameColor; + FlashText *restrict mDispName; + const Color *restrict mNameColor; /** Engine-related infos about weapon. */ - const ItemInfo *mEquippedWeapon; + const ItemInfo *restrict mEquippedWeapon; static int mNumberOfHairstyles; /** Number of hair styles in use */ static int mNumberOfRaces; /** Number of races in use */ Path mPath; - Text *mText; - const Color *mTextColor; + Text *restrict mText; + const Color *restrict mTextColor; Vector mDest; /**< destination coordinates. */ @@ -1063,27 +1086,27 @@ class Being notfinal : public ActorSprite, * TODO: Used by eAthena only? */ int getOffset(const signed char pos, - const signed char neg) const A_WARN_UNUSED; + const signed char neg) const restrict2 A_WARN_UNUSED; - int searchSlotValue(const std::vector<int> &slotRemap, - const int val) const A_WARN_UNUSED; + int searchSlotValue(const std::vector<int> &restrict slotRemap, + const int val) const restrict2 A_WARN_UNUSED; - static void searchSlotValueItr(std::vector<int>::iterator &it, + static void searchSlotValueItr(std::vector<int>::iterator &restrict it, int &idx, - std::vector<int> &slotRemap, + std::vector<int> &restrict slotRemap, const int val); void addSpiritBalls(const unsigned int balls, - const int effectId); + const int effectId) restrict2; - void removeSpiritBalls(const unsigned int balls); + void removeSpiritBalls(const unsigned int balls) restrict2; - void dumpSprites() const; + void dumpSprites() const restrict2; const ActorTypeT mType; /** Speech Bubble components */ - SpeechBubble *mSpeechBubble; + SpeechBubble *restrict mSpeechBubble; /** * Walk speed for x and y movement values. @@ -1093,20 +1116,20 @@ class Being notfinal : public ActorSprite, Vector mWalkSpeed; float mSpeed; std::string mIp; - int *mSpriteRemap A_NONNULLPOINTER; - int *mSpriteHide A_NONNULLPOINTER; - int *mSpriteDraw A_NONNULLPOINTER; + int *restrict mSpriteRemap A_NONNULLPOINTER; + int *restrict mSpriteHide A_NONNULLPOINTER; + int *restrict mSpriteDraw A_NONNULLPOINTER; std::string mComment; #ifdef EATHENA_SUPPORT std::string mBuyBoard; std::string mSellBoard; #endif std::vector<Being*> mPets; - Being *mOwner; - Particle *mSpecialParticle; + Being *restrict mOwner; + Particle *restrict mSpecialParticle; #ifdef EATHENA_SUPPORT - ChatObject *mChat; - HorseInfo *mHorseInfo; + ChatObject *restrict mChat; + HorseInfo *restrict mHorseInfo; std::vector<AnimatedSprite*> mDownHorseSprites; std::vector<AnimatedSprite*> mUpHorseSprites; std::vector<Particle*> mSpiritParticles; |