diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index e1f5f34b0e3..9d669e930e2 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -85,12 +85,12 @@ T ConfigMgr::GetValueDefault(std::string const& name, T def) const { return _config.get(bpt::ptree::path_type(name, '/')); } - catch (bpt::ptree_bad_path) + catch (bpt::ptree_bad_path const&) { TC_LOG_WARN("server.loading", "Missing name %s in config file %s, add \"%s = %s\" to this file", name.c_str(), _filename.c_str(), name.c_str(), std::to_string(def).c_str()); } - catch (bpt::ptree_bad_data) + catch (bpt::ptree_bad_data const&) { TC_LOG_ERROR("server.loading", "Bad value defined for name %s in config file %s, going to use %s instead", name.c_str(), _filename.c_str(), std::to_string(def).c_str()); @@ -106,12 +106,12 @@ std::string ConfigMgr::GetValueDefault(std::string const& name, std { return _config.get(bpt::ptree::path_type(name, '/')); } - catch (bpt::ptree_bad_path) + catch (bpt::ptree_bad_path const&) { TC_LOG_WARN("server.loading", "Missing name %s in config file %s, add \"%s = %s\" to this file", name.c_str(), _filename.c_str(), name.c_str(), def.c_str()); } - catch (bpt::ptree_bad_data) + catch (bpt::ptree_bad_data const&) { TC_LOG_ERROR("server.loading", "Bad value defined for name %s in config file %s, going to use %s instead", name.c_str(), _filename.c_str(), def.c_str()); diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index 7e4a44a9a58..0c8fa924cbb 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -38,8 +38,8 @@ ULONG_PTR execeptionArgs[] = { reinterpret_cast(strdup(message)), reinterpret_cast(_ReturnAddress()) }; \ RaiseException(EXCEPTION_ASSERTION_FAILURE, 0, 2, execeptionArgs); #else -// should be easily accessible in gdb -extern "C" TC_COMMON_API char const* TrinityAssertionFailedMessage = nullptr; + // should be easily accessible in gdb +extern "C" { TC_COMMON_API char const* TrinityAssertionFailedMessage = nullptr; } #define Crash(message) \ TrinityAssertionFailedMessage = strdup(message); \ *((volatile int*)nullptr) = 0; \ diff --git a/src/common/Logging/AppenderConsole.cpp b/src/common/Logging/AppenderConsole.cpp index baed6edc1a4..bffb76438e4 100644 --- a/src/common/Logging/AppenderConsole.cpp +++ b/src/common/Logging/AppenderConsole.cpp @@ -184,10 +184,11 @@ void AppenderConsole::_write(LogMessage const* message) case LOG_LEVEL_FATAL: index = 0; break; - case LOG_LEVEL_ERROR: // No break on purpose + case LOG_LEVEL_ERROR: + /* fallthrough */ default: - index = 1; - break; + index = 1; + break; } SetColor(stdout_stream, _colors[index]); diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 60717616e1e..82232bb36d5 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -254,7 +254,7 @@ size_t utf8length(std::string& utf8str) { return utf8::distance(utf8str.c_str(), utf8str.c_str()+utf8str.size()); } - catch(std::exception) + catch(std::exception const&) { utf8str.clear(); return 0; @@ -276,7 +276,7 @@ void utf8truncate(std::string& utf8str, size_t len) char* oend = utf8::utf16to8(wstr.c_str(), wstr.c_str()+wstr.size(), &utf8str[0]); utf8str.resize(oend-(&utf8str[0])); // remove unused tail } - catch(std::exception) + catch(std::exception const&) { utf8str.clear(); } @@ -291,7 +291,7 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) wsize -= out.remaining(); // remaining unused space wstr[wsize] = L'\0'; } - catch (std::exception) + catch (std::exception const&) { // Replace the converted string with an error message if there is enough space // Otherwise just return an empty string @@ -323,7 +323,7 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr) { utf8::utf8to16(utf8str.c_str(), utf8str.c_str() + utf8str.size(), std::back_inserter(wstr)); } - catch (std::exception) + catch (std::exception const&) { wstr.clear(); return false; @@ -346,7 +346,7 @@ bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str) } utf8str = utf8str2; } - catch(std::exception) + catch(std::exception const&) { utf8str.clear(); return false; @@ -369,7 +369,7 @@ bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str) } utf8str = utf8str2; } - catch(std::exception) + catch(std::exception const&) { utf8str.clear(); return false; @@ -397,31 +397,31 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension) return wname; // Important: end length must be <= MAX_INTERNAL_PLAYER_NAME-MAX_PLAYER_NAME (3 currently) - static std::wstring const a_End = { wchar_t(0x0430), wchar_t(0x0000) }; - static std::wstring const o_End = { wchar_t(0x043E), wchar_t(0x0000) }; - static std::wstring const ya_End = { wchar_t(0x044F), wchar_t(0x0000) }; - static std::wstring const ie_End = { wchar_t(0x0435), wchar_t(0x0000) }; - static std::wstring const i_End = { wchar_t(0x0438), wchar_t(0x0000) }; + static std::wstring const a_End = { wchar_t(0x0430), wchar_t(0x0000) }; + static std::wstring const o_End = { wchar_t(0x043E), wchar_t(0x0000) }; + static std::wstring const ya_End = { wchar_t(0x044F), wchar_t(0x0000) }; + static std::wstring const ie_End = { wchar_t(0x0435), wchar_t(0x0000) }; + static std::wstring const i_End = { wchar_t(0x0438), wchar_t(0x0000) }; static std::wstring const yeru_End = { wchar_t(0x044B), wchar_t(0x0000) }; - static std::wstring const u_End = { wchar_t(0x0443), wchar_t(0x0000) }; - static std::wstring const yu_End = { wchar_t(0x044E), wchar_t(0x0000) }; - static std::wstring const oj_End = { wchar_t(0x043E), wchar_t(0x0439), wchar_t(0x0000) }; + static std::wstring const u_End = { wchar_t(0x0443), wchar_t(0x0000) }; + static std::wstring const yu_End = { wchar_t(0x044E), wchar_t(0x0000) }; + static std::wstring const oj_End = { wchar_t(0x043E), wchar_t(0x0439), wchar_t(0x0000) }; static std::wstring const ie_j_End = { wchar_t(0x0435), wchar_t(0x0439), wchar_t(0x0000) }; static std::wstring const io_j_End = { wchar_t(0x0451), wchar_t(0x0439), wchar_t(0x0000) }; - static std::wstring const o_m_End = { wchar_t(0x043E), wchar_t(0x043C), wchar_t(0x0000) }; + static std::wstring const o_m_End = { wchar_t(0x043E), wchar_t(0x043C), wchar_t(0x0000) }; static std::wstring const io_m_End = { wchar_t(0x0451), wchar_t(0x043C), wchar_t(0x0000) }; static std::wstring const ie_m_End = { wchar_t(0x0435), wchar_t(0x043C), wchar_t(0x0000) }; static std::wstring const soft_End = { wchar_t(0x044C), wchar_t(0x0000) }; - static std::wstring const j_End = { wchar_t(0x0439), wchar_t(0x0000) }; + static std::wstring const j_End = { wchar_t(0x0439), wchar_t(0x0000) }; - static std::array, 6> const dropEnds = { { + static std::array, 6> const dropEnds = {{ { &a_End, &o_End, &ya_End, &ie_End, &soft_End, &j_End, nullptr }, { &a_End, &ya_End, &yeru_End, &i_End, nullptr, nullptr, nullptr }, { &ie_End, &u_End, &yu_End, &i_End, nullptr, nullptr, nullptr }, { &u_End, &yu_End, &o_End, &ie_End, &soft_End, &ya_End, &a_End }, { &oj_End, &io_j_End, &ie_j_End, &o_m_End, &io_m_End, &ie_m_End, &yu_End }, { &ie_End, &i_End, nullptr, nullptr, nullptr, nullptr, nullptr } - } }; + }}; std::size_t const thisLen = wname.length(); std::array const& endings = dropEnds[declension]; @@ -432,8 +432,8 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension) if (!(endLen <= thisLen)) continue; - if (wname.substr(thisLen - endLen, thisLen) == ending) - return wname.substr(0, thisLen - endLen); + if (wname.substr(thisLen-endLen, thisLen) == ending) + return wname.substr(0, thisLen-endLen); } return wname; diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index 1f402553a1f..58c8ad46bae 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -512,9 +512,8 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo, uint8 attempts /*= 5*/) mysql_close(GetHandle()); m_Mysql = nullptr; } - - /*no break*/ } + /* fallthrough */ case CR_CONN_HOST_ERROR: { TC_LOG_INFO("sql.sql", "Attempting to reconnect to the MySQL server..."); diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp index 563bc8b493c..8a35ae7d571 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -306,7 +306,7 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks, { case MODE_APPLY: speed = Apply(availableQuery.first); - /*no break*/ + /* fallthrough */ case MODE_REHASH: UpdateEntry(file, speed); break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 0e49a7a477f..e49cbce56b0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1196,7 +1196,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invoker cast action, but event does not provide any invoker!", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); return false; } - // no break + /* fallthrough */ case SMART_ACTION_SELF_CAST: case SMART_ACTION_ADD_AURA: if (!IsSpellValid(e, e.action.cast.spell)) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 3c93acbd3ff..74c18c388d8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -203,6 +203,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) case AV_QUEST_A_BOSS1: case AV_QUEST_H_BOSS1: m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item.. + /* fallthrough */ case AV_QUEST_A_BOSS2: case AV_QUEST_H_BOSS2: m_Team_QuestStatus[team][4]++; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 980f480e1f5..5e33dab77aa 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -746,11 +746,11 @@ bool BattlegroundSA::CanInteractWithObject(uint32 objectId) case BG_SA_TITAN_RELIC: if (GateStatus[BG_SA_ANCIENT_GATE] != BG_SA_GATE_DESTROYED || GateStatus[BG_SA_YELLOW_GATE] != BG_SA_GATE_DESTROYED) return false; - // no break + /* fallthrough */ case BG_SA_CENTRAL_FLAG: if (GateStatus[BG_SA_RED_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_PURPLE_GATE] != BG_SA_GATE_DESTROYED) return false; - // no break + /* fallthrough */ case BG_SA_LEFT_FLAG: case BG_SA_RIGHT_FLAG: if (GateStatus[BG_SA_GREEN_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_BLUE_GATE] != BG_SA_GATE_DESTROYED) diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 2d033b54433..27c2dfad516 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1983,7 +1983,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const TC_LOG_ERROR("sql.sql", "%s has invalid state mask (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue2); return false; } - // intentional missing break + /* fallthrough */ case CONDITION_QUESTREWARDED: case CONDITION_QUESTTAKEN: case CONDITION_QUEST_NONE: diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp index ca36e89e268..b1386a43c80 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.cpp +++ b/src/server/game/DungeonFinding/LFGGroupData.cpp @@ -40,10 +40,11 @@ void LfgGroupData::SetState(LfgState state) case LFG_STATE_NONE: m_Dungeon = 0; m_KicksLeft = LFG_GROUP_MAX_KICKS; + /* fallthrough */ case LFG_STATE_FINISHED_DUNGEON: case LFG_STATE_DUNGEON: m_OldState = state; - // No break on purpose + /* fallthrough */ default: m_State = state; } diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 00ead6c63eb..3600a225142 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -535,7 +535,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const joinData.result = LFG_JOIN_DUNGEON_INVALID; else rDungeonId = (*dungeons.begin()); - // No break on purpose (Random can only be dungeon or heroic dungeon) + /* fallthrough - Random can only be dungeon or heroic dungeon */ case LFG_TYPE_HEROIC: case LFG_TYPE_DUNGEON: if (isRaid) diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index 8a297f24956..f4a85760a85 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp @@ -40,10 +40,10 @@ void LfgPlayerData::SetState(LfgState state) m_Roles = 0; m_SelectedDungeons.clear(); m_Comment.clear(); - // No break on purpose + /* fallthrough */ case LFG_STATE_DUNGEON: m_OldState = state; - // No break on purpose + /* fallthrough */ default: m_State = state; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 4e2c2ddf535..c5ca5be3fa6 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -433,6 +433,7 @@ void GameObject::Update(uint32 diff) } // NO BREAK for switch (m_lootState) } + /* fallthrough */ case GO_READY: { if (m_respawnCompatibilityMode) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8b1a81cda71..acd8e828b39 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7251,7 +7251,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto break; } } - /// Intentional fallback. Calculate critical strike chance for both Ranged and Melee spells + /* fallthrough - Calculate critical strike chance for both Ranged and Melee spells*/ case SPELL_DAMAGE_CLASS_RANGED: { if (victim) diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 61504997d08..64752d1c5d1 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -291,7 +291,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe case REACT_PASSIVE: //passive pet->AttackStop(); pet->ClearInPetCombat(); - // no break; + /* fallthrough */ case REACT_DEFENSIVE: //recovery case REACT_AGGRESSIVE: //activete case REACT_ASSIST: diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 8d0e680b7ec..bd4ed5fbe7b 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2341,7 +2341,7 @@ void UnitAura::FillTargetMap(std::unordered_map& targets, Unit* ca case SPELL_EFFECT_APPLY_AREA_AURA_PET: if (!condList || sConditionMgr->IsObjectMeetToConditions(GetUnitOwner(), ref, *condList)) units.push_back(GetUnitOwner()); - // no break + /* fallthrough */ case SPELL_EFFECT_APPLY_AREA_AURA_OWNER: { if (Unit* owner = GetUnitOwner()->GetCharmerOrOwner()) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6a0bdc668a9..e652e105172 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3237,7 +3237,7 @@ void Spell::cancel() { case SPELL_STATE_PREPARING: CancelGlobalCooldown(); - // no break + /* fallthrough */ case SPELL_STATE_DELAYED: SendInterrupted(0); SendCastResult(SPELL_FAILED_INTERRUPTED); @@ -5838,7 +5838,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint case SUMMON_CATEGORY_PET: if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && m_caster->GetPetGUID()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; - // intentional missing break, check both GetPetGUID() and GetCharmGUID for SUMMON_CATEGORY_PET + /* fallthrough - check both GetPetGUID() and GetCharmGUID for SUMMON_CATEGORY_PET*/ case SUMMON_CATEGORY_PUPPET: if (m_caster->GetCharmGUID()) return SPELL_FAILED_ALREADY_HAVE_CHARM; @@ -6783,7 +6783,7 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 / return SPELL_FAILED_DONT_REPORT; } } - // no break + /* fallthrough */ case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC: { Item* targetItem = m_targets.GetItemTarget(); @@ -8137,7 +8137,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) case TARGET_CHECK_RAID_CLASS: if (_referer->getClass() != unitTarget->getClass()) return false; - // nobreak; + /* fallthrough */ case TARGET_CHECK_RAID: if (unitTarget->IsTotem()) return false; diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 4b1efc9420a..854019ec3c7 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -184,7 +184,7 @@ uint32 SpellImplicitTargetInfo::GetExplicitTargetMask(bool& srcSet, bool& dstSet targetMask = TARGET_FLAG_UNIT_PASSENGER; break; case TARGET_CHECK_RAID_CLASS: - // nobreak; + /* fallthrough */ default: targetMask = TARGET_FLAG_UNIT; break; @@ -2363,6 +2363,7 @@ void SpellInfo::_LoadSpellSpecific() /// @workaround For non-stacking tracking spells (We need generic solution) if (Id == 30645) // Gas Cloud Tracking return SPELL_SPECIFIC_NORMAL; + /* fallthrough */ case SPELL_AURA_TRACK_RESOURCES: case SPELL_AURA_TRACK_STEALTHED: return SPELL_SPECIFIC_TRACKER; @@ -2755,7 +2756,7 @@ void SpellInfo::_LoadImmunityInfo() immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT); immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE); immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR); - // no break intended + /* fallthrough */ case 61869: // Overload case 63481: case 61887: // Lightning Tendrils diff --git a/src/server/scripts/Commands/cs_script_loader.cpp b/src/server/scripts/Commands/cs_script_loader.cpp index 38651abc8d9..81d515f1e77 100644 --- a/src/server/scripts/Commands/cs_script_loader.cpp +++ b/src/server/scripts/Commands/cs_script_loader.cpp @@ -57,6 +57,7 @@ void AddSC_tele_commandscript(); void AddSC_ticket_commandscript(); void AddSC_titles_commandscript(); void AddSC_wp_commandscript(); +void AddSC_dev_commandscript(); // The name of this function should match: // void Add${NameOfDirectory}Scripts() @@ -103,4 +104,5 @@ void AddCommandsScripts() AddSC_ticket_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); + AddSC_dev_commandscript(); }