Skip to content

Commit 4e85afc

Browse files
committed
refactor(w3dview): remove unused MEMBER_ADD/MEMBER_RELEASE macros
Remove obsolete macros now replaced by RefCountPtr<T> and core library macros. - Removed: MEMBER_ADD, MEMBER_RELEASE, SAFE_ADD_REF, SAFE_RELEASE_REF - Kept: SAFE_DELETE, SAFE_DELETE_ARRAY, COM_RELEASE, SAFE_CLOSE, SANITY_CHECK
1 parent d2d68a2 commit 4e85afc

File tree

5 files changed

+9
-31
lines changed

5 files changed

+9
-31
lines changed

Core/Tools/W3DView/EmitterInstanceList.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "StdAfx.h"
3535
#include "EmitterInstanceList.h"
3636
#include "refcount.h"
37+
#include "Utils.h"
3738

3839
/////////////////////////////////////////////////////////////////////
3940
//

Core/Tools/W3DView/GraphicView.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ IMPLEMENT_DYNCREATE(CGraphicView, CView)
7171
////////////////////////////////////////////////////////////////////////////
7272
CGraphicView::CGraphicView (void)
7373
: m_bInitialized (FALSE),
74-
m_pCamera (NULL),
7574
m_TimerID (0),
7675
m_bMouseDown (FALSE),
7776
m_bRMouseDown (FALSE),
@@ -83,7 +82,6 @@ CGraphicView::CGraphicView (void)
8382
m_objectRotation (NoRotation),
8483
m_LightRotation (NoRotation),
8584
m_bLightMeshInScene (false),
86-
m_pLightMesh (NULL),
8785
m_ParticleCountUpdate (0),
8886
m_CameraBonePosX (false),
8987
m_UpdateCounter (0),
@@ -216,7 +214,7 @@ CGraphicView::InitializeGraphicView (void)
216214
if (bReturn && (m_pCamera == NULL))
217215
{
218216
// Instantiate a new camera class
219-
m_pCamera = new CameraClass ();
217+
m_pCamera = RefCountPtr<CameraClass>::Create_NoAddRef(new CameraClass ());
220218
bReturn = (m_pCamera != NULL);
221219

222220
// Were we successful in creating a camera?
@@ -234,7 +232,7 @@ CGraphicView::InitializeGraphicView (void)
234232
//
235233
// Attach the 'listener' to the camera
236234
//
237-
WWAudioClass::Get_Instance ()->Get_Sound_Scene ()->Attach_Listener_To_Obj (m_pCamera);
235+
WWAudioClass::Get_Instance ()->Get_Sound_Scene ()->Attach_Listener_To_Obj (m_pCamera.Peek());
238236
}
239237

240238
Reset_FOV ();
@@ -244,7 +242,7 @@ CGraphicView::InitializeGraphicView (void)
244242
ResourceFileClass light_mesh_file (NULL, "Light.w3d");
245243
WW3DAssetManager::Get_Instance()->Load_3D_Assets (light_mesh_file);
246244

247-
m_pLightMesh = WW3DAssetManager::Get_Instance()->Create_Render_Obj ("LIGHT");
245+
m_pLightMesh = RefCountPtr<RenderObjClass>::Create_NoAddRef(WW3DAssetManager::Get_Instance()->Create_Render_Obj ("LIGHT"));
248246
ASSERT (m_pLightMesh != NULL);
249247
m_bLightMeshInScene = false;
250248
}
@@ -531,7 +529,7 @@ CGraphicView::RepaintView
531529
// Wait for all previous rendering to complete before starting benchmark.
532530
DWORD profile_time = ::Get_CPU_Clock (pt_high);
533531

534-
WW3D::Render (doc->GetScene (), m_pCamera, FALSE, FALSE);
532+
WW3D::Render (doc->GetScene (), m_pCamera.Peek(), FALSE, FALSE);
535533

536534
// Wait for all rendering to complete before stopping benchmark.
537535
DWORD milliseconds = (::Get_CPU_Clock (pt_high) - profile_time) / 1000;
@@ -542,7 +540,7 @@ CGraphicView::RepaintView
542540
WW3D::Render (doc->GetCursorScene (), doc->Get2DCamera (), FALSE, FALSE);
543541

544542
// Render the dazzles
545-
doc->Render_Dazzles(m_pCamera);
543+
doc->Render_Dazzles(m_pCamera.Peek());
546544

547545
// Finish out the rendering process
548546
WW3D::End_Render ();
@@ -601,7 +599,7 @@ CGraphicView::UpdateDisplay (void)
601599
602600
// Render the current view inside the frame
603601
WW3D::Begin_Render (TRUE, TRUE, Vector3 (0.2,0.4,0.6));
604-
WW3D::Render (doc->GetScene (), m_pCamera, FALSE, FALSE);
602+
WW3D::Render (doc->GetScene (), m_pCamera.Peek(), FALSE, FALSE);
605603
WW3D::End_Render ();
606604
} */
607605

Core/Tools/W3DView/GraphicView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class CGraphicView : public CView
201201
//
202202
// Misc
203203
//
204-
RenderObjClass * Get_Light_Mesh (void) const { return m_pLightMesh; }
204+
RenderObjClass * Get_Light_Mesh (void) const { return m_pLightMesh.Peek(); }
205205
Vector3 & Get_Object_Center (void) { return m_ObjectCenter; }
206206

207207
//

Core/Tools/W3DView/Utils.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,6 @@ class RenderObjClass;
3838
#define SAFE_DELETE(pobject) { delete pobject; pobject = NULL; }
3939
#define SAFE_DELETE_ARRAY(pobject) { delete [] pobject; pobject = NULL; }
4040

41-
#define SAFE_ADD_REF(pobject) \
42-
if (pobject) { \
43-
pobject->Add_Ref (); \
44-
} \
45-
46-
#define SAFE_RELEASE_REF(pobject) \
47-
if (pobject) { \
48-
pobject->Release_Ref (); \
49-
} \
50-
51-
#define MEMBER_RELEASE(pmember) \
52-
SAFE_RELEASE_REF(pmember); \
53-
pmember = NULL; \
54-
55-
56-
#define MEMBER_ADD(pmember, pnew) \
57-
MEMBER_RELEASE (pmember); \
58-
pmember = pnew; \
59-
SAFE_ADD_REF (pmember); \
60-
61-
6241
#define COM_RELEASE(pobject) \
6342
if (pobject) { \
6443
pobject->Release (); \

Core/Tools/W3DView/W3DViewDoc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class CW3DViewDoc : public CDocument
113113
CameraClass * Get2DCamera (void) const { return m_pC2DCamera; }
114114
CameraClass * GetBackObjectCamera (void) const { return m_pCBackObjectCamera; }
115115
SceneClass * Get2DScene (void) const { return m_pC2DScene; }
116-
SceneClass * GetCursorScene (void) const { return m_pCursorScene; }
116+
SceneClass * GetCursorScene (void) const { return m_pCursorScene.Peek(); }
117117
ViewerSceneClass * GetScene (void) const { return m_pCScene; }
118118
SceneClass * GetBackObjectScene (void) const { return m_pCBackObjectScene; }
119119
LightClass * GetSceneLight (void) const { return m_pCSceneLight; }

0 commit comments

Comments
 (0)