Skip to content

Commit

Permalink
NULL and 0 replaced by nullptr
Browse files Browse the repository at this point in the history
IC, inline and etc removed where they're not needed
  • Loading branch information
Xottab-DUTY committed Aug 5, 2017
1 parent 290e016 commit 10c60c2
Show file tree
Hide file tree
Showing 166 changed files with 962 additions and 914 deletions.
6 changes: 3 additions & 3 deletions src/Include/xrRender/EnvironmentRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CEnvDescriptor;
class IEnvDescriptorRender
{
public:
virtual ~IEnvDescriptorRender() { ; }
virtual ~IEnvDescriptorRender() {}
virtual void Copy(IEnvDescriptorRender& _in) = 0;

virtual void OnDeviceCreate(CEnvDescriptor& owner) = 0;
Expand All @@ -23,7 +23,7 @@ class IEnvDescriptorRender
class IEnvDescriptorMixerRender
{
public:
virtual ~IEnvDescriptorMixerRender() { ; }
virtual ~IEnvDescriptorMixerRender() {}
virtual void Copy(IEnvDescriptorMixerRender& _in) = 0;

virtual void Destroy() = 0;
Expand All @@ -34,7 +34,7 @@ class IEnvDescriptorMixerRender
class IEnvironmentRender
{
public:
virtual ~IEnvironmentRender() { ; }
virtual ~IEnvironmentRender() {}
virtual void Copy(IEnvironmentRender& _in) = 0;
virtual void OnFrame(CEnvironment& env) = 0;
virtual void OnLoad() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Include/xrRender/FactoryPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FactoryPtr
// unspecified bool type
typedef T const* (FactoryPtr::*unspecified_bool_type)() const;
operator unspecified_bool_type() const { return (!m_pObject ? 0 : &FactoryPtr::get); }
bool operator!() const { return m_pObject == 0; }
bool operator!() const { return m_pObject == nullptr; }
private:
void CreateObject();
void DestroyObject();
Expand Down
8 changes: 4 additions & 4 deletions src/Include/xrRender/KinematicsAnimated.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ class IKinematicsAnimated
virtual MotionID ID_Cycle(shared_str N) = 0;
virtual MotionID ID_Cycle_Safe(shared_str N) = 0;
virtual CBlend* PlayCycle(
LPCSTR N, BOOL bMixIn = TRUE, PlayCallback Callback = 0, LPVOID CallbackParam = 0, u8 channel = 0) = 0;
LPCSTR N, BOOL bMixIn = TRUE, PlayCallback Callback = nullptr, LPVOID CallbackParam = nullptr, u8 channel = 0) = 0;
virtual CBlend* PlayCycle(
MotionID M, BOOL bMixIn = TRUE, PlayCallback Callback = 0, LPVOID CallbackParam = 0, u8 channel = 0) = 0;
virtual CBlend* PlayCycle(u16 partition, MotionID M, BOOL bMixIn = TRUE, PlayCallback Callback = 0,
LPVOID CallbackParam = 0, u8 channel = 0) = 0;
MotionID M, BOOL bMixIn = TRUE, PlayCallback Callback = nullptr, LPVOID CallbackParam = nullptr, u8 channel = 0) = 0;
virtual CBlend* PlayCycle(u16 partition, MotionID M, BOOL bMixIn = TRUE, PlayCallback Callback = nullptr,
LPVOID CallbackParam = nullptr, u8 channel = 0) = 0;
// fx'es
virtual MotionID ID_FX(LPCSTR N) = 0;
virtual MotionID ID_FX_Safe(LPCSTR N) = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/Include/xrRender/RenderVisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class IRenderVisual
virtual shared_str getDebugName() = 0;
#endif

virtual IKinematics* dcast_PKinematics() { return 0; }
virtual IKinematicsAnimated* dcast_PKinematicsAnimated() { return 0; }
virtual IParticleCustom* dcast_ParticleCustom() { return 0; }
virtual IKinematics* dcast_PKinematics() { return nullptr; }
virtual IKinematicsAnimated* dcast_PKinematicsAnimated() { return nullptr; }
virtual IParticleCustom* dcast_ParticleCustom() { return nullptr; }
};

#endif // RenderVisual_included
2 changes: 1 addition & 1 deletion src/Include/xrRender/UIRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class IUIRender
//. virtual void FlushLineStrip() = 0;
//. virtual void StartLineList(u32 iMaxVerts) = 0;
//. virtual void FlushLineList() = 0;
virtual void SetScissor(Irect* rect = NULL) = 0;
virtual void SetScissor(Irect* rect = nullptr) = 0;
virtual void GetActiveTextureResolution(Fvector2& res) = 0;

