From f94d87b00fe384df055d197fe957db083e4fd3c6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 13 Jun 2025 19:31:03 +0200 Subject: Core/Scripts: Mark script base class constructors noexcept --- src/server/game/AI/CoreAI/AreaTriggerAI.cpp | 6 +- src/server/game/AI/CoreAI/AreaTriggerAI.h | 6 +- src/server/game/AI/CoreAI/CombatAI.cpp | 4 +- src/server/game/AI/CoreAI/CombatAI.h | 4 +- src/server/game/AI/CoreAI/ConversationAI.cpp | 8 +- src/server/game/AI/CoreAI/ConversationAI.h | 6 +- src/server/game/AI/CoreAI/GameObjectAI.cpp | 4 +- src/server/game/AI/CoreAI/GameObjectAI.h | 8 +- src/server/game/AI/CoreAI/PassiveAI.cpp | 8 +- src/server/game/AI/CoreAI/PassiveAI.h | 8 +- src/server/game/AI/CoreAI/ScheduledChangeAI.cpp | 22 ----- src/server/game/AI/CoreAI/ScheduledChangeAI.h | 2 +- src/server/game/AI/CoreAI/TotemAI.cpp | 2 +- src/server/game/AI/CoreAI/TotemAI.h | 2 +- src/server/game/AI/CreatureAI.cpp | 2 +- src/server/game/AI/CreatureAI.h | 2 +- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 8 +- src/server/game/AI/ScriptedAI/ScriptedCreature.h | 7 +- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 +- src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 2 +- .../game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 2 +- src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h | 2 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 8 +- src/server/game/AI/SmartScripts/SmartScript.h | 4 + .../game/Battlegrounds/BattlegroundScript.cpp | 2 +- src/server/game/Battlegrounds/BattlegroundScript.h | 2 +- src/server/game/Instances/InstanceScript.cpp | 2 +- src/server/game/Instances/InstanceScript.h | 2 +- src/server/game/Maps/ZoneScript.cpp | 2 +- src/server/game/Maps/ZoneScript.h | 2 +- src/server/game/Scripting/ScriptMgr.cpp | 102 ++++++++++----------- src/server/game/Scripting/ScriptMgr.h | 86 ++++++++--------- src/server/game/Spells/SpellScript.cpp | 6 +- src/server/game/Spells/SpellScript.h | 6 +- 34 files changed, 166 insertions(+), 175 deletions(-) delete mode 100644 src/server/game/AI/CoreAI/ScheduledChangeAI.cpp (limited to 'src') diff --git a/src/server/game/AI/CoreAI/AreaTriggerAI.cpp b/src/server/game/AI/CoreAI/AreaTriggerAI.cpp index 73fc3ddcb6c..782e37b6b32 100644 --- a/src/server/game/AI/CoreAI/AreaTriggerAI.cpp +++ b/src/server/game/AI/CoreAI/AreaTriggerAI.cpp @@ -18,11 +18,9 @@ #include "AreaTrigger.h" #include "AreaTriggerAI.h" -AreaTriggerAI::AreaTriggerAI(AreaTrigger* a, uint32 scriptId) : _scriptId(scriptId ? scriptId : a->GetScriptId()), at(a) +AreaTriggerAI::AreaTriggerAI(AreaTrigger* a, uint32 scriptId) noexcept : _scriptId(scriptId ? scriptId : a->GetScriptId()), at(a) { ASSERT(_scriptId, "A AreaTriggerAI was initialized with an invalid scriptId!"); } -AreaTriggerAI::~AreaTriggerAI() -{ -} +AreaTriggerAI::~AreaTriggerAI() = default; diff --git a/src/server/game/AI/CoreAI/AreaTriggerAI.h b/src/server/game/AI/CoreAI/AreaTriggerAI.h index c1639291143..d912c92f9c9 100644 --- a/src/server/game/AI/CoreAI/AreaTriggerAI.h +++ b/src/server/game/AI/CoreAI/AreaTriggerAI.h @@ -32,7 +32,11 @@ class TC_GAME_API AreaTriggerAI protected: AreaTrigger* const at; public: - explicit AreaTriggerAI(AreaTrigger* a, uint32 scriptId = {}); + explicit AreaTriggerAI(AreaTrigger* a, uint32 scriptId = {}) noexcept; + AreaTriggerAI(AreaTriggerAI const&) = delete; + AreaTriggerAI(AreaTriggerAI&&) = delete; + AreaTriggerAI& operator=(AreaTriggerAI const&) = delete; + AreaTriggerAI& operator=(AreaTriggerAI&&) = delete; virtual ~AreaTriggerAI(); // Called when the AreaTrigger has just been initialized, just before added to map diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index b20cf471b0c..502ed6df62b 100644 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -188,7 +188,7 @@ void CasterAI::UpdateAI(uint32 diff) // TurretAI ////////////// -TurretAI::TurretAI(Creature* creature, uint32 scriptId) : CreatureAI(creature, scriptId) +TurretAI::TurretAI(Creature* creature, uint32 scriptId) noexcept : CreatureAI(creature, scriptId) { if (!creature->m_spells[0]) TC_LOG_ERROR("scripts.ai", "TurretAI set for creature with spell1 = 0. AI will do nothing ({})", creature->GetGUID().ToString()); @@ -226,7 +226,7 @@ void TurretAI::UpdateAI(uint32 /*diff*/) // VehicleAI ////////////// -VehicleAI::VehicleAI(Creature* creature, uint32 scriptId) : CreatureAI(creature, scriptId), _hasConditions(false), _conditionsTimer(VEHICLE_CONDITION_CHECK_TIME) +VehicleAI::VehicleAI(Creature* creature, uint32 scriptId) noexcept : CreatureAI(creature, scriptId), _hasConditions(false), _conditionsTimer(VEHICLE_CONDITION_CHECK_TIME) { LoadConditions(); _dismiss = false; diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h index cd861b52398..83f45f806ff 100644 --- a/src/server/game/AI/CoreAI/CombatAI.h +++ b/src/server/game/AI/CoreAI/CombatAI.h @@ -68,7 +68,7 @@ class TC_GAME_API CasterAI : public CombatAI struct TC_GAME_API TurretAI : public CreatureAI { public: - explicit TurretAI(Creature* creature, uint32 scriptId = {}); + explicit TurretAI(Creature* creature, uint32 scriptId = {}) noexcept; bool CanAIAttack(Unit const* who) const override; void AttackStart(Unit* who) override; void UpdateAI(uint32 diff) override; @@ -85,7 +85,7 @@ struct TC_GAME_API TurretAI : public CreatureAI struct TC_GAME_API VehicleAI : public CreatureAI { public: - explicit VehicleAI(Creature* creature, uint32 scriptId = {}); + explicit VehicleAI(Creature* creature, uint32 scriptId = {}) noexcept; void UpdateAI(uint32 diff) override; void MoveInLineOfSight(Unit*) override { } diff --git a/src/server/game/AI/CoreAI/ConversationAI.cpp b/src/server/game/AI/CoreAI/ConversationAI.cpp index 19de90c6ad2..cc4669df37e 100644 --- a/src/server/game/AI/CoreAI/ConversationAI.cpp +++ b/src/server/game/AI/CoreAI/ConversationAI.cpp @@ -15,14 +15,12 @@ * with this program. If not, see . */ -#include "Conversation.h" #include "ConversationAI.h" +#include "Conversation.h" -ConversationAI::ConversationAI(Conversation* c, uint32 scriptId) : _scriptId(scriptId ? scriptId : c->GetScriptId()), conversation(c) +ConversationAI::ConversationAI(Conversation* c, uint32 scriptId) noexcept : _scriptId(scriptId ? scriptId : c->GetScriptId()), conversation(c) { ASSERT(_scriptId, "A ConversationAI was initialized with an invalid scriptId!"); } -ConversationAI::~ConversationAI() -{ -} +ConversationAI::~ConversationAI() = default; diff --git a/src/server/game/AI/CoreAI/ConversationAI.h b/src/server/game/AI/CoreAI/ConversationAI.h index 3a41d0f1b60..0e5776eb9ca 100644 --- a/src/server/game/AI/CoreAI/ConversationAI.h +++ b/src/server/game/AI/CoreAI/ConversationAI.h @@ -32,7 +32,11 @@ class TC_GAME_API ConversationAI protected: Conversation* const conversation; public: - explicit ConversationAI(Conversation* c, uint32 scriptId = {}); + explicit ConversationAI(Conversation* c, uint32 scriptId = {}) noexcept; + ConversationAI(ConversationAI const&) = delete; + ConversationAI(ConversationAI&&) = delete; + ConversationAI& operator=(ConversationAI const&) = delete; + ConversationAI& operator=(ConversationAI&&) = delete; virtual ~ConversationAI(); // Called when the Conversation has just been initialized, just before added to map diff --git a/src/server/game/AI/CoreAI/GameObjectAI.cpp b/src/server/game/AI/CoreAI/GameObjectAI.cpp index 27884286f2b..8c46ea9fbd8 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.cpp +++ b/src/server/game/AI/CoreAI/GameObjectAI.cpp @@ -26,11 +26,13 @@ int32 GameObjectAI::Permissible(GameObject const* /*go*/) return PERMIT_BASE_NO; } -GameObjectAI::GameObjectAI(GameObject* go, uint32 scriptId) : _scriptId(scriptId ? scriptId : go->GetScriptId()), me(go) +GameObjectAI::GameObjectAI(GameObject* go, uint32 scriptId) noexcept : _scriptId(scriptId ? scriptId : go->GetScriptId()), me(go) { ASSERT(_scriptId, "A GameObjectAI was initialized with an invalid scriptId!"); } +GameObjectAI::~GameObjectAI() = default; + Optional GameObjectAI::GetDialogStatus(Player const* /*player*/) { return {}; diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 40e56887244..54306e2cf72 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -50,8 +50,12 @@ class TC_GAME_API GameObjectAI GameObject* const me; public: - explicit GameObjectAI(GameObject* go, uint32 scriptId = {}); - virtual ~GameObjectAI() { } + explicit GameObjectAI(GameObject* go, uint32 scriptId = {}) noexcept; + GameObjectAI(GameObjectAI const&) = delete; + GameObjectAI(GameObjectAI&&) = delete; + GameObjectAI& operator=(GameObjectAI const&) = delete; + GameObjectAI& operator=(GameObjectAI&&) = delete; + virtual ~GameObjectAI(); // Gets the id of the AI (script id) uint32 GetId() const { return _scriptId; } diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index 196e23a1ea9..8905d7fe4ee 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -19,18 +19,18 @@ #include "Creature.h" #include "World.h" -PassiveAI::PassiveAI(Creature* c, uint32 scriptId) : CreatureAI(c, scriptId) +PassiveAI::PassiveAI(Creature* c, uint32 scriptId) noexcept : CreatureAI(c, scriptId) { me->SetReactState(REACT_PASSIVE); me->SetCanMelee(false); } -PossessedAI::PossessedAI(Creature* c, uint32 scriptId) : CreatureAI(c, scriptId) +PossessedAI::PossessedAI(Creature* c, uint32 scriptId) noexcept : CreatureAI(c, scriptId) { me->SetReactState(REACT_PASSIVE); } -NullCreatureAI::NullCreatureAI(Creature* c, uint32 scriptId) : CreatureAI(c, scriptId) +NullCreatureAI::NullCreatureAI(Creature* c, uint32 scriptId) noexcept : CreatureAI(c, scriptId) { me->SetReactState(REACT_PASSIVE); me->SetCanMelee(false); @@ -73,7 +73,7 @@ void PossessedAI::JustDied(Unit* /*u*/) me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); } -CritterAI::CritterAI(Creature* creature, uint32 scriptId) : PassiveAI(creature, scriptId) +CritterAI::CritterAI(Creature* creature, uint32 scriptId) noexcept : PassiveAI(creature, scriptId) { me->SetCanMelee(false, true); } diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h index 2e751ad0d38..3407086920b 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.h +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -24,7 +24,7 @@ class TC_GAME_API PassiveAI : public CreatureAI { public: - explicit PassiveAI(Creature* creature, uint32 scriptId = {}); + explicit PassiveAI(Creature* creature, uint32 scriptId = {}) noexcept; void MoveInLineOfSight(Unit*) override { } void AttackStart(Unit*) override { } @@ -36,7 +36,7 @@ class TC_GAME_API PassiveAI : public CreatureAI class TC_GAME_API PossessedAI : public CreatureAI { public: - explicit PossessedAI(Creature* creature, uint32 scriptId = {}); + explicit PossessedAI(Creature* creature, uint32 scriptId = {}) noexcept; void MoveInLineOfSight(Unit*) override { } void AttackStart(Unit* target) override; @@ -54,7 +54,7 @@ class TC_GAME_API PossessedAI : public CreatureAI class TC_GAME_API NullCreatureAI : public CreatureAI { public: - explicit NullCreatureAI(Creature* creature, uint32 scriptId = {}); + explicit NullCreatureAI(Creature* creature, uint32 scriptId = {}) noexcept; void MoveInLineOfSight(Unit*) override { } void AttackStart(Unit*) override { } @@ -71,7 +71,7 @@ class TC_GAME_API NullCreatureAI : public CreatureAI class TC_GAME_API CritterAI : public PassiveAI { public: - explicit CritterAI(Creature* creature, uint32 scriptId = {}); + explicit CritterAI(Creature* creature, uint32 scriptId = {}) noexcept; void JustEngagedWith(Unit* /*who*/) override; diff --git a/src/server/game/AI/CoreAI/ScheduledChangeAI.cpp b/src/server/game/AI/CoreAI/ScheduledChangeAI.cpp deleted file mode 100644 index 3bb985e80cc..00000000000 --- a/src/server/game/AI/CoreAI/ScheduledChangeAI.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information - * - * 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 the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "ScheduledChangeAI.h" - -ScheduledChangeAI::ScheduledChangeAI(Creature* creature, uint32 scriptId /*= {}*/): CreatureAI(creature, scriptId) -{ -} diff --git a/src/server/game/AI/CoreAI/ScheduledChangeAI.h b/src/server/game/AI/CoreAI/ScheduledChangeAI.h index 0d5970ec00d..fe010d5e412 100644 --- a/src/server/game/AI/CoreAI/ScheduledChangeAI.h +++ b/src/server/game/AI/CoreAI/ScheduledChangeAI.h @@ -23,7 +23,7 @@ class TC_GAME_API ScheduledChangeAI final : public CreatureAI { public: - explicit ScheduledChangeAI(Creature* creature, uint32 scriptId = {}); + using CreatureAI::CreatureAI; void MoveInLineOfSight(Unit*) override { } void AttackStart(Unit*) override { } diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index eb764e26798..dd77a782ac6 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -33,7 +33,7 @@ int32 TotemAI::Permissible(Creature const* creature) return PERMIT_BASE_NO; } -TotemAI::TotemAI(Creature* creature, uint32 scriptId) : NullCreatureAI(creature, scriptId), _victimGUID() +TotemAI::TotemAI(Creature* creature, uint32 scriptId) noexcept : NullCreatureAI(creature, scriptId), _victimGUID() { ASSERT(creature->IsTotem(), "TotemAI: AI assigned to a non-totem creature (%s)!", creature->GetGUID().ToString().c_str()); } diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index d1acb836e41..560fbe619fa 100644 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -26,7 +26,7 @@ class Totem; class TC_GAME_API TotemAI : public NullCreatureAI { public: - explicit TotemAI(Creature* creature, uint32 scriptId = {}); + explicit TotemAI(Creature* creature, uint32 scriptId = {}) noexcept; void AttackStart(Unit* victim) override; diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 4f4a9652706..cf9aaa4a8f6 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -42,7 +42,7 @@ AISpellInfoType* GetAISpellInfo(uint32 spellId, Difficulty difficulty) return Trinity::Containers::MapGetValuePtr(UnitAI::AISpellInfo, { spellId, difficulty }); } -CreatureAI::CreatureAI(Creature* creature, uint32 scriptId) +CreatureAI::CreatureAI(Creature* creature, uint32 scriptId) noexcept : UnitAI(creature), me(creature), _boundary(nullptr), _negateBoundary(false), _scriptId(scriptId ? scriptId : creature->GetScriptId()), _isEngaged(false), _moveInLOSLocked(false) { diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index c732da187d1..953c349bad7 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -67,7 +67,7 @@ class TC_GAME_API CreatureAI : public UnitAI Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, Milliseconds despawnTime = 30s, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); public: - explicit CreatureAI(Creature* creature, uint32 scriptId = {}); + explicit CreatureAI(Creature* creature, uint32 scriptId = {}) noexcept; virtual ~CreatureAI(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 1c950a6b203..6b29dfa074f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -122,9 +122,7 @@ void SummonList::DoActionImpl(int32 action, StorageType& summons, uint16 max) } } -ScriptedAI::ScriptedAI(Creature* creature) : ScriptedAI(creature, creature->GetScriptId()) { } - -ScriptedAI::ScriptedAI(Creature* creature, uint32 scriptId) : CreatureAI(creature, scriptId), _isCombatMovementAllowed(true) +ScriptedAI::ScriptedAI(Creature* creature, uint32 scriptId) noexcept : CreatureAI(creature, scriptId), _isCombatMovementAllowed(true) { _difficulty = me->GetMap()->GetDifficultyID(); } @@ -528,7 +526,7 @@ void ScriptedAI::SetCombatMovement(bool allowMovement) } // BossAI - for instanced bosses -BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature), instance(creature->GetInstanceScript()), summons(creature), _bossId(bossId) +BossAI::BossAI(Creature* creature, uint32 bossId) noexcept : ScriptedAI(creature), instance(creature->GetInstanceScript()), summons(creature), _bossId(bossId) { if (instance) SetBoundary(instance->GetBossBoundary(bossId)); @@ -657,7 +655,7 @@ void BossAI::_DespawnAtEvade(Seconds delayToRespawn /*= 30s*/, Creature* who /*= } // WorldBossAI - for non-instanced bosses -WorldBossAI::WorldBossAI(Creature* creature) : ScriptedAI(creature), summons(creature) { } +WorldBossAI::WorldBossAI(Creature* creature) noexcept : ScriptedAI(creature), summons(creature) { } WorldBossAI::~WorldBossAI() = default; diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 456a2569932..0f46bf4e564 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -133,8 +133,7 @@ class TC_GAME_API DummyEntryCheckPredicate struct TC_GAME_API ScriptedAI : public CreatureAI { public: - explicit ScriptedAI(Creature* creature); - explicit ScriptedAI(Creature* creature, uint32 scriptId); + explicit ScriptedAI(Creature* creature, uint32 scriptId = 0) noexcept; virtual ~ScriptedAI() { } // ************* @@ -308,7 +307,7 @@ struct TC_GAME_API ScriptedAI : public CreatureAI class TC_GAME_API BossAI : public ScriptedAI { public: - BossAI(Creature* creature, uint32 bossId); + explicit BossAI(Creature* creature, uint32 bossId) noexcept; virtual ~BossAI(); InstanceScript* const instance; @@ -355,7 +354,7 @@ class TC_GAME_API BossAI : public ScriptedAI class TC_GAME_API WorldBossAI : public ScriptedAI { public: - WorldBossAI(Creature* creature); + explicit WorldBossAI(Creature* creature) noexcept; virtual ~WorldBossAI(); void JustSummoned(Creature* summon) override; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 1754fa6dfd5..572861113e5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -34,7 +34,7 @@ enum Points POINT_HOME = 0xFFFFFE }; -EscortAI::EscortAI(Creature* creature) : ScriptedAI(creature), _pauseTimer(2500ms), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), +EscortAI::EscortAI(Creature* creature) noexcept : ScriptedAI(creature), _pauseTimer(2500ms), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), _escortQuest(nullptr), _activeAttacker(true), _instantRespawn(false), _returnToStart(false), _despawnAtEnd(true), _despawnAtFar(true), _hasImmuneToNPCFlags(false), _started(false), _ended(false), _resume(false) { diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 85f50f83206..dcb87a0302c 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -36,7 +36,7 @@ enum EscortState : uint32 struct TC_GAME_API EscortAI : public ScriptedAI { public: - explicit EscortAI(Creature* creature); + explicit EscortAI(Creature* creature) noexcept; ~EscortAI() { } void InitializeAI() override; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index c0a5aa3350a..5c048d36f07 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -31,7 +31,7 @@ enum Points POINT_COMBAT_START = 0xFFFFFF }; -FollowerAI::FollowerAI(Creature* creature) : ScriptedAI(creature), _updateFollowTimer(2500), _followState(STATE_FOLLOW_NONE), _questForFollow(0) { } +FollowerAI::FollowerAI(Creature* creature) noexcept : ScriptedAI(creature), _updateFollowTimer(2500), _followState(STATE_FOLLOW_NONE), _questForFollow(0) { } void FollowerAI::MoveInLineOfSight(Unit* who) { diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index d00dea42117..bcd2266f78d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -35,7 +35,7 @@ enum FollowerState : uint32 class TC_GAME_API FollowerAI : public ScriptedAI { public: - explicit FollowerAI(Creature* creature); + explicit FollowerAI(Creature* creature) noexcept; ~FollowerAI() { } void MoveInLineOfSight(Unit*) override; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f4aed3e60fd..3a6054fe3d5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -71,9 +71,11 @@ SmartScript::SmartScript() mAllEventFlags = 0; } -SmartScript::~SmartScript() -{ -} +SmartScript::SmartScript(SmartScript const& other) = default; +SmartScript::SmartScript(SmartScript&& other) noexcept = default; +SmartScript& SmartScript::operator=(SmartScript const& other) = default; +SmartScript& SmartScript::operator=(SmartScript&& other) noexcept = default; +SmartScript::~SmartScript() = default; bool SmartScript::IsSmart(Creature* c, bool silent) const { diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index d83f4e01439..8d9d00c62bc 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -42,6 +42,10 @@ class TC_GAME_API SmartScript { public: SmartScript(); + SmartScript(SmartScript const& other); + SmartScript(SmartScript&& other) noexcept; + SmartScript& operator=(SmartScript const& other); + SmartScript& operator=(SmartScript&& other) noexcept; ~SmartScript(); void OnInitialize(WorldObject* obj, AreaTriggerEntry const* at = nullptr, SceneTemplate const* scene = nullptr, Quest const* qst = nullptr, uint32 evnt = 0); diff --git a/src/server/game/Battlegrounds/BattlegroundScript.cpp b/src/server/game/Battlegrounds/BattlegroundScript.cpp index a3bee1d6b38..5ab744cf8a2 100644 --- a/src/server/game/Battlegrounds/BattlegroundScript.cpp +++ b/src/server/game/Battlegrounds/BattlegroundScript.cpp @@ -27,7 +27,7 @@ #include "ScriptMgr.h" #include "WorldStateMgr.h" -BattlegroundScript::BattlegroundScript(BattlegroundMap* map) : battlegroundMap(map), battleground(map->GetBG()) +BattlegroundScript::BattlegroundScript(BattlegroundMap* map) noexcept : battlegroundMap(map), battleground(map->GetBG()) { #ifdef TRINITY_API_USE_DYNAMIC_LINKING BattlegroundScriptTemplate const* scriptTemplate = sBattlegroundMgr->FindBattlegroundScriptTemplate(battlegroundMap->GetId(), battlegroundMap->GetBG()->GetTypeID()); diff --git a/src/server/game/Battlegrounds/BattlegroundScript.h b/src/server/game/Battlegrounds/BattlegroundScript.h index 1780052fc92..0ad91c2ca28 100644 --- a/src/server/game/Battlegrounds/BattlegroundScript.h +++ b/src/server/game/Battlegrounds/BattlegroundScript.h @@ -32,7 +32,7 @@ class ModuleReference; class TC_GAME_API BattlegroundScript : public ZoneScript { public: - explicit BattlegroundScript(BattlegroundMap* map); + explicit BattlegroundScript(BattlegroundMap* map) noexcept; ~BattlegroundScript() override = default; virtual void OnInit() { } diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index a24e0a9b91f..6399bd29399 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -64,7 +64,7 @@ DungeonEncounterEntry const* BossInfo::GetDungeonEncounterForDifficulty(Difficul return itr != DungeonEncounters.end() ? *itr : nullptr; } -InstanceScript::InstanceScript(InstanceMap* map) : instance(map), _instanceSpawnGroups(sObjectMgr->GetInstanceSpawnGroupsForMap(map->GetId())), +InstanceScript::InstanceScript(InstanceMap* map) noexcept : instance(map), _instanceSpawnGroups(sObjectMgr->GetInstanceSpawnGroupsForMap(map->GetId())), _entranceId(0), _temporaryEntranceId(0), _combatResurrectionTimer(0), _combatResurrectionCharges(0), _combatResurrectionTimerStarted(false) { #ifdef TRINITY_API_USE_DYNAMIC_LINKING diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 2ac6c0da04f..228304d8b06 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -182,7 +182,7 @@ typedef std::map ObjectInfoMap; class TC_GAME_API InstanceScript : public ZoneScript { public: - explicit InstanceScript(InstanceMap* map); + explicit InstanceScript(InstanceMap* map) noexcept; InstanceScript(InstanceScript const& right) = delete; InstanceScript(InstanceScript&& right) = delete; InstanceScript& operator=(InstanceScript const& right) = delete; diff --git a/src/server/game/Maps/ZoneScript.cpp b/src/server/game/Maps/ZoneScript.cpp index 599847d911a..17ffcbc18c8 100644 --- a/src/server/game/Maps/ZoneScript.cpp +++ b/src/server/game/Maps/ZoneScript.cpp @@ -26,7 +26,7 @@ ControlZoneHandler& ControlZoneHandler::operator=(ControlZoneHandler const& righ ControlZoneHandler& ControlZoneHandler::operator=(ControlZoneHandler&& right) noexcept = default; ControlZoneHandler::~ControlZoneHandler() = default; -ZoneScript::ZoneScript() = default; +ZoneScript::ZoneScript() noexcept = default; ZoneScript::ZoneScript(ZoneScript const& right) = default; ZoneScript::ZoneScript(ZoneScript&& right) noexcept = default; ZoneScript& ZoneScript::operator=(ZoneScript const& right) = default; diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index 0f1c1e1651e..51f72de0d48 100644 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.h @@ -63,7 +63,7 @@ public: class TC_GAME_API ZoneScript { public: - ZoneScript(); + ZoneScript() noexcept; ZoneScript(ZoneScript const& right); ZoneScript(ZoneScript&& right) noexcept; ZoneScript& operator=(ZoneScript const& right); diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 9a9d5bcb5b1..3135dce1a22 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -150,8 +150,8 @@ enum Spells class ScriptRegistryInterface { public: - ScriptRegistryInterface() { } - virtual ~ScriptRegistryInterface() { } + ScriptRegistryInterface() = default; + virtual ~ScriptRegistryInterface() = default; ScriptRegistryInterface(ScriptRegistryInterface const&) = delete; ScriptRegistryInterface(ScriptRegistryInterface&&) = delete; @@ -183,7 +183,7 @@ class ScriptRegistry; class ScriptRegistryCompositum : public ScriptRegistryInterface { - ScriptRegistryCompositum() { } + ScriptRegistryCompositum() noexcept = default; template friend class ScriptRegistry; @@ -273,7 +273,7 @@ public: void QueueForDelayedDelete(T&& any) { _delayed_delete_queue.push_back( - std::make_unique< + std::make_unique< DeleteableObject::type> >(std::forward(any)) ); @@ -317,7 +317,7 @@ class ScriptRegistry final : public SpecializedScriptRegistry< ScriptType, is_script_database_bound::value> { - ScriptRegistry() + ScriptRegistry() noexcept { sScriptRegistryCompositum->Register(this); } @@ -360,7 +360,7 @@ public: virtual void BeforeUnload() { } /// Called manually to sync scriptnames - virtual void OnScriptNamesSync() { }; + virtual void OnScriptNamesSync() { } }; template @@ -1004,7 +1004,7 @@ class SpecializedScriptRegistry friend class CreatureGameObjectAreaTriggerConversationScriptRegistrySwapHooks; public: - SpecializedScriptRegistry() { } + SpecializedScriptRegistry() noexcept = default; typedef std::unordered_map< uint32 /*script id*/, @@ -1052,7 +1052,7 @@ public: } // Adds a database bound script - void AddScript(ScriptType* script) + void AddScript(ScriptType* script) noexcept { ASSERT(script, "Tried to call AddScript with a nullpointer!"); @@ -1169,7 +1169,7 @@ public: typedef std::unordered_multimap> ScriptStoreType; typedef typename ScriptStoreType::iterator ScriptStoreIteratorType; - SpecializedScriptRegistry() { } + SpecializedScriptRegistry() noexcept = default; void ReleaseContext(std::string const& context) final override { @@ -1201,7 +1201,7 @@ public: } // Adds a non database bound script - void AddScript(ScriptType* script) + void AddScript(ScriptType* script) noexcept { ASSERT(script, "Tried to call AddScript with a nullpointer!"); @@ -1266,7 +1266,7 @@ private: if (!V) \ return R; -ScriptObject::ScriptObject(char const* name) : _name(name) +ScriptObject::ScriptObject(char const* name) noexcept : _name(name) { sScriptMgr->IncreaseScriptCount(); } @@ -1420,8 +1420,8 @@ void ScriptMgr::FillSpellSummary() UnitAI::FillAISpellInfo(); } -template -void CreateSpellOrAuraScripts(uint32 spellId, std::vector& scriptVector, T*(SpellScriptLoader::*extractor)() const, O* objectInvoker) +template GetScriptFn, typename O> +void CreateSpellOrAuraScripts(uint32 spellId, std::vector& scriptVector, GetScriptFn extractor, O* objectInvoker) { SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId); for (auto itr = bounds.first; itr != bounds.second; ++itr) @@ -1430,11 +1430,11 @@ void CreateSpellOrAuraScripts(uint32 spellId, std::vector& scriptVector, T*( if (!itr->second.second) continue; - SpellScriptLoader* tmpscript = sScriptMgr->GetSpellScriptLoader(itr->second.first); + SpellScriptLoader const* tmpscript = sScriptMgr->GetSpellScriptLoader(itr->second.first); if (!tmpscript) continue; - T* script = (tmpscript->*extractor)(); + T* script = extractor(tmpscript); if (!script) continue; @@ -1451,12 +1451,12 @@ void CreateSpellOrAuraScripts(uint32 spellId, std::vector& scriptVector, T*( void ScriptMgr::CreateSpellScripts(uint32 spellId, std::vector& scriptVector, Spell* invoker) const { - CreateSpellOrAuraScripts(spellId, scriptVector, &SpellScriptLoader::GetSpellScript, invoker); + CreateSpellOrAuraScripts(spellId, scriptVector, [](SpellScriptLoader const* loader) { return loader->GetSpellScript(); }, invoker); } void ScriptMgr::CreateAuraScripts(uint32 spellId, std::vector& scriptVector, Aura* invoker) const { - CreateSpellOrAuraScripts(spellId, scriptVector, &SpellScriptLoader::GetAuraScript, invoker); + CreateSpellOrAuraScripts(spellId, scriptVector, [](SpellScriptLoader const* loader) { return loader->GetAuraScript(); }, invoker); } SpellScriptLoader* ScriptMgr::GetSpellScriptLoader(uint32 scriptId) @@ -2383,7 +2383,7 @@ void ScriptMgr::OnEventTrigger(WorldObject* object, WorldObject* invoker, uint32 tmpscript->OnTrigger(object, invoker, eventId); } -SpellScriptLoader::SpellScriptLoader(char const* name) +SpellScriptLoader::SpellScriptLoader(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2399,7 +2399,7 @@ AuraScript* SpellScriptLoader::GetAuraScript() const return nullptr; } -ServerScript::ServerScript(char const* name) +ServerScript::ServerScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2431,7 +2431,7 @@ void ServerScript::OnPacketReceive(WorldSession* /*session*/, WorldPacket& /*pac { } -WorldScript::WorldScript(char const* name) +WorldScript::WorldScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2471,7 +2471,7 @@ void WorldScript::OnShutdown() { } -FormulaScript::FormulaScript(char const* name) +FormulaScript::FormulaScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2508,7 +2508,7 @@ void FormulaScript::OnGroupRateCalculation(float& /*rate*/, uint32 /*count*/, bo } template -MapScript::MapScript(MapEntry const* mapEntry) : _mapEntry(mapEntry) +MapScript::MapScript(MapEntry const* mapEntry) noexcept : _mapEntry(mapEntry) { } @@ -2547,7 +2547,7 @@ template class TC_GAME_API MapScript; template class TC_GAME_API MapScript; template class TC_GAME_API MapScript; -WorldMapScript::WorldMapScript(char const* name, uint32 mapId) +WorldMapScript::WorldMapScript(char const* name, uint32 mapId) noexcept : ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId)) { if (!GetEntry()) @@ -2561,7 +2561,7 @@ WorldMapScript::WorldMapScript(char const* name, uint32 mapId) WorldMapScript::~WorldMapScript() = default; -InstanceMapScript::InstanceMapScript(char const* name, uint32 mapId) +InstanceMapScript::InstanceMapScript(char const* name, uint32 mapId) noexcept : ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId)) { if (!GetEntry()) @@ -2580,7 +2580,7 @@ InstanceScript* InstanceMapScript::GetInstanceScript(InstanceMap* /*map*/) const return nullptr; } -BattlegroundMapScript::BattlegroundMapScript(char const* name, uint32 mapId) +BattlegroundMapScript::BattlegroundMapScript(char const* name, uint32 mapId) noexcept : ScriptObject(name), MapScript(sMapStore.LookupEntry(mapId)) { if (!GetEntry()) @@ -2599,7 +2599,7 @@ BattlegroundScript* BattlegroundMapScript::GetBattlegroundScript(BattlegroundMap return nullptr; } -ItemScript::ItemScript(char const* name) +ItemScript::ItemScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2632,7 +2632,7 @@ bool ItemScript::OnCastItemCombatSpell(Player* /*player*/, Unit* /*victim*/, Spe return true; } -UnitScript::UnitScript(char const* name) +UnitScript::UnitScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2660,7 +2660,7 @@ void UnitScript::ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, in { } -CreatureScript::CreatureScript(char const* name) +CreatureScript::CreatureScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2668,7 +2668,7 @@ CreatureScript::CreatureScript(char const* name) CreatureScript::~CreatureScript() = default; -GameObjectScript::GameObjectScript(char const* name) +GameObjectScript::GameObjectScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2676,7 +2676,7 @@ GameObjectScript::GameObjectScript(char const* name) GameObjectScript::~GameObjectScript() = default; -AreaTriggerScript::AreaTriggerScript(char const* name) +AreaTriggerScript::AreaTriggerScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2711,7 +2711,7 @@ bool OnlyOnceAreaTriggerScript::OnTrigger(Player* player, AreaTriggerEntry const void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(InstanceScript* instance, uint32 triggerId) { instance->ResetAreaTriggerDone(triggerId); } void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(Player const* player, AreaTriggerEntry const* trigger) { if (InstanceScript* instance = player->GetInstanceScript()) ResetAreaTriggerDone(instance, trigger->ID); } -BattlefieldScript::BattlefieldScript(char const* name) +BattlefieldScript::BattlefieldScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2719,7 +2719,7 @@ BattlefieldScript::BattlefieldScript(char const* name) BattlefieldScript::~BattlefieldScript() = default; -OutdoorPvPScript::OutdoorPvPScript(char const* name) +OutdoorPvPScript::OutdoorPvPScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2727,7 +2727,7 @@ OutdoorPvPScript::OutdoorPvPScript(char const* name) OutdoorPvPScript::~OutdoorPvPScript() = default; -CommandScript::CommandScript(char const* name) +CommandScript::CommandScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2735,7 +2735,7 @@ CommandScript::CommandScript(char const* name) CommandScript::~CommandScript() = default; -WeatherScript::WeatherScript(char const* name) +WeatherScript::WeatherScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2751,7 +2751,7 @@ void WeatherScript::OnUpdate(Weather* /*weather*/, uint32 /*diff*/) { } -AuctionHouseScript::AuctionHouseScript(char const* name) +AuctionHouseScript::AuctionHouseScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2775,7 +2775,7 @@ void AuctionHouseScript::OnAuctionExpire(AuctionHouseObject* /*ah*/, AuctionPost { } -ConditionScript::ConditionScript(char const* name) +ConditionScript::ConditionScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2788,7 +2788,7 @@ bool ConditionScript::OnConditionCheck(Condition const* /*condition*/, Condition return true; } -VehicleScript::VehicleScript(char const* name) +VehicleScript::VehicleScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2820,7 +2820,7 @@ void VehicleScript::OnRemovePassenger(Vehicle* /*veh*/, Unit* /*passenger*/) { } -DynamicObjectScript::DynamicObjectScript(char const* name) +DynamicObjectScript::DynamicObjectScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2832,7 +2832,7 @@ void DynamicObjectScript::OnUpdate(DynamicObject* /*obj*/, uint32 /*diff*/) { } -TransportScript::TransportScript(char const* name) +TransportScript::TransportScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2860,7 +2860,7 @@ void TransportScript::OnUpdate(Transport* /*transport*/, uint32 /*diff*/) { } -AchievementScript::AchievementScript(char const* name) +AchievementScript::AchievementScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2872,7 +2872,7 @@ void AchievementScript::OnCompleted(Player* /*player*/, AchievementEntry const* { } -AchievementCriteriaScript::AchievementCriteriaScript(char const* name) +AchievementCriteriaScript::AchievementCriteriaScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -2880,7 +2880,7 @@ AchievementCriteriaScript::AchievementCriteriaScript(char const* name) AchievementCriteriaScript::~AchievementCriteriaScript() = default; -PlayerScript::PlayerScript(char const* name) +PlayerScript::PlayerScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3024,7 +3024,7 @@ void PlayerScript::OnPlayerChoiceResponse(Player* /*player*/, uint32 /*choiceId* { } -AccountScript::AccountScript(char const* name) +AccountScript::AccountScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3056,7 +3056,7 @@ void AccountScript::OnFailedPasswordChange(uint32 /*accountId*/) { } -GuildScript::GuildScript(char const* name) +GuildScript::GuildScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3110,7 +3110,7 @@ void GuildScript::OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tab { } -GroupScript::GroupScript(char const* name) +GroupScript::GroupScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3138,7 +3138,7 @@ void GroupScript::OnDisband(Group* /*group*/) { } -AreaTriggerEntityScript::AreaTriggerEntityScript(char const* name) +AreaTriggerEntityScript::AreaTriggerEntityScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3151,7 +3151,7 @@ AreaTriggerAI* AreaTriggerEntityScript::GetAI(AreaTrigger* /*at*/) const return nullptr; } -ConversationScript::ConversationScript(char const* name) +ConversationScript::ConversationScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3164,7 +3164,7 @@ ConversationAI* ConversationScript::GetAI(Conversation* /*conversation*/) const return nullptr; } -SceneScript::SceneScript(char const* name) +SceneScript::SceneScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3188,7 +3188,7 @@ void SceneScript::OnSceneComplete(Player* /*player*/, uint32 /*sceneInstanceID*/ { } -QuestScript::QuestScript(char const* name) +QuestScript::QuestScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3208,7 +3208,7 @@ void QuestScript::OnQuestObjectiveChange(Player* /*player*/, Quest const* /*ques { } -WorldStateScript::WorldStateScript(char const* name) +WorldStateScript::WorldStateScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); @@ -3220,7 +3220,7 @@ void WorldStateScript::OnValueChange(int32 /*worldStateId*/, int32 /*oldValue*/, { } -EventScript::EventScript(char const* name) +EventScript::EventScript(char const* name) noexcept : ScriptObject(name) { ScriptRegistry::Instance()->AddScript(this); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 56c6c7d5ca7..482d687f659 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -188,7 +188,7 @@ class TC_GAME_API ScriptObject protected: - ScriptObject(char const* name); + explicit ScriptObject(char const* name) noexcept; virtual ~ScriptObject(); private: @@ -200,7 +200,7 @@ class TC_GAME_API SpellScriptLoader : public ScriptObject { protected: - explicit SpellScriptLoader(char const* name); + explicit SpellScriptLoader(char const* name) noexcept; public: @@ -215,7 +215,7 @@ class TC_GAME_API ServerScript : public ScriptObject { protected: - explicit ServerScript(char const* name); + explicit ServerScript(char const* name) noexcept; public: @@ -247,7 +247,7 @@ class TC_GAME_API WorldScript : public ScriptObject { protected: - explicit WorldScript(char const* name); + explicit WorldScript(char const* name) noexcept; public: @@ -282,7 +282,7 @@ class TC_GAME_API FormulaScript : public ScriptObject { protected: - explicit FormulaScript(char const* name); + explicit FormulaScript(char const* name) noexcept; public: @@ -317,7 +317,7 @@ class TC_GAME_API MapScript protected: - explicit MapScript(MapEntry const* mapEntry); + explicit MapScript(MapEntry const* mapEntry) noexcept; public: @@ -348,7 +348,7 @@ class TC_GAME_API WorldMapScript : public ScriptObject, public MapScript { protected: - explicit WorldMapScript(char const* name, uint32 mapId); + explicit WorldMapScript(char const* name, uint32 mapId) noexcept; public: @@ -359,7 +359,7 @@ class TC_GAME_API InstanceMapScript : public ScriptObject, public MapScript class GenericCreatureScript : public CreatureScript { public: - GenericCreatureScript(char const* name) : CreatureScript(name) { } + GenericCreatureScript(char const* name) noexcept : CreatureScript(name) { } CreatureAI* GetAI(Creature* me) const override { return new AI(me); } }; #define RegisterCreatureAI(ai_name) new GenericCreatureScript(#ai_name) @@ -1376,7 +1376,7 @@ template class FactoryCreatureScript : public CreatureScript { public: - FactoryCreatureScript(char const* name) : CreatureScript(name) { } + FactoryCreatureScript(char const* name) noexcept : CreatureScript(name) { } CreatureAI* GetAI(Creature* me) const override { return AIFactory(me); } }; #define RegisterCreatureAIWithFactory(ai_name, factory_fn) new FactoryCreatureScript(#ai_name) @@ -1385,7 +1385,7 @@ template class GenericGameObjectScript : public GameObjectScript { public: - GenericGameObjectScript(char const* name) : GameObjectScript(name) { } + GenericGameObjectScript(char const* name) noexcept : GameObjectScript(name) { } GameObjectAI* GetAI(GameObject* go) const override { return new AI(go); } }; #define RegisterGameObjectAI(ai_name) new GenericGameObjectScript(#ai_name) @@ -1394,7 +1394,7 @@ template class FactoryGameObjectScript : public GameObjectScript { public: - FactoryGameObjectScript(char const* name) : GameObjectScript(name) { } + FactoryGameObjectScript(char const* name) noexcept : GameObjectScript(name) { } GameObjectAI* GetAI(GameObject* me) const override { return AIFactory(me); } }; #define RegisterGameObjectAIWithFactory(ai_name, factory_fn) new FactoryGameObjectScript(#ai_name) @@ -1403,7 +1403,7 @@ template class GenericAreaTriggerEntityScript : public AreaTriggerEntityScript { public: - GenericAreaTriggerEntityScript(char const* name) : AreaTriggerEntityScript(name) { } + GenericAreaTriggerEntityScript(char const* name) noexcept : AreaTriggerEntityScript(name) { } AreaTriggerAI* GetAI(AreaTrigger* at) const override { return new AI(at); } }; #define RegisterAreaTriggerAI(ai_name) new GenericAreaTriggerEntityScript(#ai_name) @@ -1412,7 +1412,7 @@ template class GenericConversationScript : public ConversationScript { public: - GenericConversationScript(char const* name) : ConversationScript(name) {} + GenericConversationScript(char const* name) noexcept : ConversationScript(name) {} ConversationAI* GetAI(Conversation* conversation) const override { return new AI(conversation); } }; #define RegisterConversationAI(ai_name) new GenericConversationScript(#ai_name) @@ -1421,7 +1421,7 @@ template class GenericBattlegroundMapScript : public BattlegroundMapScript { public: - GenericBattlegroundMapScript(char const* name, uint32 mapId) : BattlegroundMapScript(name, mapId) { } + GenericBattlegroundMapScript(char const* name, uint32 mapId) noexcept : BattlegroundMapScript(name, mapId) { } BattlegroundScript* GetBattlegroundScript(BattlegroundMap* map) const override { return new Script(map); } }; diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 5314223ea8d..9ffefa47fc6 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -35,7 +35,7 @@ bool SpellScriptBase::_Validate(SpellInfo const* entry) return true; } -SpellScriptBase::SpellScriptBase(): m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptSpellId(0) +SpellScriptBase::SpellScriptBase() noexcept : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptSpellId(0) { } @@ -268,7 +268,7 @@ template TC_GAME_API SpellScriptBase::HookList& SpellScriptBase::HookList::operator+=(SpellScript::OnCalculateResistAbsorbHandler&& hook); template TC_GAME_API SpellScriptBase::HookList& SpellScriptBase::HookList::operator+=(SpellScript::EmpowerStageCompletedHandler&& hook); -SpellScript::SpellScript(): m_spell(nullptr), m_hitPreventEffectMask(0), m_hitPreventDefaultEffectMask(0) +SpellScript::SpellScript() noexcept : m_spell(nullptr), m_hitPreventEffectMask(0), m_hitPreventDefaultEffectMask(0) { } @@ -948,7 +948,7 @@ std::string AuraScript::EffectBase::ToString() const } } -AuraScript::AuraScript(): SpellScriptBase(), m_aura(nullptr), m_auraApplication(nullptr), m_defaultActionPrevented(false) +AuraScript::AuraScript() noexcept : m_aura(nullptr), m_auraApplication(nullptr), m_defaultActionPrevented(false) { } diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 5857d63fb08..8a85e7e2a03 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -73,7 +73,7 @@ class TC_GAME_API SpellScriptBase // internal use classes & functions // DO NOT OVERRIDE THESE IN SCRIPTS public: - SpellScriptBase(); + SpellScriptBase() noexcept; virtual ~SpellScriptBase(); SpellScriptBase(SpellScriptBase const& right) = delete; @@ -842,7 +842,7 @@ public: // left for custom compatibility only, DO NOT USE #define PrepareSpellScript(CLASSNAME) - SpellScript(); + SpellScript() noexcept; ~SpellScript(); bool _Validate(SpellInfo const* entry) override; bool _Load(Spell* spell); @@ -2090,7 +2090,7 @@ public: #define PrepareAuraScript(CLASSNAME) public: - AuraScript(); + AuraScript() noexcept; ~AuraScript(); bool _Validate(SpellInfo const* entry) override; bool _Load(Aura* aura); -- cgit v1.2.3