aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2013-12-14 18:41:26 +0100
committerjackpoz <giacomopoz@gmail.com>2013-12-14 18:41:26 +0100
commit1c0903e2862d4e4c7e17c8a45fe9dc3163b3ebce (patch)
treeaed14a90ef879821548c2bf4eb66ec1b08f0bf86 /src/server/game/Entities
parentdd546f073aa8acf54f525c0a0836a502d859580d (diff)
Core/Misc: Fix some static analysis issues
Fix some static analysis issues about uninitialized values. Most of them are false positives, always initialized before being accessed, while some of them are real issues spotted by valgrind too.
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.h5
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp1
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h4
-rw-r--r--src/server/game/Entities/Object/Object.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp22
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp6
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp2
8 files changed, 36 insertions, 8 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index fc85fea7b52..dfc35bcce56 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -147,7 +147,7 @@ m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemov
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE),
m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
-m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL)
+m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL)
{
m_regenTimer = CREATURE_REGEN_INTERVAL;
m_valuesCount = UNIT_END;
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index cab00be9446..7826fb30614 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -246,7 +246,10 @@ typedef UNORDERED_MAP<uint32, EquipmentInfoContainerInternal> EquipmentInfoConta
// from `creature` table
struct CreatureData
{
- CreatureData() : dbData(true) { }
+ CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0),
+ posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
+ spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
+ spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), dbData(true) { }
uint32 id; // entry in creature_template
uint16 mapid;
uint32 phaseMask;
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 84cd2d41c1f..d04fde46713 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -27,6 +27,7 @@
GossipMenu::GossipMenu()
{
_menuId = 0;
+ _locale = DEFAULT_LOCALE;
}
GossipMenu::~GossipMenu()
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 27ea15c38ff..8930806bca5 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -589,7 +589,9 @@ enum GOState
// from `gameobject`
struct GameObjectData
{
- explicit GameObjectData() : dbData(true) { }
+ explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f),
+ rotation0(0.0f), rotation1(0.0f), rotation2(0.0f), rotation3(0.0f), spawntimesecs(0),
+ animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), dbData(true) { }
uint32 id; // entry in gamobject_template
uint16 mapid;
uint32 phaseMask;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 675504cd668..9ca28ea83f5 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1082,7 +1082,7 @@ void MovementInfo::OutDebug()
TC_LOG_INFO("misc", "splineElevation: %f", splineElevation);
}
-WorldObject::WorldObject(bool isWorldObject): WorldLocation(),
+WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), LastUsedScriptID(0),
m_name(""), m_isActive(false), m_isWorldObject(isWorldObject), m_zoneScript(NULL),
m_transport(NULL), m_currMap(NULL), m_InstanceId(0),
m_phaseMask(PHASEMASK_NORMAL), m_notifyflags(0), m_executed_notifies(0)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ed06472b40d..a8e9a3567ff 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -663,6 +663,7 @@ Player::Player(WorldSession* session): Unit(true)
m_session = session;
m_divider = 0;
+ m_ingametime = 0;
m_ExtraFlags = 0;
@@ -689,6 +690,7 @@ Player::Player(WorldSession* session): Unit(true)
m_zoneUpdateTimer = 0;
m_areaUpdateId = 0;
+ m_team = 0;
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
@@ -750,6 +752,8 @@ Player::Player(WorldSession* session): Unit(true)
m_logintime = time(NULL);
m_Last_tick = m_logintime;
+ m_Played_time[PLAYED_TIME_TOTAL] = 0;
+ m_Played_time[PLAYED_TIME_LEVEL] = 0;
m_WeaponProficiency = 0;
m_ArmorProficiency = 0;
m_canParry = false;
@@ -795,6 +799,7 @@ Player::Player(WorldSession* session): Unit(true)
m_InstanceValid = true;
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
+ m_raidMapDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
m_lastPotionId = 0;
@@ -840,6 +845,18 @@ Player::Player(WorldSession* session): Unit(true)
m_movedPlayer = this;
m_seer = this;
+ m_recallMap = 0;
+ m_recallX = 0;
+ m_recallY = 0;
+ m_recallZ = 0;
+ m_recallO = 0;
+
+ m_homebindMapId = 0;
+ m_homebindAreaId = 0;
+ m_homebindX = 0;
+ m_homebindY = 0;
+ m_homebindZ = 0;
+
m_contestedPvPTimer = 0;
m_declinedname = NULL;
@@ -859,6 +876,11 @@ Player::Player(WorldSession* session): Unit(true)
m_ChampioningFaction = 0;
+ m_timeSyncCounter = 0;
+ m_timeSyncTimer = 0;
+ m_timeSyncClient = 0;
+ m_timeSyncServer = 0;
+
for (uint8 i = 0; i < MAX_POWERS; ++i)
m_powerFraction[i] = 0;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 9bd7e1eb512..da5edc0ea6c 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -165,7 +165,7 @@ Unit::Unit(bool isWorldObject) :
IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0),
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0),
- m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_ThreatManager(this),
+ m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this),
m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
m_HostileRefManager(this), _lastDamagedTime(0)
{
@@ -13561,8 +13561,8 @@ void Unit::DeleteCharmInfo()
}
CharmInfo::CharmInfo(Unit* unit)
-: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false),
- _isCommandAttack(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
+: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false), _oldReactState(REACT_PASSIVE),
+ _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
_stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index d5ab2057d81..28ec4fb9569 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -35,7 +35,7 @@
#include "Battleground.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) :
-UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE)
+UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE), _lastShootPos()
{
for (uint32 i = 0; i < MAX_VEHICLE_SEATS; ++i)
{