diff --git a/CMakeLists.txt b/CMakeLists.txt index c3a4b080..ad1dab96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # MaNGOS is a full featured server for World of Warcraft, supporting # the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 # -# Copyright (C) 2005-2020 MaNGOS project +# Copyright (C) 2005-2020 MaNGOS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/game/Object/GMTicketMgr.h b/src/game/Object/GMTicketMgr.h index 0bc8baff..ccec2cc5 100644 --- a/src/game/Object/GMTicketMgr.h +++ b/src/game/Object/GMTicketMgr.h @@ -214,7 +214,9 @@ class GMTicketMgr { GMTicketIdMap::iterator itr = m_GMTicketIdMap.find(id); if (itr == m_GMTicketIdMap.end()) + { return NULL; + } return itr->second; } diff --git a/src/game/Object/Totem.cpp b/src/game/Object/Totem.cpp index 8508dca4..64cfa891 100644 --- a/src/game/Object/Totem.cpp +++ b/src/game/Object/Totem.cpp @@ -219,7 +219,9 @@ bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex // Mana Spring, Healing stream, Mana tide // Flags : 0x00000002000 | 0x00000004000 | 0x00004000000 -> 0x00004006000 if (spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && spellInfo->IsFitToFamilyMask(UI64LIT(0x00004006000))) + { return false; + } switch (spellInfo->Effect[index]) { diff --git a/src/game/WorldHandlers/DisableMgr.cpp b/src/game/WorldHandlers/DisableMgr.cpp index 587e80ca..8933682d 100644 --- a/src/game/WorldHandlers/DisableMgr.cpp +++ b/src/game/WorldHandlers/DisableMgr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2020 MaNGOS + * Copyright (C) 2015-2020 MaNGOS * Copyright (C) 2008-2015 TrinityCore * Copyright (C) 2005-2009 MaNGOS * diff --git a/src/game/WorldHandlers/DisableMgr.h b/src/game/WorldHandlers/DisableMgr.h index f12fca6e..83931716 100644 --- a/src/game/WorldHandlers/DisableMgr.h +++ b/src/game/WorldHandlers/DisableMgr.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2020 MaNGOS project + * Copyright (C) 2015-2020 MaNGOS project * Copyright (C) 2008-2015 TrinityCore * Copyright (C) 2005-2009 MaNGOS * diff --git a/src/game/vmap/ModelInstance.cpp b/src/game/vmap/ModelInstance.cpp index 90501117..26f6c2d8 100644 --- a/src/game/vmap/ModelInstance.cpp +++ b/src/game/vmap/ModelInstance.cpp @@ -71,7 +71,9 @@ namespace VMAP void ModelInstance::GetAreaInfo(const G3D::Vector3& p, AreaInfo& info) const { if (!iModel) + { return; + } // M2 files don't contain area info, only WMO files if (flags & MOD_M2) @@ -106,7 +108,9 @@ namespace VMAP bool ModelInstance::GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const { if (!iModel) + { return false; + } // M2 files don't contain area info, only WMO files if (flags & MOD_M2) diff --git a/src/game/vmap/VMapManager2.cpp b/src/game/vmap/VMapManager2.cpp index 107cea88..387350f9 100644 --- a/src/game/vmap/VMapManager2.cpp +++ b/src/game/vmap/VMapManager2.cpp @@ -152,7 +152,9 @@ namespace VMAP bool VMapManager2::isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) { if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(pMapId, VMAP_DISABLE_LOS)) + { return true; + } bool result = true; InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); @@ -253,9 +255,13 @@ namespace VMAP floor = info.ground_Z; type = info.hitModel->GetLiquidType(); if (ReqLiquidType && !(type & ReqLiquidType)) + { return false; + } if (info.hitInstance->GetLiquidLevel(pos, info, level)) + { return true; + } } } } diff --git a/src/modules/Bots/playerbot/strategy/Event.cpp b/src/modules/Bots/playerbot/strategy/Event.cpp index 1529c9d1..0fdf4cce 100644 --- a/src/modules/Bots/playerbot/strategy/Event.cpp +++ b/src/modules/Bots/playerbot/strategy/Event.cpp @@ -8,7 +8,9 @@ using namespace ai; ObjectGuid Event::getObject() { if (packet.empty()) + { return ObjectGuid(); + } WorldPacket p(packet); p.rpos(0); diff --git a/src/modules/Bots/playerbot/strategy/actions/AreaTriggerAction.cpp b/src/modules/Bots/playerbot/strategy/actions/AreaTriggerAction.cpp index 011d05d6..57d3c426 100644 --- a/src/modules/Bots/playerbot/strategy/actions/AreaTriggerAction.cpp +++ b/src/modules/Bots/playerbot/strategy/actions/AreaTriggerAction.cpp @@ -15,7 +15,9 @@ bool ReachAreaTriggerAction::Execute(Event event) AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId); if(!atEntry) + { return false; + } AreaTrigger const* at = sObjectMgr.GetAreaTrigger(triggerId); if (!at) @@ -65,11 +67,15 @@ bool AreaTriggerAction::Execute(Event event) AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId); if(!atEntry) + { return false; + } AreaTrigger const* at = sObjectMgr.GetAreaTrigger(triggerId); if (!at) + { return true; + } ai->ChangeStrategy("-follow,+stay", BOT_STATE_NON_COMBAT); diff --git a/src/modules/Bots/playerbot/strategy/actions/GenericSpellActions.cpp b/src/modules/Bots/playerbot/strategy/actions/GenericSpellActions.cpp index 74565d26..3f3abb05 100644 --- a/src/modules/Bots/playerbot/strategy/actions/GenericSpellActions.cpp +++ b/src/modules/Bots/playerbot/strategy/actions/GenericSpellActions.cpp @@ -12,7 +12,9 @@ bool CastSpellAction::Execute(Event event) bool CastSpellAction::isPossible() { if (AI_VALUE2(float, "distance", GetTargetName()) > range) + { return false; + } return ai->CanCastSpell(spell, GetTarget()); } @@ -30,7 +32,9 @@ bool CastAuraSpellAction::isUseful() bool CastEnchantItemAction::isUseful() { if (!CastSpellAction::isUseful()) + { return false; + } uint32 spellId = AI_VALUE2(uint32, "spell id", spell); return spellId && AI_VALUE2(Item*, "item for spell", spellId); diff --git a/src/modules/Bots/playerbot/strategy/actions/LogLevelAction.cpp b/src/modules/Bots/playerbot/strategy/actions/LogLevelAction.cpp index e93de7c2..f4869cfd 100644 --- a/src/modules/Bots/playerbot/strategy/actions/LogLevelAction.cpp +++ b/src/modules/Bots/playerbot/strategy/actions/LogLevelAction.cpp @@ -41,11 +41,19 @@ string LogLevelAction::logLevel2string(LogLevel level) LogLevel LogLevelAction::string2logLevel(string level) { if (level == "debug") + { return LOG_LVL_DEBUG; + } else if (level == "minimal") + { return LOG_LVL_MINIMAL; + } else if (level == "detail") + { return LOG_LVL_DETAIL; + } else + { return LOG_LVL_BASIC; + } } diff --git a/src/modules/Bots/playerbot/strategy/actions/ReleaseSpiritAction.h b/src/modules/Bots/playerbot/strategy/actions/ReleaseSpiritAction.h index 155d5946..820dddc8 100644 --- a/src/modules/Bots/playerbot/strategy/actions/ReleaseSpiritAction.h +++ b/src/modules/Bots/playerbot/strategy/actions/ReleaseSpiritAction.h @@ -14,7 +14,9 @@ namespace ai virtual bool Execute(Event event) { if (bot->IsAlive() || bot->GetCorpse()) + { return false; + } ai->ChangeStrategy("-follow,+stay", BOT_STATE_NON_COMBAT); diff --git a/src/modules/Bots/playerbot/strategy/triggers/WithinAreaTrigger.h b/src/modules/Bots/playerbot/strategy/triggers/WithinAreaTrigger.h index d6eb6cfd..82a7671b 100644 --- a/src/modules/Bots/playerbot/strategy/triggers/WithinAreaTrigger.h +++ b/src/modules/Bots/playerbot/strategy/triggers/WithinAreaTrigger.h @@ -14,15 +14,21 @@ namespace ai LastMovement& movement = context->GetValue("last movement")->Get(); if (!movement.lastAreaTrigger) + { return false; + } AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(movement.lastAreaTrigger); if(!atEntry) + { return false; + } AreaTrigger const* at = sObjectMgr.GetAreaTrigger(movement.lastAreaTrigger); if (!at) + { return false; + } return IsPointInAreaTriggerZone(atEntry, bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 0.5f); } diff --git a/src/modules/Bots/playerbot/strategy/values/CurrentTargetValue.cpp b/src/modules/Bots/playerbot/strategy/values/CurrentTargetValue.cpp index cd720bca..2ddf9596 100644 --- a/src/modules/Bots/playerbot/strategy/values/CurrentTargetValue.cpp +++ b/src/modules/Bots/playerbot/strategy/values/CurrentTargetValue.cpp @@ -9,11 +9,15 @@ Unit* CurrentTargetValue::Get() if (selection.IsEmpty()) + { return NULL; + } Unit* unit = sObjectAccessor.GetUnit(*bot, selection); if (unit && !bot->IsWithinLOSInMap(unit)) + { return NULL; + } return unit; } diff --git a/src/modules/Bots/playerbot/strategy/values/IsBehindValue.h b/src/modules/Bots/playerbot/strategy/values/IsBehindValue.h index 002f2f12..714c00b2 100644 --- a/src/modules/Bots/playerbot/strategy/values/IsBehindValue.h +++ b/src/modules/Bots/playerbot/strategy/values/IsBehindValue.h @@ -12,7 +12,9 @@ namespace ai { Unit* target = AI_VALUE(Unit*, qualifier); if (!target) + { return false; + } float targetOrientation = target->GetOrientation(); diff --git a/src/modules/Bots/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp b/src/modules/Bots/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp index 3c9c83a8..f2ab8aa1 100644 --- a/src/modules/Bots/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp +++ b/src/modules/Bots/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp @@ -15,7 +15,9 @@ public: { Pet* pet = dynamic_cast(unit); if (pet && (pet->getPetType() == MINI_PET || pet->getPetType() == SUMMON_PET)) + { return false; + } return unit->IsAlive() && !ai->HasAura(aura, unit); } diff --git a/src/modules/Bots/playerbot/strategy/values/SpellCastUsefulValue.cpp b/src/modules/Bots/playerbot/strategy/values/SpellCastUsefulValue.cpp index 73e8e03d..8f37338e 100644 --- a/src/modules/Bots/playerbot/strategy/values/SpellCastUsefulValue.cpp +++ b/src/modules/Bots/playerbot/strategy/values/SpellCastUsefulValue.cpp @@ -9,15 +9,11 @@ bool SpellCastUsefulValue::Calculate() { uint32 spellid = AI_VALUE2(uint32, "spell id", qualifier); if (!spellid) - { return true; // there can be known alternatives - } SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid); if (!spellInfo) - { return true; // there can be known alternatives - } if (spellInfo->Attributes & SPELL_ATTR_ON_NEXT_SWING_1 || spellInfo->Attributes & SPELL_ATTR_ON_NEXT_SWING_2) diff --git a/src/modules/SD3 b/src/modules/SD3 index 385cc36e..27c55d65 160000 --- a/src/modules/SD3 +++ b/src/modules/SD3 @@ -1 +1 @@ -Subproject commit 385cc36e8c3014f7cb3a9b59d9fcd2152ed35bd0 +Subproject commit 27c55d658c52d3d93c3165a9fb73838ca5fea6c1 diff --git a/src/realmd b/src/realmd index 96b47228..53f9d558 160000 --- a/src/realmd +++ b/src/realmd @@ -1 +1 @@ -Subproject commit 96b47228fb4ba43c257be7a530c295fc9f64c2fe +Subproject commit 53f9d558cd5c73d9808d60a72e4e215040c812cc diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index caa5b45c..879ead61 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -160,7 +160,9 @@ class Field { int64 value = 0; if (!mValue || sscanf(mValue, SI64FMTD, &value) == -1) + { return 0; + } return value; } diff --git a/src/shared/Utilities/Util.cpp b/src/shared/Utilities/Util.cpp index 292660a6..fc7f1aab 100644 --- a/src/shared/Utilities/Util.cpp +++ b/src/shared/Utilities/Util.cpp @@ -453,57 +453,6 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str) typedef wchar_t const* const* wstrlist; -std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) -{ - // supported only Cyrillic cases - if (wname.size() < 1 || !isCyrillicCharacter(wname[0]) || declension > 5) - { - return wname; - } - - // Important: end length must be <= MAX_INTERNAL_PLAYER_NAME-MAX_PLAYER_NAME (3 currently) - - static wchar_t const a_End[] = { wchar_t(1), wchar_t(0x0430), wchar_t(0x0000)}; - static wchar_t const o_End[] = { wchar_t(1), wchar_t(0x043E), wchar_t(0x0000)}; - static wchar_t const ya_End[] = { wchar_t(1), wchar_t(0x044F), wchar_t(0x0000)}; - static wchar_t const ie_End[] = { wchar_t(1), wchar_t(0x0435), wchar_t(0x0000)}; - static wchar_t const i_End[] = { wchar_t(1), wchar_t(0x0438), wchar_t(0x0000)}; - static wchar_t const yeru_End[] = { wchar_t(1), wchar_t(0x044B), wchar_t(0x0000)}; - static wchar_t const u_End[] = { wchar_t(1), wchar_t(0x0443), wchar_t(0x0000)}; - static wchar_t const yu_End[] = { wchar_t(1), wchar_t(0x044E), wchar_t(0x0000)}; - static wchar_t const oj_End[] = { wchar_t(2), wchar_t(0x043E), wchar_t(0x0439), wchar_t(0x0000)}; - static wchar_t const ie_j_End[] = { wchar_t(2), wchar_t(0x0435), wchar_t(0x0439), wchar_t(0x0000)}; - static wchar_t const io_j_End[] = { wchar_t(2), wchar_t(0x0451), wchar_t(0x0439), wchar_t(0x0000)}; - static wchar_t const o_m_End[] = { wchar_t(2), wchar_t(0x043E), wchar_t(0x043C), wchar_t(0x0000)}; - static wchar_t const io_m_End[] = { wchar_t(2), wchar_t(0x0451), wchar_t(0x043C), wchar_t(0x0000)}; - static wchar_t const ie_m_End[] = { wchar_t(2), wchar_t(0x0435), wchar_t(0x043C), wchar_t(0x0000)}; - static wchar_t const soft_End[] = { wchar_t(1), wchar_t(0x044C), wchar_t(0x0000)}; - static wchar_t const j_End[] = { wchar_t(1), wchar_t(0x0439), wchar_t(0x0000)}; - - static wchar_t const* const dropEnds[6][8] = - { - { &a_End[1], &o_End[1], &ya_End[1], &ie_End[1], &soft_End[1], &j_End[1], NULL, NULL }, - { &a_End[1], &ya_End[1], &yeru_End[1], &i_End[1], NULL, NULL, NULL, NULL }, - { &ie_End[1], &u_End[1], &yu_End[1], &i_End[1], NULL, NULL, NULL, NULL }, - { &u_End[1], &yu_End[1], &o_End[1], &ie_End[1], &soft_End[1], &ya_End[1], &a_End[1], NULL }, - { &oj_End[1], &io_j_End[1], &ie_j_End[1], &o_m_End[1], &io_m_End[1], &ie_m_End[1], &yu_End[1], NULL }, - { &ie_End[1], &i_End[1], NULL, NULL, NULL, NULL, NULL, NULL } - }; - - for (wchar_t const * const* itr = &dropEnds[declension][0]; *itr; ++itr) - { - size_t len = size_t((*itr)[-1]); // get length from string size field - - if (wname.substr(wname.size() - len, len) == *itr) - { - return wname.substr(0, wname.size() - len); - } - } - - return wname; -} - - bool utf8ToConsole(const std::string& utf8str, std::string& conStr) { #if PLATFORM == PLATFORM_WINDOWS diff --git a/src/shared/Utilities/Util.h b/src/shared/Utilities/Util.h index 1e4eaf0f..ce972fe2 100644 --- a/src/shared/Utilities/Util.h +++ b/src/shared/Utilities/Util.h @@ -746,8 +746,6 @@ inline void wstrToLower(std::wstring& str) std::transform(str.begin(), str.end(), str.begin(), [](wchar_t w) {return wcharToLower(w); }); } -std::wstring GetMainPartOfName(std::wstring wname, uint32 declension); - /** * @brief *