Skip to content

Commit 6868992

Browse files
committed
Initialized unitialized variables in the constructor
1 parent b7797f8 commit 6868992

File tree

84 files changed

+190
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+190
-138
lines changed

src/xrCDB/ISpatial.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,13 @@ void ISpatial_NODE::_remove(ISpatial* S)
153153

154154
ISpatial_DB::ISpatial_DB(const char* name) :
155155
#ifdef CONFIG_PROFILE_LOCKS
156-
pcs(new Lock(MUTEX_PROFILE_ID(ISpatial_DB)))
156+
pcs(new Lock(MUTEX_PROFILE_ID(ISpatial_DB))),
157157
#else
158-
pcs(new Lock)
158+
pcs(new Lock),
159159
#endif // CONFIG_PROFILE_LOCKS
160+
rt_insert_object(nullptr), m_root(nullptr),
161+
m_bounds(0), q_result(nullptr)
160162
{
161-
m_root = NULL;
162163
xr_strcpy(Name, name);
163164
}
164165

src/xrEngine/EffectorPP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ENGINE_API CEffectorPP : public SBaseEffector
1313

1414
public:
1515
CEffectorPP(EEffectorPPType type, f32 lifeTime, bool free_on_remove = true);
16-
CEffectorPP() : bFreeOnRemove(true), fLifeTime(0.0f), bOverlap(true){};
16+
CEffectorPP() : bFreeOnRemove(true), fLifeTime(0.0f), bOverlap(true) {};
1717
virtual ~CEffectorPP();
1818
BENCH_SEC_SCRAMBLEVTBL1
1919
virtual BOOL Process(SPPInfo& PPInfo);

src/xrEngine/Stats.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ void CStats::Show()
163163
{
164164
font.SetColor(color_rgba(255, 16, 16, 191));
165165
font.OutSet(400, 0);
166+
166167
for (u32 it = (u32)_max(int(0), (int)errors.size() - g_ErrorLineCount); it < errors.size(); it++)
167168
font.OutNext("%s", errors[it].c_str());
168169
}

src/xrGame/ActorEffector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,12 @@ CCameraEffectorControlled::~CCameraEffectorControlled() { m_controller->SetCam(N
266266
BOOL CCameraEffectorControlled::Valid() { return m_controller->Valid(); }
267267
#define SND_MIN_VOLUME_FACTOR (0.1f)
268268

269-
SndShockEffector::SndShockEffector()
269+
SndShockEffector::SndShockEffector() : m_end_time(0), m_life_time(0)
270270
{
271271
m_snd_length = 0.0f;
272272
m_cur_length = 0.0f;
273273
m_stored_volume = -1.0f;
274-
m_actor = NULL;
274+
m_actor = nullptr;
275275
}
276276

277277
SndShockEffector::~SndShockEffector()

src/xrGame/BastArtifact.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
#include "xrPhysics/extendedgeom.h"
1010
#include "ParticlesObject.h"
1111

12-
CBastArtefact::CBastArtefact(void)
12+
CBastArtefact::CBastArtefact(void) : m_pHitedEntity(nullptr)
1313
{
1414
m_fImpulseThreshold = 10.f;
1515

1616
m_fRadius = 10.f;
1717
m_fStrikeImpulse = 15.f;
1818

1919
m_bStrike = false;
20-
m_AttakingEntity = NULL;
20+
m_AttakingEntity = nullptr;
2121

2222
m_fEnergy = 0.f;
2323
m_fEnergyMax = m_fStrikeImpulse * 100.f;

src/xrGame/BoneProtections.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ struct SBoneProtections
1414
float m_fHitFracActor;
1515
typedef xr_map<s16, BoneProtection> storage_type;
1616
typedef storage_type::iterator storage_it;
17-
SBoneProtections()
17+
SBoneProtections() : m_fHitFracNpc(0)
1818
{
1919
m_default.koeff = 1.0f;
2020
m_default.armor = 0;
2121
m_fHitFracActor = 0.1f;
2222
}
23+
2324
BoneProtection m_default;
2425
storage_type m_bones_koeff;
2526
void reload(const shared_str& outfit_section, IKinematics* kinematics);

src/xrGame/Car.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class CCar : public CEntity,
183183
void SetSteerLimits(float hi, float lo);
184184

185185
virtual void ApplyDamage(u16 level);
186-
SWheel(CCar* acar)
186+
SWheel(CCar* acar) : radius(0)
187187
{
188188
bone_id = BI_NONE;
189189
car = acar;
@@ -321,6 +321,9 @@ class CCar : public CEntity,
321321
};
322322
eState state;
323323
SDoor(CCar* acar)
324+
: update(false), pos_open(0),
325+
opened_angle(0), closed_angle(0),
326+
open_time(0)
324327
{
325328
bone_id = BI_NONE;
326329
pcar = acar;

src/xrGame/CarSound.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// extern CPHWorld* ph_world;
1212
#include "xrPhysics/IPHWorld.h"
13-
CCar::SCarSound::SCarSound(CCar* car)
13+
CCar::SCarSound::SCarSound(CCar* car) : eCarSound(), engine_start_delay(0), time_state_start(0)
1414
{
1515
volume = 1.f;
1616
pcar = car;

src/xrGame/ClimableObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ IC void OrientToNorm(const Fvector& normal, Fmatrix& form, Fobb& box)
4848
}
4949
}
5050

51-
CClimableObject::CClimableObject() : m_pStaticShell(NULL), m_material(u16(-1)) {}
51+
CClimableObject::CClimableObject() : m_pStaticShell(nullptr), m_radius(0), m_material(u16(-1)) {}
5252
CClimableObject::~CClimableObject() {}
5353
void CClimableObject::Load(LPCSTR section) { inherited::Load(section); }
5454
BOOL CClimableObject::net_Spawn(CSE_Abstract* DC)

src/xrGame/CustomDetector.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#include "player_hud.h"
1212
#include "weapon.h"
1313

14-
ITEM_INFO::ITEM_INFO()
14+
ITEM_INFO::ITEM_INFO() : snd_time(0), cur_period(0)
1515
{
16-
pParticle = NULL;
17-
curr_ref = NULL;
16+
pParticle = nullptr;
17+
curr_ref = nullptr;
1818
}
1919

2020
ITEM_INFO::~ITEM_INFO()
@@ -25,7 +25,7 @@ ITEM_INFO::~ITEM_INFO()
2525

2626
bool CCustomDetector::CheckCompatibilityInt(CHudItem* itm, u16* slot_to_activate)
2727
{
28-
if (itm == NULL)
28+
if (itm == nullptr)
2929
return true;
3030

3131
CInventoryItem& iitm = itm->item();

0 commit comments

Comments
 (0)