From 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Feb 2016 16:18:13 +0300 Subject: Replace most static_cast to shorter versions from defines. --- src/spellmanager.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/spellmanager.cpp') diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index d9b8e757e..07ee344f7 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -59,7 +59,7 @@ SpellManager::~SpellManager() TextCommand* SpellManager::getSpell(const int spellId) const { - if (spellId < 0 || static_cast(spellId) >= mSpells.size()) + if (spellId < 0 || CAST_SIZE(spellId) >= mSpells.size()) return nullptr; const std::map::const_iterator @@ -97,7 +97,7 @@ bool SpellManager::addSpell(TextCommand *const spell) return false; const int id = spell->getId(); - if (id < 0 || id >= static_cast(SPELL_SHORTCUT_ITEMS + if (id < 0 || id >= CAST_S32(SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS)) { delete spell; @@ -139,12 +139,12 @@ void SpellManager::invoke(const int spellId) const #ifdef TMWA_SUPPORT if (spell->getCommandType() == TextCommandType::Text || (playerHandler->canUseMagic() && - PlayerInfo::getSkillLevel(static_cast(MagicSchool::SkillMagic)) - >= static_cast(spell->getBaseLvl()) && - PlayerInfo::getSkillLevel(static_cast( - spell->getSchool())) >= static_cast(spell->getSchoolLvl()) + PlayerInfo::getSkillLevel(CAST_S32(MagicSchool::SkillMagic)) + >= CAST_S32(spell->getBaseLvl()) && + PlayerInfo::getSkillLevel(CAST_S32( + spell->getSchool())) >= CAST_S32(spell->getSchoolLvl()) && PlayerInfo::getAttribute(Attributes::MP) - >= static_cast(spell->getMana())) + >= CAST_S32(spell->getMana())) ) #endif { @@ -246,7 +246,7 @@ std::string SpellManager::parseCommand(std::string command, TextCommand *SpellManager::createNewSpell() const { - return new TextCommand(static_cast(mSpellsVector.size())); + return new TextCommand(CAST_U32(mSpellsVector.size())); } void SpellManager::load(const bool oldConfig) @@ -336,16 +336,16 @@ void SpellManager::save() const #ifdef TMWA_SUPPORT serverConfig.setValue("commandShortcutFlags" + toString(i), strprintf("%u %u %u %u %u %u", - static_cast(spell->getCommandType()), - static_cast(spell->getTargetType()), + CAST_U32(spell->getCommandType()), + CAST_U32(spell->getTargetType()), spell->getBaseLvl(), - static_cast(spell->getSchool()), + CAST_U32(spell->getSchool()), spell->getSchoolLvl(), - static_cast(spell->getMana()))); + CAST_U32(spell->getMana()))); #else serverConfig.setValue("commandShortcutFlags" + toString(i), strprintf("%u %u %u %u %u %u", 1U, - static_cast(spell->getTargetType()), + CAST_U32(spell->getTargetType()), 0U, 0U, 0U, -- cgit v1.2.3-60-g2f50