//. virtual void PushPoint(float x, float y, u32 c, float u, float v) = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Include/xrRender/UIShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class IUIShader
public:
virtual ~IUIShader() { ; }
virtual void Copy(IUIShader& _in) = 0;
virtual void create(LPCSTR sh, LPCSTR tex = 0) = 0;
virtual void create(LPCSTR sh, LPCSTR tex = nullptr) = 0;
virtual bool inited() = 0;
virtual void destroy() = 0;
};
Expand Down
12 changes: 6 additions & 6 deletions src/Include/xrRender/animation_blend.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ class CBlend
IC void update_play(float dt, PlayCallback _Callback);
IC bool update_falloff(float dt);
IC bool update(float dt, PlayCallback _Callback);
IC ECurvature blend_state() const { return blend; }
IC void set_free_state() { blend = eFREE_SLOT; }
IC void set_accrue_state() { blend = eAccrue; }
IC void set_falloff_state() { blend = eFalloff; }
IC void set(const CBlend& r) { *this = r; }
ECurvature blend_state() const { return blend; }
void set_free_state() { blend = eFREE_SLOT; }
void set_accrue_state() { blend = eAccrue; }
void set_falloff_state() { blend = eFalloff; }
void set(const CBlend& r) { *this = r; }
#ifdef DEBUG
CBlend()
:

blendAmount(0),
timeCurrent(0), timeTotal(0), motionID(), bone_or_part(0), channel(0), blend(eFREE_SLOT), blendAccrue(0),
blendFalloff(0), blendPower(0), speed(0), playing(0), stop_at_end_callback(0), stop_at_end(0), fall_at_end(0),
Callback(0), CallbackParam(0), dwFrame(0)
Callback(nullptr), CallbackParam(nullptr), dwFrame(0)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Include/xrRender/animation_motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct MotionID
if (valid())
return &MotionID::get;
else
return 0;
return nullptr;
// return(!valid()?0:&MotionID::get);
}
};
5 changes: 3 additions & 2 deletions src/Layers/xrRender/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class channels
void set_factor(u16 channel, float factor);

public:
IC const channal_rule& rule(u16 channel) { return rules[channel]; }
IC void get_def(u16 channel, channel_def& def)
const channal_rule& rule(u16 channel) { return rules[channel]; }

