Skip to content

Commit 4410adb

Browse files
author
nitrocaster
committed
CGameObject: move CScriptBinder from inherited classes to protected members.
1 parent a941aee commit 4410adb

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

src/xrGame/GameObject.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void CGameObject::net_Destroy ()
158158

159159
//. Parent = 0;
160160

161-
CScriptBinder::net_Destroy ();
161+
scriptBinder.net_Destroy ();
162162

163163
xr_delete (m_lua_game_object);
164164
m_spawned = false;
@@ -353,11 +353,11 @@ BOOL CGameObject::net_Spawn (CSE_Abstract* DC)
353353

354354
reload (*cNameSect());
355355
if(!g_dedicated_server)
356-
CScriptBinder::reload (*cNameSect());
356+
scriptBinder.reload (*cNameSect());
357357

358358
reinit ();
359359
if(!g_dedicated_server)
360-
CScriptBinder::reinit ();
360+
scriptBinder.reinit ();
361361
#ifdef DEBUG
362362
if(ph_dbg_draw_mask1.test(ph_m1_DbgTrackObject)&&stricmp(PH_DBG_ObjectTrackName(),*cName())==0)
363363
{
@@ -421,7 +421,7 @@ BOOL CGameObject::net_Spawn (CSE_Abstract* DC)
421421
{
422422
Msg("CGameObject::net_Spawn obj %s Before CScriptBinder::net_Spawn %f,%f,%f",PH_DBG_ObjectTrackName(),Position().x,Position().y,Position().z);
423423
}
424-
BOOL ret =CScriptBinder::net_Spawn(DC);
424+
BOOL ret = scriptBinder.net_Spawn(DC);
425425
#else
426426
return (CScriptBinder::net_Spawn(DC));
427427
#endif
@@ -450,7 +450,7 @@ void CGameObject::net_Save (NET_Packet &net_packet)
450450

451451
#endif
452452

453-
CScriptBinder::save (net_packet);
453+
scriptBinder.save (net_packet);
454454

455455
#ifdef DEBUG
456456

@@ -477,7 +477,7 @@ void CGameObject::net_Load (IReader &ireader)
477477

478478
#endif
479479

480-
CScriptBinder::load (ireader);
480+
scriptBinder.load (ireader);
481481

482482

483483
#ifdef DEBUG
@@ -845,12 +845,12 @@ void CGameObject::shedule_Update (u32 dt)
845845
inherited::shedule_Update (dt);
846846

847847
if(!g_dedicated_server)
848-
CScriptBinder::shedule_Update(dt);
848+
scriptBinder.shedule_Update(dt);
849849
}
850850

851851
BOOL CGameObject::net_SaveRelevant ()
852852
{
853-
return (CScriptBinder::net_SaveRelevant());
853+
return scriptBinder.net_SaveRelevant();
854854
}
855855

856856
//èãðîâîå èìÿ îáúåêòà
@@ -908,7 +908,7 @@ void CGameObject::net_Relcase (CObject* O)
908908
{
909909
inherited::net_Relcase (O);
910910
if(!g_dedicated_server)
911-
CScriptBinder::net_Relcase (O);
911+
scriptBinder.net_Relcase (O);
912912
}
913913

914914
CGameObject::CScriptCallbackExVoid &CGameObject::callback(GameObject::ECallbackType type) const

src/xrGame/GameObject.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class IKinematics;
4848
template <typename _return_type>
4949
class CScriptCallbackEx;
5050

51-
class CGameObject :
52-
public CObject,
53-
public CScriptBinder
51+
class CGameObject : public CObject
5452
{
5553
private:
5654
typedef CObject inherited;
@@ -62,6 +60,7 @@ class CGameObject :
6260
ALife::_STORY_ID m_story_id;
6361
animation_movement_controller *m_anim_mov_ctrl;
6462
protected:
63+
CScriptBinder scriptBinder;
6564
//âðåìÿ óäàëåíèÿ îáúåêòà
6665
bool m_bObjectRemoved;
6766
public:
@@ -318,6 +317,9 @@ const animation_movement_controller* animation_movement ( ) const { return m_an
318317
//ìîæíî ëè èñïîëüçîâàòü îáúåêò ñòàíäàðòíûì (íå ñêðèïòîâûì) îáðàçîì
319318
bool nonscript_usable();
320319
void set_nonscript_usable(bool usable);
320+
321+
ScriptObjectBinder *GetScriptObjectBinder() { return scriptBinder.object(); }
322+
void SetScriptObjectBinder(ScriptObjectBinder *object) { scriptBinder.set_object(object); }
321323
};
322324

323325
#endif // !defined(AFX_GAMEOBJECT_H__3DA72D03_C759_4688_AEBB_89FA812AA873__INCLUDED_)

src/xrGame/PhysicObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ BOOL CPhysicObject::net_Spawn(CSE_Abstract* DC)
5151
setVisible(TRUE);
5252
setEnabled(TRUE);
5353

54-
if (!PPhysicsShell()->isBreakable()&&!CScriptBinder::object()&&!CPHSkeleton::IsRemoving())
54+
if (!PPhysicsShell()->isBreakable()&&!scriptBinder.object()&&!CPHSkeleton::IsRemoving())
5555
SheduleUnregister();
5656

5757
//if (PPhysicsShell()->Animated())

src/xrGame/script_binder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class CSE_Abstract;
1212
class ScriptObjectBinder;
1313
class NET_Packet;
14-
// XXX: Merge into CGameObject
14+
1515
class CScriptBinder {
1616
protected:
1717
ScriptObjectBinder *m_object;

src/xrGame/script_game_object.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,12 @@ bool CScriptGameObject::CheckObjectVisibility(const CScriptGameObject *tpLuaGame
259259

260260
ScriptObjectBinder *CScriptGameObject::binded_object ()
261261
{
262-
return (object().object());
262+
return (object().GetScriptObjectBinder());
263263
}
264264

265265
void CScriptGameObject::bind_object (ScriptObjectBinder *game_object)
266266
{
267-
object().set_object (game_object);
267+
object().SetScriptObjectBinder(game_object);
268268
}
269269

270270
void CScriptGameObject::set_previous_point (int point_index)

0 commit comments

Comments
 (0)