diff options
| author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-13 16:35:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-13 16:35:31 +0200 |
| commit | 10be49bdfe6bd1f4d8e0eaf3a1b4354c5a57a2a9 (patch) | |
| tree | f19f3e8e6d8fc903bac6f23db13b3c9e1e40e30c /src/server/game/AI/ScriptedAI | |
| parent | 5af8ff2b84a0c81ce3aa03f338ce838747b2f25e (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
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 691ca506ede..bd47759817b 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -278,13 +278,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 8e9d6827798..d945512a9bf 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()) |