void get_def(u16 channel, channel_def& def)
{
VERIFY(channel < max);
def.rule = rules[channel];
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/AnimationKeyCalculate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct ConsistantKey
const CKey* K;
float w;

IC void set(const CKey* _K, float _w)
void set(const CKey* _K, float _w)
{
K = _K;
w = _w;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/Blender_Model_EbB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void CBlender_Model_EbB::Compile(CBlender_Compile& C)
}
else
{
LPCSTR vsname = 0;
LPCSTR psname = 0;
LPCSTR vsname = nullptr;
LPCSTR psname = nullptr;
switch (C.iElement)
{
case SE_R1_NORMAL_HQ:
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/Blender_Recorder_R2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void CBlender_Compile::r_End()
dest.constants = RImplementation.Resources->_CreateConstantTable(ctable);
dest.state = RImplementation.Resources->_CreateState(RS.GetContainer());
dest.T = RImplementation.Resources->_CreateTextureList(passTextures);
dest.C = 0;
dest.C = nullptr;
#ifdef _EDITOR
dest.M = 0;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ColorMapManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ void ColorMapManager::UpdateTexture(const shared_str& strTexName, int iTex)
}
else
{
m_CMap[iTex]->surface_set(0);
m_CMap[iTex]->surface_set(nullptr);
}
}
4 changes: 1 addition & 3 deletions src/Layers/xrRender/ColorMapManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ class ColorMapManager
private:
void UpdateTexture(const shared_str& strTexName, int iTex);

private:
struct str_pred : public std::binary_function<const shared_str&, const shared_str&, bool>
{
IC bool operator()(const shared_str& x, const shared_str& y) const { return x < y; }
bool operator()(const shared_str& x, const shared_str& y) const { return x < y; }
};

DEFINE_MAP_PRED(shared_str, ref_texture, map_Tex, map_TexIt, str_pred);

private:
ref_texture m_CMap[2];
shared_str m_strCMap[2];

Expand Down
10 changes: 5 additions & 5 deletions src/Layers/xrRender/D3DUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ void SPrimitiveBuffer::CreateFromData(
// TODO: DX10: Implement SPrimitiveBuffer::CreateFromData for DX10
// VERIFY(!"SPrimitiveBuffer::CreateFromData not implemented for dx10");
#else // USE_DX10
ID3DVertexBuffer* pVB = 0;
ID3DIndexBuffer* pIB = 0;
ID3DVertexBuffer* pVB = nullptr;
ID3DIndexBuffer* pIB = nullptr;
p_cnt = _p_cnt;
p_type = _pt;
v_cnt = _v_cnt;
i_cnt = _i_cnt;
u32 stride = D3DXGetFVFVertexSize(FVF);
R_CHK(HW.pDevice->CreateVertexBuffer(v_cnt * stride, D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &pVB, 0));
R_CHK(HW.pDevice->CreateVertexBuffer(v_cnt * stride, D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &pVB, nullptr));
HW.stats_manager.increment_stats_vb(pVB);
u8* bytes;
R_CHK(pVB->Lock(0, 0, (LPVOID*)&bytes, 0));
Expand Down Expand Up @@ -926,7 +926,7 @@ void CDrawUtilities::DrawFace(
static const u32 MAX_VERT_COUNT = 0xFFFF;
void CDrawUtilities::DD_DrawFace_begin(BOOL bWire)
{
VERIFY(m_DD_pv_start == 0);
VERIFY(m_DD_pv_start == nullptr);
m_DD_wire = bWire;
m_DD_pv_start = (FVF::L*)RCache.Vertex.Lock(MAX_VERT_COUNT, vs_L->vb_stride, m_DD_base);
m_DD_pv = m_DD_pv_start;
Expand Down Expand Up @@ -959,7 +959,7 @@ void CDrawUtilities::DD_DrawFace_push(const Fvector& p0, const Fvector& p1, cons
void CDrawUtilities::DD_DrawFace_end()
{
DD_DrawFace_flush(FALSE);
m_DD_pv_start = 0;
m_DD_pv_start = nullptr;
}
//----------------------------------------------------

Expand Down
19 changes: 9 additions & 10 deletions src/Layers/xrRender/D3DUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ struct SPrimitiveBuffer
TOnRender OnRender;
void xr_stdcall RenderDIP() { DU_DRAW_DIP(p_type, pGeom, 0, 0, v_cnt, 0, p_cnt); }
void xr_stdcall RenderDP() { DU_DRAW_DP(p_type, pGeom, 0, p_cnt); }
public:
SPrimitiveBuffer() : OnRender(0), pGeom(0) { ; }

SPrimitiveBuffer() : OnRender(nullptr), pGeom(nullptr) {}
void CreateFromData(
D3DPRIMITIVETYPE _pt, u32 _p_cnt, u32 FVF, LPVOID vertices, u32 _v_cnt, u16* indices = 0, u32 _i_cnt = 0);
D3DPRIMITIVETYPE _pt, u32 _p_cnt, u32 FVF, LPVOID vertices, u32 _v_cnt, u16* indices = nullptr, u32 _i_cnt = 0);
void Destroy();
void Render() { OnRender(); }
};
Expand Down Expand Up @@ -68,16 +68,15 @@ class ECORE_API CDrawUtilities : public CDUInterface, public pureRender
void DD_DrawFace_push(const Fvector& p0, const Fvector& p1, const Fvector& p2, u32 clr);
void DD_DrawFace_end();

public:
CDrawUtilities()
{
vs_L = 0;
vs_TL = 0;
vs_LIT = 0;
m_DD_pv = 0;
m_DD_pv_start = 0;
vs_L = nullptr;
vs_TL = nullptr;
vs_LIT = nullptr;
m_DD_pv = nullptr;
m_DD_pv_start = nullptr;
m_DD_base = 0;
m_Font = 0;
m_Font = nullptr;
}

void OnDeviceCreate();
Expand Down
30 changes: 16 additions & 14 deletions src/Layers/xrRender/DetailFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ class DetailHeader
size_x = size_z = u32(-1);
}

IC u32 version() const { return _version; }
IC float fromSlotX(int x) const { return (x - offs_x) * DETAIL_SLOT_SIZE + DETAIL_SLOT_SIZE_2; }
IC float fromSlotZ(int z) const { return (z - offs_z) * DETAIL_SLOT_SIZE + DETAIL_SLOT_SIZE_2; }
IC void GetSlotRect(Frect& rect, int sx, int sz) const
u32 version() const { return _version; }
float fromSlotX(int x) const { return (x - offs_x) * DETAIL_SLOT_SIZE + DETAIL_SLOT_SIZE_2; }
float fromSlotZ(int z) const { return (z - offs_z) * DETAIL_SLOT_SIZE + DETAIL_SLOT_SIZE_2; }

void GetSlotRect(Frect& rect, int sx, int sz) const
{
float x = fromSlotX(sx);
float z = fromSlotZ(sz);
Expand All @@ -86,12 +87,13 @@ class DetailHeader
rect.y2 = z + DETAIL_SLOT_SIZE_2 - EPS_L;
}

IC u32 object_count() const { return obj_count; }
IC u32 x_size() const { return size_x; }
IC u32 z_size() const { return size_z; }
IC u32 x_offs() const { return offs_x; }
IC u32 z_offs() const { return offs_z; }
IC u32 slot_index(int _x, int _z) const
u32 object_count() const { return obj_count; }
u32 x_size() const { return size_x; }
u32 z_size() const { return size_z; }
u32 x_offs() const { return offs_x; }
u32 z_offs() const { return offs_z; }

u32 slot_index(int _x, int _z) const
{
u32 ret = _z * size_x + _x;
int xx, zz;
Expand All @@ -101,7 +103,7 @@ class DetailHeader
return ret;
}

IC void slot_x_z(u32 idx, int& _x, int& _z) const
void slot_x_z(u32 idx, int& _x, int& _z) const
{
VERIFY(idx < slot_count());
_z = idx / size_x;
Expand All @@ -110,9 +112,9 @@ class DetailHeader
VERIFY(u32(_x) < x_size());
}

IC u32 slot_count() const { return size_x * size_z; }
IC float slot_min_x(int _x) const { return (int(_x) - int(offs_x)) * DETAIL_SLOT_SIZE; }
IC float slot_min_z(int _z) const { return (int(_z) - int(offs_z)) * DETAIL_SLOT_SIZE; }
u32 slot_count() const { return size_x * size_z; }
float slot_min_x(int _x) const { return (int(_x) - int(offs_x)) * DETAIL_SLOT_SIZE; }
float slot_min_z(int _z) const { return (int(_z) - int(offs_z)) * DETAIL_SLOT_SIZE; }
};

struct DetailPalette
Expand Down
21 changes: 11 additions & 10 deletions src/Layers/xrRender/DetailManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ void CDetailManager::SSwingValue::lerp(const SSwingValue& A, const SSwingValue&
// XXX stats: add to statistics
CDetailManager::CDetailManager() : xrc("detail manager")
{
dtFS = 0;
dtSlots = 0;
soft_Geom = 0;
hw_Geom = 0;
dtFS = nullptr;
dtSlots = nullptr;
soft_Geom = nullptr;
hw_Geom = nullptr;
hw_BatchSize = 0;
hw_VB = 0;
hw_IB = 0;
hw_VB = nullptr;
hw_IB = nullptr;
m_time_rot_1 = 0;
m_time_rot_2 = 0;
m_time_pos = 0;
Expand All @@ -108,7 +108,7 @@ void CDetailManager::Load()
// Open file stream
if (!FS.exist("$level$", "level.details"))
{
dtFS = NULL;
dtFS = nullptr;
return;
}

Expand Down Expand Up @@ -179,6 +179,7 @@ void CDetailManager::Unload()
(*it)->Unload();
xr_delete(*it);
}

objects.clear();
m_visibles[0].clear();
m_visibles[1].clear();
Expand Down Expand Up @@ -330,7 +331,7 @@ void CDetailManager::UpdateVisibleM()
void CDetailManager::Render()
{
#ifndef _EDITOR
if (0 == dtFS)
if (nullptr == dtFS)
return;
if (!psDeviceFlags.is(rsDetails))
return;
Expand Down Expand Up @@ -362,9 +363,9 @@ void CDetailManager::Render()
void __stdcall CDetailManager::MT_CALC()
{
#ifndef _EDITOR
if (0 == RImplementation.Details)
if (nullptr == RImplementation.Details)
return; // possibly deleted
if (0 == dtFS)
if (nullptr == dtFS)
return;
if (!psDeviceFlags.is(rsDetails))
return;
Expand Down
Loading

0 comments on commit 10c60c2

Please sign in to comment.