aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2021-01-24 16:04:47 +0100
committerShauren <shauren.trinity@gmail.com>2022-03-06 01:35:01 +0100
commita66b968f91d159b149ef5b7357d8a92572cb0b3c (patch)
treecf1e221b668b4ae8eacfff856aea06cac4d8d3c5 /src/server/game
parent91d7a8b06954fa8a2e67166f731644dec1f5e687 (diff)
Core/Misc: Fix static analysis issues (#25924)
* Core/Misc: Fix static analysis issues * Fix infinite loop in ".debug send opcode" Fix using uninitialized memory in ".debug send opcode" (cherry picked from commit 661f554b9e08a3721227f1e4a4fe6fd74e43a1f4)
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBE.h2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.h10
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundNA.h2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRL.h2
-rw-r--r--src/server/game/Conditions/DisableMgr.cpp2
-rw-r--r--src/server/game/Entities/GameObject/GameObjectData.h12
-rw-r--r--src/server/game/Entities/Player/EquipmentSet.h6
-rw-r--r--src/server/game/Globals/ObjectMgr.h14
-rw-r--r--src/server/game/Groups/Group.cpp2
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvPMgr.h2
-rw-r--r--src/server/game/Warden/WardenCheckMgr.h8
12 files changed, 29 insertions, 35 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index 7d7c68b41e9..d61905e5a8d 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
@@ -42,7 +42,7 @@ enum BattlegroundBEGameObjects
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
};
-constexpr Seconds BG_BE_REMOVE_DOORS_TIMER = 5s;
+inline constexpr Seconds BG_BE_REMOVE_DOORS_TIMER = 5s;
enum BattlegroundBEEvents
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index a2ee050bbd9..c6f910c2e73 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -73,11 +73,11 @@ enum BattlegroundDSData
};
// These values are NOT blizzlike... need the correct data!
-constexpr Seconds BG_DS_WATERFALL_TIMER_MIN = 30s;
-constexpr Seconds BG_DS_WATERFALL_TIMER_MAX = 60s;
-constexpr Seconds BG_DS_WATERFALL_WARNING_DURATION = 5s;
-constexpr Seconds BG_DS_WATERFALL_DURATION = 30s;
-constexpr Milliseconds BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500ms;
+inline constexpr Seconds BG_DS_WATERFALL_TIMER_MIN = 30s;
+inline constexpr Seconds BG_DS_WATERFALL_TIMER_MAX = 60s;
+inline constexpr Seconds BG_DS_WATERFALL_WARNING_DURATION = 5s;
+inline constexpr Seconds BG_DS_WATERFALL_DURATION = 30s;
+inline constexpr Milliseconds BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500ms;
enum BattlegroundDSEvents
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
index fc782025e52..1436c78f6d1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
@@ -41,7 +41,7 @@ enum BattlegroundNAGameObjects
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
};
-constexpr Seconds BG_NA_REMOVE_DOORS_TIMER = 5s;
+inline constexpr Seconds BG_NA_REMOVE_DOORS_TIMER = 5s;
enum BattlegroundNAEvents
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
index 8d77c1f5bb2..4c2f94d2566 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
@@ -37,7 +37,7 @@ enum BattlegroundRLGameObjects
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
};
-constexpr Seconds BG_RL_REMOVE_DOORS_TIMER = 5s;
+inline constexpr Seconds BG_RL_REMOVE_DOORS_TIMER = 5s;
enum BattlegroundRLEvents
{
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 15af1065d2a..ae4d61f5fd1 100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -305,7 +305,7 @@ bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const* ref, uint8
{
if (spellFlags & (SPELL_DISABLE_ARENAS | SPELL_DISABLE_BATTLEGROUNDS))
{
- if (Map const* map = ref->GetMap())
+ if (Map const* map = ref->FindMap())
{
if (spellFlags & SPELL_DISABLE_ARENAS && map->IsBattleArena())
return true; // Current map is Arena and this spell is disabled here
diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h
index 0f23f6fbaa9..f6fe8f5681a 100644
--- a/src/server/game/Entities/GameObject/GameObjectData.h
+++ b/src/server/game/Entities/GameObject/GameObjectData.h
@@ -1076,18 +1076,18 @@ struct GameObjectTemplate
// From `gameobject_template_addon`, `gameobject_overrides`
struct GameObjectOverride
{
- uint32 Faction;
- uint32 Flags;
+ uint32 Faction = 0;
+ uint32 Flags = 0;
};
// From `gameobject_template_addon`
struct GameObjectTemplateAddon : public GameObjectOverride
{
- uint32 Mingold;
- uint32 Maxgold;
+ uint32 Mingold = 0;
+ uint32 Maxgold = 0;
std::array<uint32, 5> ArtKits = { };
- uint32 WorldEffectID;
- uint32 AIAnimKitID;
+ uint32 WorldEffectID = 0;
+ uint32 AIAnimKitID = 0;
};
struct GameObjectLocale
diff --git a/src/server/game/Entities/Player/EquipmentSet.h b/src/server/game/Entities/Player/EquipmentSet.h
index 26d7a4dd6a3..8ffcd296eb4 100644
--- a/src/server/game/Entities/Player/EquipmentSet.h
+++ b/src/server/game/Entities/Player/EquipmentSet.h
@@ -51,9 +51,9 @@ struct EquipmentSetInfo
int32 AssignedSpecIndex = -1; ///< Index of character specialization that this set is automatically equipped for
std::string SetName;
std::string SetIcon;
- std::array<ObjectGuid, EQUIPMENT_SET_SLOTS> Pieces;
- std::array<int32, EQUIPMENT_SET_SLOTS> Appearances; ///< ItemModifiedAppearanceID
- std::array<int32, 2> Enchants; ///< SpellItemEnchantmentID
+ std::array<ObjectGuid, EQUIPMENT_SET_SLOTS> Pieces = {};
+ std::array<int32, EQUIPMENT_SET_SLOTS> Appearances = {};///< ItemModifiedAppearanceID
+ std::array<int32, 2> Enchants = {}; ///< SpellItemEnchantmentID
int32 SecondaryShoulderApparanceID = 0; ///< Secondary shoulder appearance
int32 SecondaryShoulderSlot = 0; ///< Always 2 if secondary shoulder apperance is used
int32 SecondaryWeaponAppearanceID = 0; ///< For legion artifacts: linked child item appearance
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 9015d9a76c7..7ec4262eb00 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -678,16 +678,10 @@ struct PlayerInfo
struct PetLevelInfo
{
- PetLevelInfo() : health(0), mana(0), armor(0)
- {
- for (uint16& stat : stats)
- stat = 0;
- }
-
- uint16 stats[MAX_STATS];
- uint16 health;
- uint16 mana;
- uint16 armor;
+ uint16 stats[MAX_STATS] = {};
+ uint16 health = 0;
+ uint16 mana = 0;
+ uint16 armor = 0;
};
struct MailLevelReward
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index af7b0182575..21303d55dde 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -820,7 +820,7 @@ void Group::ConvertLeaderInstancesToGroup(Player* player, Group* group, bool swi
/* if group leader is in a non-raid dungeon map and nobody is actually bound to this map then the group can "take over" the instance *
* (example: two-player group disbanded by disconnect where the player reconnects within 60 seconds and the group is reformed) */
- if (Map* playerMap = player->GetMap())
+ if (Map* playerMap = player->FindMap())
if (!switchLeader && playerMap->IsNonRaidDungeon())
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(playerMap->GetInstanceId()))
if (save->GetGroupCount() == 0 && save->GetPlayerCount() == 0)
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 8ff1e0ed877..da83cc662b0 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -741,7 +741,7 @@ void WorldSession::HandleTimeSyncResponse(WorldPackets::Misc::TimeSyncResponse&
using the following relation:
serverTime = clockDelta + clientTime
*/
- int64 clockDelta = (int64)(serverTimeAtSent + lagDelay) - (int64)timeSyncResponse.ClientTime;
+ int64 clockDelta = (int64)serverTimeAtSent + (int64)lagDelay - (int64)timeSyncResponse.ClientTime;
_timeSyncClockDeltaQueue.push_back(std::pair<int64, uint32>(clockDelta, roundTripDuration));
ComputeNewClockDelta();
}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index 16eb87207ac..9815a1198b3 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
@@ -93,7 +93,7 @@ class TC_GAME_API OutdoorPvPMgr
OutdoorPvPMap m_OutdoorPvPMap;
// Holds the outdoor PvP templates
- OutdoorPvPScriptIds m_OutdoorPvPDatas;
+ OutdoorPvPScriptIds m_OutdoorPvPDatas = {};
// update interval
uint32 m_UpdateTimer;
diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h
index 1d27ff120d5..51e96312f97 100644
--- a/src/server/game/Warden/WardenCheckMgr.h
+++ b/src/server/game/Warden/WardenCheckMgr.h
@@ -86,15 +86,15 @@ constexpr WorldIntConfigs GetWardenCategoryCountConfig(WardenCheckCategory categ
struct WardenCheck
{
- uint16 CheckId;
+ uint16 CheckId = 0;
WardenCheckType Type = NONE_CHECK;
std::vector<uint8> Data;
- uint32 Address; // PROC_CHECK, MEM_CHECK, PAGE_CHECK
- uint8 Length; // PROC_CHECK, MEM_CHECK, PAGE_CHECK
+ uint32 Address = 0; // PROC_CHECK, MEM_CHECK, PAGE_CHECK
+ uint8 Length = 0; // PROC_CHECK, MEM_CHECK, PAGE_CHECK
std::string Str; // LUA, MPQ, DRIVER
std::string Comment;
std::array<char, 4> IdStr = {}; // LUA
- WardenActions Action;
+ WardenActions Action = WARDEN_ACTION_LOG;
};
constexpr uint8 WARDEN_MAX_LUA_CHECK_LENGTH = 170;