From ecac1a1ada766b95cef4a1ac7a2ae8280bfbf762 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Dec 2015 21:36:08 +0300 Subject: Add restrict keyword in being. --- src/being/being.cpp | 416 +++++++++++++++++++----------------- src/being/being.h | 601 +++++++++++++++++++++++++++------------------------- 2 files changed, 536 insertions(+), 481 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 9881707f4..aa956389d 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -354,13 +354,13 @@ Being::~Being() #endif } -void Being::createSpeechBubble() +void Being::createSpeechBubble() restrict2 { CREATEWIDGETV0(mSpeechBubble, SpeechBubble); } void Being::setSubtype(const BeingTypeId subtype, - const uint16_t look) + const uint16_t look) restrict2 { if (!mInfo) return; @@ -490,7 +490,7 @@ void Being::setSubtype(const BeingTypeId subtype, } else { - const ItemInfo &info = ItemDB::get(id); + const ItemInfo &restrict info = ItemDB::get(id); setRaceName(info.getName()); if (charServerHandler) { @@ -501,7 +501,7 @@ void Being::setSubtype(const BeingTypeId subtype, } } -TargetCursorSizeT Being::getTargetCursorSize() const +TargetCursorSizeT Being::getTargetCursorSize() const restrict2 { if (!mInfo) return TargetCursorSize::SMALL; @@ -509,7 +509,7 @@ TargetCursorSizeT Being::getTargetCursorSize() const return mInfo->getTargetCursorSize(); } -void Being::setPosition(const Vector &pos) +void Being::setPosition(const Vector &restrict pos) restrict2 { Actor::setPosition(pos); @@ -523,7 +523,7 @@ void Being::setPosition(const Vector &pos) } } -void Being::setDestination(const int dstX, const int dstY) +void Being::setDestination(const int dstX, const int dstY) restrict2 { // We can't calculate anything without a map anyway. if (!mMap) @@ -532,12 +532,12 @@ void Being::setDestination(const int dstX, const int dstY) setPath(mMap->findPath(mX, mY, dstX, dstY, getBlockWalkMask())); } -void Being::clearPath() +void Being::clearPath() restrict2 { mPath.clear(); } -void Being::setPath(const Path &path) +void Being::setPath(const Path &restrict path) restrict2 { mPath = path; if (mPath.empty()) @@ -550,8 +550,9 @@ void Being::setPath(const Path &path) } } -void Being::setSpeech(const std::string &text, const std::string &channel, - int time) +void Being::setSpeech(const std::string &restrict text, + const std::string &restrict channel, + int time) restrict2 { if (!userPalette) return; @@ -647,11 +648,11 @@ void Being::setSpeech(const std::string &text, const std::string &channel, } } -void Being::takeDamage(Being *const attacker, +void Being::takeDamage(Being *restrict const attacker, const int amount, const AttackTypeT type, const int attackId, - const int level) + const int level) restrict2 { if (!userPalette || !attacker) return; @@ -832,10 +833,10 @@ void Being::takeDamage(Being *const attacker, BLOCK_END("Being::takeDamage2") } -int Being::getHitEffect(const Being *const attacker, +int Being::getHitEffect(const Being *restrict const attacker, const AttackTypeT type, const int attackId, - const int level) const + const int level) const restrict2 { if (!effectManager) return 0; @@ -846,7 +847,7 @@ int Being::getHitEffect(const Being *const attacker, int hitEffectId = 0; if (type == AttackType::SKILL || type == AttackType::SKILLMISS) { - SkillData *const data = skillDialog->getSkillDataByLevel( + SkillData *restrict const data = skillDialog->getSkillDataByLevel( attackId, level); if (!data) return -1; @@ -867,7 +868,7 @@ int Being::getHitEffect(const Being *const attacker, { if (attacker) { - const ItemInfo *const attackerWeapon + const ItemInfo *restrict const attackerWeapon = attacker->getEquippedWeapon(); if (attackerWeapon && attacker->getType() == ActorType::Player) { @@ -880,10 +881,11 @@ int Being::getHitEffect(const Being *const attacker, } else if (attacker->getType() == ActorType::Monster) { - const BeingInfo *const info = attacker->getInfo(); + const BeingInfo *restrict const info = attacker->getInfo(); if (info) { - const Attack *const atk = info->getAttack(attackId); + const Attack *restrict const atk = + info->getAttack(attackId); if (atk) { if (type == AttackType::MISS) @@ -913,7 +915,7 @@ int Being::getHitEffect(const Being *const attacker, return hitEffectId; } -int Being::getDefaultEffectId(const AttackTypeT &type) +int Being::getDefaultEffectId(const AttackTypeT &restrict type) { if (type == AttackType::MISS) return paths.getIntValue("missEffectId"); @@ -923,8 +925,9 @@ int Being::getDefaultEffectId(const AttackTypeT &type) return paths.getIntValue("criticalHitEffectId"); } -void Being::handleAttack(Being *const victim, const int damage, - const int attackId) +void Being::handleAttack(Being *restrict const victim, + const int damage, + const int attackId) restrict2 { if (!victim || !mInfo) return; @@ -985,14 +988,16 @@ void Being::handleAttack(Being *const victim, const int damage, BLOCK_END("Being::handleAttack") } -void Being::handleSkill(Being *const victim, const int damage, - const int skillId, const int skillLevel) +void Being::handleSkill(Being *restrict const victim, + const int damage, + const int skillId, + const int skillLevel) restrict2 { if (!victim || !mInfo || !skillDialog) return; - const SkillInfo *const skill = skillDialog->getSkill(skillId); - const SkillData *const data = skill + const SkillInfo *restrict const skill = skillDialog->getSkill(skillId); + const SkillData *restrict const data = skill ? skill->getData1(skillLevel) : nullptr; if (data) fireMissile(victim, data->particle); @@ -1031,11 +1036,14 @@ void Being::handleSkill(Being *const victim, const int damage, else { playSfx(mInfo->getSound((damage > 0) ? - ItemSoundEvent::HIT : ItemSoundEvent::MISS), victim, true, mX, mY); + ItemSoundEvent::HIT : ItemSoundEvent::MISS), + victim, + true, + mX, mY); } } -void Being::showNameBadge(const bool show) +void Being::showNameBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Name]); if (show && !mName.empty() && mShowBadges) @@ -1049,7 +1057,7 @@ void Being::showNameBadge(const bool show) } } -void Being::setName(const std::string &name) +void Being::setName(const std::string &restrict name) restrict2 { if (mType == ActorType::Npc) { @@ -1078,7 +1086,7 @@ void Being::setName(const std::string &name) } } -void Being::setShowName(const bool doShowName) +void Being::setShowName(const bool doShowName) restrict2 { if (mShowName == doShowName) return; @@ -1091,7 +1099,7 @@ void Being::setShowName(const bool doShowName) delete2(mDispName) } -void Being::showGuildBadge(const bool show) +void Being::showGuildBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Guild]); if (show && !mGuildName.empty() && mShowBadges) @@ -1105,7 +1113,7 @@ void Being::showGuildBadge(const bool show) } } -void Being::setGuildName(const std::string &name) +void Being::setGuildName(const std::string &restrict name) restrict2 { if (mGuildName != name) { @@ -1115,11 +1123,11 @@ void Being::setGuildName(const std::string &name) } } -void Being::setGuildPos(const std::string &pos A_UNUSED) +void Being::setGuildPos(const std::string &restrict pos A_UNUSED) restrict2 { } -void Being::addGuild(Guild *const guild) +void Being::addGuild(Guild *restrict const guild) restrict2 { if (!guild) return; @@ -1130,7 +1138,7 @@ void Being::addGuild(Guild *const guild) socialWindow->addTab(guild); } -void Being::removeGuild(const int id) +void Being::removeGuild(const int id) restrict2 { if (this == localPlayer && socialWindow) socialWindow->removeTab(mGuilds[id]); @@ -1140,11 +1148,12 @@ void Being::removeGuild(const int id) mGuilds.erase(id); } -const Guild *Being::getGuild(const std::string &guildName) const +const Guild *Being::getGuild(const std::string &restrict guildName) const + restrict2 { FOR_EACH (GuildsMapCIter, itr, mGuilds) { - const Guild *const guild = itr->second; + const Guild *restrict const guild = itr->second; if (guild && guild->getName() == guildName) return guild; } @@ -1152,7 +1161,7 @@ const Guild *Being::getGuild(const std::string &guildName) const return nullptr; } -const Guild *Being::getGuild(const int id) const +const Guild *Being::getGuild(const int id) const restrict2 { const std::map::const_iterator itr = mGuilds.find(id); if (itr != mGuilds.end()) @@ -1161,7 +1170,7 @@ const Guild *Being::getGuild(const int id) const return nullptr; } -Guild *Being::getGuild() const +Guild *Being::getGuild() const restrict2 { const std::map::const_iterator itr = mGuilds.begin(); if (itr != mGuilds.end()) @@ -1170,7 +1179,7 @@ Guild *Being::getGuild() const return nullptr; } -void Being::clearGuilds() +void Being::clearGuilds() restrict2 { FOR_EACH (GuildsMapCIter, itr, mGuilds) { @@ -1188,7 +1197,7 @@ void Being::clearGuilds() mGuilds.clear(); } -void Being::setParty(Party *const party) +void Being::setParty(Party *restrict const party) restrict2 { if (party == mParty) return; @@ -1214,12 +1223,12 @@ void Being::setParty(Party *const party) } } -void Being::updateGuild() +void Being::updateGuild() restrict2 { if (!localPlayer) return; - Guild *const guild = localPlayer->getGuild(); + Guild *restrict const guild = localPlayer->getGuild(); if (!guild) { clearGuilds(); @@ -1235,9 +1244,9 @@ void Being::updateGuild() updateColors(); } -void Being::setGuild(Guild *const guild) +void Being::setGuild(Guild *restrict const guild) restrict2 { - Guild *const old = getGuild(); + Guild *restrict const old = getGuild(); if (guild == old) return; @@ -1259,14 +1268,15 @@ void Being::setGuild(Guild *const guild) } } -void Being::fireMissile(Being *const victim, const std::string &particle) const +void Being::fireMissile(Being *restrict const victim, + const std::string &restrict particle) const restrict2 { if (!victim || particle.empty() || !particleEngine) return; BLOCK_START("Being::fireMissile") - Particle *const target = particleEngine->createChild(); + Particle *restrict const target = particleEngine->createChild(); if (!target) { @@ -1274,7 +1284,7 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const return; } - Particle *const missile = target->addEffect( + Particle *restrict const missile = target->addEffect( particle, getPixelX(), getPixelY()); if (missile) @@ -1290,7 +1300,7 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const BLOCK_END("Being::fireMissile") } -std::string Being::getSitAction() const +std::string Being::getSitAction() const restrict2 { if (mHorseId != 0) return SpriteAction::SITRIDE; @@ -1308,7 +1318,7 @@ std::string Being::getSitAction() const } -std::string Being::getMoveAction() const +std::string Being::getMoveAction() const restrict2 { if (mHorseId != 0) return SpriteAction::RIDE; @@ -1323,7 +1333,8 @@ std::string Being::getMoveAction() const return SpriteAction::MOVE; } -std::string Being::getWeaponAttackAction(const ItemInfo *const weapon) const +std::string Being::getWeaponAttackAction(const ItemInfo *restrict const weapon) + const restrict2 { if (!weapon) return getAttackAction(); @@ -1341,7 +1352,8 @@ std::string Being::getWeaponAttackAction(const ItemInfo *const weapon) const return weapon->getAttackAction(); } -std::string Being::getAttackAction(const Attack *const attack1) const +std::string Being::getAttackAction(const Attack *restrict const attack1) const + restrict2 { if (!attack1) return getAttackAction(); @@ -1359,7 +1371,8 @@ std::string Being::getAttackAction(const Attack *const attack1) const return attack1->mAction; } -std::string Being::getCastAction(const SkillInfo *const skill) const +std::string Being::getCastAction(const SkillInfo *restrict const skill) const + restrict2 { if (!skill) return getCastAction(); @@ -1378,7 +1391,7 @@ std::string Being::getCastAction(const SkillInfo *const skill) const } #define getSpriteAction(func, action) \ - std::string Being::get##func##Action() const \ + std::string Being::get##func##Action() const restrict2\ { \ if (mHorseId != 0) \ return SpriteAction::action##RIDE; \ @@ -1398,7 +1411,7 @@ getSpriteAction(Cast, CAST) getSpriteAction(Dead, DEAD) getSpriteAction(Spawn, SPAWN) -std::string Being::getStandAction() const +std::string Being::getStandAction() const restrict2 { if (mHorseId != 0) return SpriteAction::STANDRIDE; @@ -1425,7 +1438,8 @@ std::string Being::getStandAction() const return SpriteAction::STAND; } -void Being::setAction(const BeingActionT &action, const int attackId) +void Being::setAction(const BeingActionT &restrict action, + const int attackId) restrict2 { std::string currentAction = SpriteAction::INVALID; @@ -1484,7 +1498,8 @@ void Being::setAction(const BeingActionT &action, const int attackId) case BeingAction::CAST: if (skillDialog) { - const SkillInfo *const info = skillDialog->getSkill(attackId); + const SkillInfo *restrict const info = + skillDialog->getSkill(attackId); currentAction = getCastAction(info); } break; @@ -1565,7 +1580,7 @@ void Being::setAction(const BeingActionT &action, const int attackId) } } -void Being::setDirection(const uint8_t direction) +void Being::setDirection(const uint8_t direction) restrict2 { if (mDirection == direction) return; @@ -1630,7 +1645,7 @@ void Being::setDirection(const uint8_t direction) recalcSpritesOrder(); } -uint8_t Being::calcDirection() const +uint8_t Being::calcDirection() const restrict2 { uint8_t dir = 0; if (mDest.x > mX) @@ -1644,7 +1659,8 @@ uint8_t Being::calcDirection() const return dir; } -uint8_t Being::calcDirection(const int dstX, const int dstY) const +uint8_t Being::calcDirection(const int dstX, + const int dstY) const restrict2 { uint8_t dir = 0; if (dstX > mX) @@ -1658,7 +1674,7 @@ uint8_t Being::calcDirection(const int dstX, const int dstY) const return dir; } -void Being::nextTile() +void Being::nextTile() restrict2 { if (mPath.empty()) { @@ -1702,7 +1718,7 @@ void Being::nextTile() setAction(BeingAction::MOVE, 0); } -void Being::logic() +void Being::logic() restrict2 { BLOCK_START("Being::logic") // Reduce the time that speech is still displayed @@ -1731,7 +1747,7 @@ void Being::logic() } for_each_badges() { - AnimatedSprite *const sprite = mBadges[f]; + AnimatedSprite *restrict const sprite = mBadges[f]; if (sprite) sprite->update(time); } @@ -1843,7 +1859,7 @@ void Being::logic() pet->petLogic(); } - const SoundInfo *const sound = mNextSound.sound; + const SoundInfo *restrict const sound = mNextSound.sound; if (sound) { const int time2 = tick_time; @@ -1859,7 +1875,7 @@ void Being::logic() BLOCK_END("Being::logic") } -void Being::petLogic() +void Being::petLogic() restrict2 { if (!mOwner || !mMap || !mInfo) return; @@ -2036,9 +2052,9 @@ void Being::petLogic() } } -void Being::drawEmotion(Graphics *const graphics, +void Being::drawEmotion(Graphics *restrict const graphics, const int offsetX, - const int offsetY) const + const int offsetY) const restrict2 { const int px = getPixelX() - offsetX - mapTileSize / 2; const int py = getPixelY() - offsetY - mapTileSize * 2 - mapTileSize; @@ -2050,7 +2066,7 @@ void Being::drawEmotion(Graphics *const graphics, int y; if (mShowBadges == 2 && mDispName && gui) { - Font *const font = gui->getFont(); + Font *restrict const font = gui->getFont(); x = mDispName->getX() - offsetX + mDispName->getWidth(); y = mDispName->getY() - offsetY - font->getHeight(); } @@ -2066,7 +2082,7 @@ void Being::drawEmotion(Graphics *const graphics, } for_each_badges() { - AnimatedSprite *const sprite = mBadges[f]; + AnimatedSprite *restrict const sprite = mBadges[f]; if (sprite) { sprite->draw(graphics, x, y); @@ -2078,7 +2094,8 @@ void Being::drawEmotion(Graphics *const graphics, mEmotionSprite->draw(graphics, px, py); } -void Being::drawSpeech(const int offsetX, const int offsetY) +void Being::drawSpeech(const int offsetX, + const int offsetY) restrict2 { if (mSpeech.empty()) return; @@ -2130,7 +2147,8 @@ void Being::drawSpeech(const int offsetX, const int offsetY) } } -int Being::getOffset(const signed char pos, const signed char neg) const +int Being::getOffset(const signed char pos, + const signed char neg) const restrict2 { // Check whether we're walking in the requested direction if (mAction != BeingAction::MOVE || !(mDirection & (pos | neg))) @@ -2166,7 +2184,7 @@ int Being::getOffset(const signed char pos, const signed char neg) const return offset; } -void Being::updateCoords() +void Being::updateCoords() restrict2 { if (!mDispName) return; @@ -2185,28 +2203,28 @@ void Being::updateCoords() mDispName->adviseXY(offsetX, offsetY, mMoveNames); } -void Being::optionChanged(const std::string &value) +void Being::optionChanged(const std::string &restrict value) restrict2 { if (mType == ActorType::Player && value == "visiblenames") setShowName(config.getBoolValue("visiblenames")); } -void Being::flashName(const int time) +void Being::flashName(const int time) restrict2 { if (mDispName) mDispName->flash(time); } -std::string Being::getGenderSignWithSpace() const +std::string Being::getGenderSignWithSpace() const restrict2 { - const std::string &str = getGenderSign(); + const std::string &restrict str = getGenderSign(); if (str.empty()) return str; else return std::string(" ").append(str); } -std::string Being::getGenderSign() const +std::string Being::getGenderSign() const restrict2 { std::string str; if (mShowGender) @@ -2234,7 +2252,7 @@ std::string Being::getGenderSign() const return str; } -void Being::showName() +void Being::showName() restrict2 { if (mName.empty()) return; @@ -2289,7 +2307,7 @@ void Being::showName() updateCoords(); } -void Being::setDefaultNameColor(const UserColorIdT defaultColor) +void Being::setDefaultNameColor(const UserColorIdT defaultColor) restrict2 { switch (mTeamId) { @@ -2417,7 +2435,7 @@ void Being::updateSprite(const unsigned int slot, std::string color, const ItemColor colorId, const bool isWeapon, - const bool isTempSprite) + const bool isTempSprite) restrict2 { if (!charServerHandler || slot >= charServerHandler->maxSprite()) return; @@ -2435,7 +2453,7 @@ void Being::setSprite(const unsigned int slot, std::string color, const ItemColor colorId, const bool isWeapon, - const bool isTempSprite) + const bool isTempSprite) restrict2 { if (!charServerHandler || slot >= charServerHandler->maxSprite()) return; @@ -2480,9 +2498,9 @@ void Being::setSprite(const unsigned int slot, else { const ItemInfo &info = ItemDB::get(id); - const std::string &filename = info.getSprite( + const std::string &restrict filename = info.getSprite( mGender, mSubType); - AnimatedSprite *equipmentSprite = nullptr; + AnimatedSprite *restrict equipmentSprite = nullptr; if (!isTempSprite && mType == ActorType::Player) { @@ -2526,31 +2544,35 @@ void Being::setSprite(const unsigned int slot, } } -void Being::setSpriteID(const unsigned int slot, const int id) +void Being::setSpriteID(const unsigned int slot, + const int id) restrict2 { setSprite(slot, id, mSpriteColors[slot]); } -void Being::setSpriteColor(const unsigned int slot, const std::string &color) +void Being::setSpriteColor(const unsigned int slot, + const std::string &restrict color) restrict2 { setSprite(slot, mSpriteIDs[slot], color); } -void Being::setHairStyle(const unsigned int slot, const int id) +void Being::setHairStyle(const unsigned int slot, + const int id) restrict2 { // dumpSprites(); setSprite(slot, id, ItemDB::get(id).getDyeColorsString(mHairColor)); // dumpSprites(); } -void Being::setHairColor(const unsigned int slot, const ItemColor color) +void Being::setHairColor(const unsigned int slot, + const ItemColor color) restrict2 { mHairColor = color; setSprite(slot, mSpriteIDs[slot], ItemDB::get( getSpriteID(slot)).getDyeColorsString(color)); } -void Being::dumpSprites() const +void Being::dumpSprites() const restrict2 { std::vector::const_iterator it1 = mSpriteIDs.begin(); const std::vector::const_iterator it1_end = mSpriteIDs.end(); @@ -2589,7 +2611,7 @@ void Being::load() mNumberOfRaces = races - 100; } -void Being::updateName() +void Being::updateName() restrict2 { if (mShowName) showName(); @@ -2625,9 +2647,10 @@ void Being::reReadConfig() BLOCK_END("Being::reReadConfig") } -bool Being::updateFromCache() +bool Being::updateFromCache() restrict2 { - const BeingCacheEntry *const entry = Being::getCacheEntry(getId()); + const BeingCacheEntry *restrict const entry = + Being::getCacheEntry(getId()); if (entry && entry->getTime() + 120 >= cur_time) { @@ -2670,7 +2693,7 @@ bool Being::updateFromCache() return false; } -void Being::addToCache() const +void Being::addToCache() const restrict2 { if (localPlayer == this) return; @@ -2738,7 +2761,7 @@ BeingCacheEntry* Being::getCacheEntry(const BeingId id) } -void Being::setGender(const GenderT gender) +void Being::setGender(const GenderT gender) restrict2 { if (gender != mGender) { @@ -2757,7 +2780,7 @@ void Being::setGender(const GenderT gender) } } -void Being::showGmBadge(const bool show) +void Being::showGmBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Gm]); if (show && mIsGM && mShowBadges) @@ -2772,7 +2795,7 @@ void Being::showGmBadge(const bool show) updateBadgesCount(); } -void Being::setGM(const bool gm) +void Being::setGM(const bool gm) restrict2 { if (mIsGM != gm) { @@ -2783,7 +2806,7 @@ void Being::setGM(const bool gm) } } -void Being::talkTo() const +void Being::talkTo() const restrict2 { if (!npcHandler) return; @@ -2802,9 +2825,9 @@ void Being::talkTo() const npcHandler->talk(mId); } -void Being::draw(Graphics *const graphics, +void Being::draw(Graphics *restrict const graphics, const int offsetX, - const int offsetY) const + const int offsetY) const restrict2 { if (!mErased) { @@ -2842,8 +2865,8 @@ void Being::draw(Graphics *const graphics, } } -void Being::drawSprites(Graphics *const graphics, - int posX, int posY) const +void Being::drawSprites(Graphics *restrict const graphics, + int posX, int posY) const restrict2 { const int sz = getNumberOfLayers(); for (int f = 0; f < sz; f ++) @@ -2852,7 +2875,7 @@ void Being::drawSprites(Graphics *const graphics, if (rSprite == 1) continue; - Sprite *const sprite = getSprite(mSpriteRemap[f]); + Sprite *restrict const sprite = getSprite(mSpriteRemap[f]); if (sprite) { sprite->setAlpha(mAlpha); @@ -2861,8 +2884,8 @@ void Being::drawSprites(Graphics *const graphics, } } -void Being::drawSpritesSDL(Graphics *const graphics, - int posX, int posY) const +void Being::drawSpritesSDL(Graphics *restrict const graphics, + int posX, int posY) const restrict2 { const unsigned int sz = static_cast(size()); for (unsigned int f = 0; f < sz; f ++) @@ -2871,14 +2894,15 @@ void Being::drawSpritesSDL(Graphics *const graphics, if (rSprite == 1) continue; - const Sprite *const sprite = getSprite(mSpriteRemap[f]); + const Sprite *restrict const sprite = getSprite(mSpriteRemap[f]); if (sprite) sprite->draw(graphics, posX, posY); } } -void Being::drawSpriteAt(Graphics *const graphics, - const int x, const int y) const +void Being::drawSpriteAt(Graphics *restrict const graphics, + const int x, + const int y) const restrict2 { if (!userPalette) { @@ -2956,7 +2980,7 @@ void Being::drawSpriteAt(Graphics *const graphics, } } -void Being::drawHpBar(Graphics *const graphics, +void Being::drawHpBar(Graphics *restrict const graphics, const int maxHP, const int hp, const int damage, @@ -2965,7 +2989,7 @@ void Being::drawHpBar(Graphics *const graphics, const int x, const int y, const int width, - const int height) const + const int height) const restrict2 { if (maxHP <= 0 || !userPalette) return; @@ -3035,7 +3059,7 @@ void Being::drawHpBar(Graphics *const graphics, graphics->fillRectangle(Rect(x + dx, y, width - dx, height)); } -void Being::setHP(const int hp) +void Being::setHP(const int hp) restrict2 { mHP = hp; if (mMaxHP < mHP) @@ -3044,14 +3068,14 @@ void Being::setHP(const int hp) updatePercentHP(); } -void Being::setMaxHP(const int hp) +void Being::setMaxHP(const int hp) restrict2 { mMaxHP = hp; if (mMaxHP < mHP) mMaxHP = mHP; } -void Being::resetCounters() +void Being::resetCounters() restrict2 { mMoveTime = 0; mAttackTime = 0; @@ -3060,7 +3084,7 @@ void Being::resetCounters() mTestTime = cur_time; } -void Being::recalcSpritesOrder() +void Being::recalcSpritesOrder() restrict2 { if (!mEnableReorderSprites) return; @@ -3109,7 +3133,7 @@ void Being::recalcSpritesOrder() if (info.isRemoveSprites()) { - const SpriteToItemMap *const spriteToItems + const SpriteToItemMap *restrict const spriteToItems = info.getSpriteToItemReplaceMap(dir); if (spriteToItems) @@ -3117,7 +3141,7 @@ void Being::recalcSpritesOrder() FOR_EACHP (SpriteToItemMapCIter, itr, spriteToItems) { const int remSprite = itr->first; - const IntMap &itemReplacer = itr->second; + const IntMap &restrict itemReplacer = itr->second; if (remSprite >= 0) { // slot known if (itemReplacer.empty()) @@ -3359,8 +3383,8 @@ void Being::recalcSpritesOrder() } } -int Being::searchSlotValue(const std::vector &slotRemap, - const int val) const +int Being::searchSlotValue(const std::vector &restrict slotRemap, + const int val) const restrict2 { const size_t sz = size(); for (size_t slot = 0; slot < sz; slot ++) @@ -3371,8 +3395,9 @@ int Being::searchSlotValue(const std::vector &slotRemap, return getNumberOfLayers() - 1; } -void Being::searchSlotValueItr(std::vector::iterator &it, int &idx, - std::vector &slotRemap, +void Being::searchSlotValueItr(std::vector::iterator &restrict it, + int &restrict idx, + std::vector &restrict slotRemap, const int val) { // logger->log("searching %d", val); @@ -3395,7 +3420,7 @@ void Being::searchSlotValueItr(std::vector::iterator &it, int &idx, return; } -void Being::updateHit(const int amount) +void Being::updateHit(const int amount) restrict2 { if (amount > 0) { @@ -3406,15 +3431,15 @@ void Being::updateHit(const int amount) } } -Equipment *Being::getEquipment() +Equipment *Being::getEquipment() restrict2 { - Equipment *const eq = new Equipment(); - Equipment::Backend *const bk = new BeingEquipBackend(this); + Equipment *restrict const eq = new Equipment(); + Equipment::Backend *restrict const bk = new BeingEquipBackend(this); eq->setBackend(bk); return eq; } -void Being::undressItemById(const int id) +void Being::undressItemById(const int id) restrict2 { const size_t sz = mSpriteIDs.size(); @@ -3434,7 +3459,7 @@ void Being::clearCache() beingInfoCache.clear(); } -void Being::updateComment() +void Being::updateComment() restrict2 { if (mGotComment || mName.empty()) return; @@ -3443,8 +3468,8 @@ void Being::updateComment() mComment = loadComment(mName, mType); } -std::string Being::loadComment(const std::string &name, - const ActorTypeT &type) +std::string Being::loadComment(const std::string &restrict name, + const ActorTypeT &restrict type) { std::string str; switch (type) @@ -3516,7 +3541,7 @@ void Being::saveComment(const std::string &restrict name, (name + "\n").append(comment)); } -void Being::setState(const uint8_t state) +void Being::setState(const uint8_t state) restrict2 { const bool shop = ((state & BeingFlag::SHOP) != 0); const bool away = ((state & BeingFlag::AWAY) != 0); @@ -3542,7 +3567,8 @@ void Being::setState(const uint8_t state) } } -void Being::setEmote(const uint8_t emotion, const int emote_time) +void Being::setEmote(const uint8_t emotion, + const int emote_time) restrict2 { if ((emotion & BeingFlag::SPECIAL) == BeingFlag::SPECIAL) { @@ -3558,7 +3584,8 @@ void Being::setEmote(const uint8_t emotion, const int emote_time) const EmoteInfo *const info = EmoteDB::get2(emotionIndex, true); if (info) { - const EmoteSprite *const sprite = info->sprites.front(); + const EmoteSprite *restrict const sprite = + info->sprites.front(); if (sprite) { mEmotionSprite = AnimatedSprite::clone(sprite->sprite); @@ -3587,7 +3614,7 @@ void Being::setEmote(const uint8_t emotion, const int emote_time) } } -void Being::updatePercentHP() +void Being::updatePercentHP() restrict2 { if (!mMaxHP) return; @@ -3634,7 +3661,7 @@ GenderT Being::intToGender(const uint8_t sex) } } -int Being::getSpriteID(const int slot) const +int Being::getSpriteID(const int slot) const restrict2 { if (slot < 0 || static_cast(slot) >= mSpriteIDs.size()) return -1; @@ -3642,7 +3669,7 @@ int Being::getSpriteID(const int slot) const return mSpriteIDs[slot]; } -ItemColor Being::getSpriteColor(const int slot) const +ItemColor Being::getSpriteColor(const int slot) const restrict2 { if (slot < 0 || static_cast(slot) >= mSpriteColorsIds.size()) return ItemColor_one; @@ -3650,26 +3677,28 @@ ItemColor Being::getSpriteColor(const int slot) const return mSpriteColorsIds[slot]; } -void Being::addAfkEffect() +void Being::addAfkEffect() restrict2 { addSpecialEffect(mAwayEffect); } -void Being::removeAfkEffect() +void Being::removeAfkEffect() restrict2 { removeSpecialEffect(); } -void Being::addSpecialEffect(const int effect) +void Being::addSpecialEffect(const int effect) restrict2 { - if (effectManager && Particle::enabled - && !mSpecialParticle && effect != -1) + if (effectManager && + Particle::enabled && + !mSpecialParticle && + effect != -1) { mSpecialParticle = effectManager->triggerReturn(effect, this); } } -void Being::removeSpecialEffect() +void Being::removeSpecialEffect() restrict2 { if (effectManager && mSpecialParticle) { @@ -3679,7 +3708,7 @@ void Being::removeSpecialEffect() delete2(mAnimationEffect); } -void Being::updateAwayEffect() +void Being::updateAwayEffect() restrict2 { if (mAway) addAfkEffect(); @@ -3687,19 +3716,19 @@ void Being::updateAwayEffect() removeAfkEffect(); } -void Being::addEffect(const std::string &name) +void Being::addEffect(const std::string &restrict name) restrict2 { delete mAnimationEffect; mAnimationEffect = AnimatedSprite::load( paths.getStringValue("sprites") + name); } -void Being::addPet(const BeingId id) +void Being::addPet(const BeingId id) restrict2 { if (!actorManager || !config.getBoolValue("usepets")) return; - Being *const pet = findChildPet(id); + Being *restrict const pet = findChildPet(id); if (pet) { pet->incUsage(); @@ -3719,25 +3748,25 @@ void Being::addPet(const BeingId id) } } -Being *Being::findChildPet(const BeingId id) +Being *Being::findChildPet(const BeingId id) restrict2 { FOR_EACH (std::vector::iterator, it, mPets) { - Being *const pet = *it; + Being *restrict const pet = *it; if (pet && pet->mId == id) return pet; } return nullptr; } -void Being::removePet(const BeingId id) +void Being::removePet(const BeingId id) restrict2 { if (!actorManager) return; FOR_EACH (std::vector::iterator, it, mPets) { - Being *const pet = *it; + Being *restrict const pet = *it; if (pet && pet->mId == id) { if (!pet->decUsage()) @@ -3752,11 +3781,11 @@ void Being::removePet(const BeingId id) } } -void Being::removeAllPets() +void Being::removeAllPets() restrict2 { FOR_EACH (std::vector::iterator, it, mPets) { - Being *const pet = *it; + Being *restrict const pet = *it; if (pet) { pet->setOwner(nullptr); @@ -3767,7 +3796,7 @@ void Being::removeAllPets() mPets.clear(); } -void Being::updatePets() +void Being::updatePets() restrict2 { removeAllPets(); FOR_EACH (std::vector::const_iterator, it, mSpriteIDs) @@ -3775,14 +3804,14 @@ void Being::updatePets() const int id = *it; if (!id) continue; - const ItemInfo &info = ItemDB::get(id); + const ItemInfo &restrict info = ItemDB::get(id); const BeingId pet = fromInt(info.getPet(), BeingId); if (pet != BeingId_zero) addPet(pet); } } -void Being::unassignPet(const Being *const pet1) +void Being::unassignPet(const Being *restrict const pet1) restrict2 { FOR_EACH (std::vector::iterator, it, mPets) { @@ -3794,7 +3823,8 @@ void Being::unassignPet(const Being *const pet1) } } -void Being::fixPetSpawnPos(int &dstX, int &dstY) const +void Being::fixPetSpawnPos(int &restrict dstX, + int &restrict dstY) const { if (!mInfo || !mOwner) return; @@ -3867,9 +3897,9 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const } void Being::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 { BLOCK_START("Being::playSfx") @@ -3903,13 +3933,13 @@ void Being::playSfx(const SoundInfo &sound, BLOCK_END("Being::playSfx") } -void Being::setLook(const uint16_t look) +void Being::setLook(const uint16_t look) restrict2 { if (mType == ActorType::Player) setSubtype(mSubType, look); } -void Being::setTileCoords(const int x, const int y) +void Being::setTileCoords(const int x, const int y) restrict2 { mX = x; mY = y; @@ -3922,7 +3952,7 @@ void Being::setTileCoords(const int x, const int y) } } -void Being::setMap(Map *const map) +void Being::setMap(Map *restrict const map) restrict2 { ActorSprite::setMap(map); if (mMap) @@ -3934,17 +3964,18 @@ void Being::setMap(Map *const map) } } -void Being::removeAllItemsParticles() +void Being::removeAllItemsParticles() restrict2 { FOR_EACH (SpriteParticleInfoIter, it, mSpriteParticles) delete (*it).second; mSpriteParticles.clear(); } -void Being::addItemParticles(const int id, const SpriteDisplay &display) +void Being::addItemParticles(const int id, + const SpriteDisplay &restrict display) restrict2 { SpriteParticleInfoIter it = mSpriteParticles.find(id); - ParticleInfo *pi = nullptr; + ParticleInfo *restrict pi = nullptr; if (it == mSpriteParticles.end()) { pi = new ParticleInfo(); @@ -3976,12 +4007,12 @@ void Being::addItemParticles(const int id, const SpriteDisplay &display) } } -void Being::removeItemParticles(const int id) +void Being::removeItemParticles(const int id) restrict2 { SpriteParticleInfoIter it = mSpriteParticles.find(id); if (it == mSpriteParticles.end()) return; - ParticleInfo *const pi = (*it).second; + ParticleInfo *restrict const pi = (*it).second; if (pi) { FOR_EACH (std::vector::const_iterator, itp, pi->particles) @@ -3991,11 +4022,11 @@ void Being::removeItemParticles(const int id) mSpriteParticles.erase(it); } -void Being::recreateItemParticles() +void Being::recreateItemParticles() restrict2 { FOR_EACH (SpriteParticleInfoIter, it, mSpriteParticles) { - ParticleInfo *const pi = (*it).second; + ParticleInfo *restrict const pi = (*it).second; if (pi && !pi->files.empty()) { FOR_EACH (std::vector::const_iterator, @@ -4006,7 +4037,8 @@ void Being::recreateItemParticles() FOR_EACH (std::vector::const_iterator, str, pi->files) { - Particle *const p = particleEngine->addEffect(*str, 0, 0); + Particle *const p = particleEngine->addEffect( + *str, 0, 0); controlParticle(p); pi->particles.push_back(p); } @@ -4014,7 +4046,7 @@ void Being::recreateItemParticles() } } -void Being::setTeamId(const uint16_t teamId) +void Being::setTeamId(const uint16_t teamId) restrict2 { if (mTeamId != teamId) { @@ -4024,7 +4056,7 @@ void Being::setTeamId(const uint16_t teamId) } } -void Being::showTeamBadge(const bool show) +void Being::showTeamBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Team]); if (show && mTeamId && mShowBadges) @@ -4038,7 +4070,7 @@ void Being::showTeamBadge(const bool show) updateBadgesCount(); } -void Being::showBadges(const bool show) +void Being::showBadges(const bool show) restrict2 { showTeamBadge(show); showGuildBadge(show); @@ -4050,7 +4082,7 @@ void Being::showBadges(const bool show) showAwayBadge(show); } -void Being::showPartyBadge(const bool show) +void Being::showPartyBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Party]); if (show && !mPartyName.empty() && mShowBadges) @@ -4066,7 +4098,7 @@ void Being::showPartyBadge(const bool show) } -void Being::setPartyName(const std::string &name) +void Being::setPartyName(const std::string &restrict name) restrict2 { if (mPartyName != name) { @@ -4075,7 +4107,7 @@ void Being::setPartyName(const std::string &name) } } -void Being::showShopBadge(const bool show) +void Being::showShopBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Shop]); if (show && mShop && mShowBadges) @@ -4090,7 +4122,7 @@ void Being::showShopBadge(const bool show) updateBadgesCount(); } -void Being::showInactiveBadge(const bool show) +void Being::showInactiveBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Inactive]); if (show && mInactive && mShowBadges) @@ -4105,7 +4137,7 @@ void Being::showInactiveBadge(const bool show) updateBadgesCount(); } -void Being::showAwayBadge(const bool show) +void Being::showAwayBadge(const bool show) restrict2 { delete2(mBadges[BadgeIndex::Away]); if (show && mAway && mShowBadges) @@ -4120,7 +4152,7 @@ void Being::showAwayBadge(const bool show) updateBadgesCount(); } -void Being::updateBadgesCount() +void Being::updateBadgesCount() restrict2 { mBadgesCount = 0; for_each_badges() @@ -4131,13 +4163,13 @@ void Being::updateBadgesCount() } #ifdef EATHENA_SUPPORT -void Being::setChat(ChatObject *const obj) +void Being::setChat(ChatObject *restrict const obj) restrict2 { delete mChat; mChat = obj; } -void Being::setSellBoard(const std::string &text) +void Being::setSellBoard(const std::string &restrict text) restrict2 { mShop = !text.empty() || !mBuyBoard.empty(); mSellBoard = text; @@ -4145,7 +4177,7 @@ void Being::setSellBoard(const std::string &text) showShopBadge(mShop); } -void Being::setBuyBoard(const std::string &text) +void Being::setBuyBoard(const std::string &restrict text) restrict2 { mShop = !text.empty() || !mSellBoard.empty(); mBuyBoard = text; @@ -4154,14 +4186,14 @@ void Being::setBuyBoard(const std::string &text) } #endif -void Being::enableShop(const bool b) +void Being::enableShop(const bool b) restrict2 { mShop = b; updateName(); showShopBadge(mShop); } -bool Being::isBuyShopEnabled() const +bool Being::isBuyShopEnabled() const restrict2 { #ifdef EATHENA_SUPPORT return mShop && (!serverFeatures->haveVending() || !mBuyBoard.empty()); @@ -4170,7 +4202,7 @@ bool Being::isBuyShopEnabled() const #endif } -bool Being::isSellShopEnabled() const +bool Being::isSellShopEnabled() const restrict2 { #ifdef EATHENA_SUPPORT return mShop && (!serverFeatures->haveVending() || !mSellBoard.empty()); @@ -4179,14 +4211,14 @@ bool Being::isSellShopEnabled() const #endif } -void Being::serverRemove() +void Being::serverRemove() restrict2 { // remove some flags what can survive player remove and next visible mTrickDead = false; } #ifdef EATHENA_SUPPORT -void Being::removeHorse() +void Being::removeHorse() restrict2 { delete_all(mUpHorseSprites); mUpHorseSprites.clear(); @@ -4194,7 +4226,7 @@ void Being::removeHorse() mDownHorseSprites.clear(); } -void Being::setRiding(const bool b) +void Being::setRiding(const bool b) restrict2 { if (serverFeatures->haveExtendedRiding()) return; @@ -4207,7 +4239,7 @@ void Being::setRiding(const bool b) setHorse(0); } -void Being::setHorse(const int horseId) +void Being::setHorse(const int horseId) restrict2 { if (mHorseId == horseId) return; @@ -4221,7 +4253,7 @@ void Being::setHorse(const int horseId) { FOR_EACH (SpriteRefs, it, mHorseInfo->downSprites) { - SpriteReference *const ref = *it; + SpriteReference *restrict const ref = *it; AnimatedSprite *const sprite = AnimatedSprite::load( ref->sprite, ref->variant); @@ -4231,8 +4263,8 @@ void Being::setHorse(const int horseId) } FOR_EACH (SpriteRefs, it, mHorseInfo->upSprites) { - SpriteReference *const ref = *it; - AnimatedSprite *const sprite = AnimatedSprite::load( + SpriteReference *restrict const ref = *it; + AnimatedSprite *sprite = AnimatedSprite::load( ref->sprite, ref->variant); mUpHorseSprites.push_back(sprite); @@ -4247,7 +4279,7 @@ void Being::setHorse(const int horseId) } } -void Being::setTrickDead(const bool b) +void Being::setTrickDead(const bool b) restrict2 { if (b != mTrickDead) { @@ -4256,7 +4288,7 @@ void Being::setTrickDead(const bool b) } } -void Being::setSpiritBalls(const unsigned int balls) +void Being::setSpiritBalls(const unsigned int balls) restrict2 { if (!Particle::enabled) { @@ -4278,26 +4310,26 @@ void Being::setSpiritBalls(const unsigned int balls) } void Being::addSpiritBalls(const unsigned int balls, - const int effectId) + const int effectId) restrict2 { if (!effectManager) return; for (unsigned int f = 0; f < balls; f ++) { - Particle *const particle = effectManager->triggerReturn( + Particle *particle = effectManager->triggerReturn( effectId, this); mSpiritParticles.push_back(particle); } } -void Being::removeSpiritBalls(const unsigned int balls) +void Being::removeSpiritBalls(const unsigned int balls) restrict2 { if (!particleEngine) return; for (unsigned int f = 0; f < balls && !mSpiritParticles.empty(); f ++) { - Particle *const particle = mSpiritParticles.back(); + Particle *restrict const particle = mSpiritParticles.back(); mChildParticleEffects.removeLocally(particle); mSpiritParticles.pop_back(); } diff --git a/src/being/being.h b/src/being/being.h index 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 &getGuilds() const A_WARN_UNUSED + const std::map &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(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(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 &getPets() const + const std::vector &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(mPos.y) - mYDiff - mSortOffsetY; } // { return static_cast(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 &slotRemap, - const int val) const A_WARN_UNUSED; + int searchSlotValue(const std::vector &restrict slotRemap, + const int val) const restrict2 A_WARN_UNUSED; - static void searchSlotValueItr(std::vector::iterator &it, + static void searchSlotValueItr(std::vector::iterator &restrict it, int &idx, - std::vector &slotRemap, + std::vector &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 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 mDownHorseSprites; std::vector mUpHorseSprites; std::vector mSpiritParticles; -- cgit v1.2.3-70-g09d2