diff options
| author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-13 16:35:31 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-01-23 00:16:31 +0100 |
| commit | 365ae6ff25a288ea83e192066b9cc162a020a844 (patch) | |
| tree | 98eed04e0b2807290d62259f42310d40ceaf57d2 /src/server/game/AI/ScriptedAI | |
| parent | 1e1679a1f7d9cdecb49f40f8084b46dbfd48577b (diff) | |
Fix some compiler warnings reported by GCC (#25007)
* Core/AI: Remove unneeded null checks
GetMap() can never return NULL.
Fixes additionally -Wunused-variable warnings
reported by GCC.
* Core/GameObject: Fix a -Wunused-variable warning reported by GCC
* Core/Player: Fix a -Wunused-variable warning reported by GCC
* Scritps/CavernsOfTime: Fix -Wimplicit-fallthrough warnings reported by GCC
* Scritps/CavernsOfTime: Fix a -Wmaybe-uninitialized warning reported by GCC
Warning:
/home/peterke/DEV/TrinityCore/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/npc_arthas.cpp: In member function ‘virtual void npc_arthas_stratholme::npc_arthas_stratholmeAI::UpdateAI(uint32)’:
/home/peterke/DEV/TrinityCore/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/npc_arthas.cpp:1119:58: warning: ‘emote’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1119 | (*it)->HandleEmoteCommand(emote);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
* Scritps/PitOfSaron: Fix -Wunused-variable warnings reported by GCC
* Scritps/EyeOfEternity: Fix a -Wclass-memaccess warning reported by GCC
Warning:
/home/peterke/DEV/TrinityCore/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp: In member function ‘virtual void boss_malygos::boss_malygosAI::UpdateAI(uint32)’:
/home/peterke/DEV/TrinityCore/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp:950:81: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class ObjectGuid’; use assignment or value-initialization instead [-Wclass-memaccess]
950 | memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID));
|
* Scritps/CoilfangReservoir: Fix a -Wclass-memaccess warning reported by GCC
Warning:
/home/peterke/DEV/TrinityCore/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp: In member function ‘void boss_leotheras_the_blind::boss_leotheras_the_blindAI::Initialize()’:
/home/peterke/DEV/TrinityCore/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp:220:55: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class ObjectGuid’; use assignment or value-initialization instead [-Wclass-memaccess]
220 | memset(InnderDemon, 0, sizeof(InnderDemon));
| ^
* Scritps/Naxx: Fix a -Wimplicit-fallthrough warning reported by GCC
For discussion see https://github.com/TrinityCore/TrinityCore/pull/25007
(cherry picked from commit 10be49bdfe6bd1f4d8e0eaf3a1b4354c5a57a2a9)
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 9 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 9 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 354d21d5d9f..46085bf79ab 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -276,13 +276,10 @@ void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientati void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */) { // Queue respawn from the point it starts - if (Map* map = me->GetMap()) + if (CreatureData const* cdata = me->GetCreatureData()) { - if (CreatureData const* cdata = me->GetCreatureData()) - { - if (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC)) - me->SaveRespawnTime(me->GetRespawnDelay()); - } + if (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC)) + me->SaveRespawnTime(me->GetRespawnDelay()); } if (me->IsEngaged()) diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 5846a57f8aa..ab8664c6e01 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -156,13 +156,10 @@ void FollowerAI::UpdateFollowerAI(uint32 /*uiDiff*/) void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, uint32 quest) { - if (Map* map = me->GetMap()) + if (CreatureData const* cdata = me->GetCreatureData()) { - if (CreatureData const* cdata = me->GetCreatureData()) - { - if (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC)) - me->SaveRespawnTime(me->GetRespawnDelay()); - } + if (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC)) + me->SaveRespawnTime(me->GetRespawnDelay()); } if (me->IsEngaged()) |
