Skip to content

Commit

Permalink
CGameObject: move CScriptBinder from inherited classes to protected m…
Browse files Browse the repository at this point in the history
…embers.
  • Loading branch information
nitrocaster committed Nov 14, 2015
1 parent a941aee commit 4410adb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
18 changes: 9 additions & 9 deletions src/xrGame/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void CGameObject::net_Destroy ()

//. Parent = 0;

CScriptBinder::net_Destroy ();
scriptBinder.net_Destroy ();

xr_delete (m_lua_game_object);
m_spawned = false;
Expand Down Expand Up @@ -353,11 +353,11 @@ BOOL CGameObject::net_Spawn (CSE_Abstract* DC)

reload (*cNameSect());
if(!g_dedicated_server)
CScriptBinder::reload (*cNameSect());
scriptBinder.reload (*cNameSect());

reinit ();
if(!g_dedicated_server)
CScriptBinder::reinit ();
scriptBinder.reinit ();
#ifdef DEBUG
if(ph_dbg_draw_mask1.test(ph_m1_DbgTrackObject)&&stricmp(PH_DBG_ObjectTrackName(),*cName())==0)
{
Expand Down Expand Up @@ -421,7 +421,7 @@ BOOL CGameObject::net_Spawn (CSE_Abstract* DC)
{
Msg("CGameObject::net_Spawn obj %s Before CScriptBinder::net_Spawn %f,%f,%f",PH_DBG_ObjectTrackName(),Position().x,Position().y,Position().z);
}
BOOL ret =CScriptBinder::net_Spawn(DC);
BOOL ret = scriptBinder.net_Spawn(DC);
#else
return (CScriptBinder::net_Spawn(DC));
#endif
Expand Down Expand Up @@ -450,7 +450,7 @@ void CGameObject::net_Save (NET_Packet &net_packet)

#endif

CScriptBinder::save (net_packet);
scriptBinder.save (net_packet);

#ifdef DEBUG

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

#endif

CScriptBinder::load (ireader);
scriptBinder.load (ireader);


#ifdef DEBUG
Expand Down Expand Up @@ -845,12 +845,12 @@ void CGameObject::shedule_Update (u32 dt)
inherited::shedule_Update (dt);

if(!g_dedicated_server)
CScriptBinder::shedule_Update(dt);
scriptBinder.shedule_Update(dt);
}

BOOL CGameObject::net_SaveRelevant ()
{
return (CScriptBinder::net_SaveRelevant());
return scriptBinder.net_SaveRelevant();
}

//èãðîâîå èìÿ îáúåêòà
Expand Down Expand Up @@ -908,7 +908,7 @@ void CGameObject::net_Relcase (CObject* O)
{
inherited::net_Relcase (O);
if(!g_dedicated_server)
CScriptBinder::net_Relcase (O);
scriptBinder.net_Relcase (O);
}

CGameObject::CScriptCallbackExVoid &CGameObject::callback(GameObject::ECallbackType type) const
Expand Down
8 changes: 5 additions & 3 deletions src/xrGame/GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class IKinematics;
template <typename _return_type>
class CScriptCallbackEx;

class CGameObject :
public CObject,
public CScriptBinder
class CGameObject : public CObject
{
private:
typedef CObject inherited;
Expand All @@ -62,6 +60,7 @@ class CGameObject :
ALife::_STORY_ID m_story_id;
animation_movement_controller *m_anim_mov_ctrl;
protected:
CScriptBinder scriptBinder;
//âðåìÿ óäàëåíèÿ îáúåêòà
bool m_bObjectRemoved;
public:
Expand Down Expand Up @@ -318,6 +317,9 @@ const animation_movement_controller* animation_movement ( ) const { return m_an
//ìîæíî ëè èñïîëüçîâàòü îáúåêò ñòàíäàðòíûì (íå ñêðèïòîâûì) îáðàçîì
bool nonscript_usable();
void set_nonscript_usable(bool usable);

ScriptObjectBinder *GetScriptObjectBinder() { return scriptBinder.object(); }
void SetScriptObjectBinder(ScriptObjectBinder *object) { scriptBinder.set_object(object); }
};

#endif // !defined(AFX_GAMEOBJECT_H__3DA72D03_C759_4688_AEBB_89FA812AA873__INCLUDED_)
2 changes: 1 addition & 1 deletion src/xrGame/PhysicObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BOOL CPhysicObject::net_Spawn(CSE_Abstract* DC)
setVisible(TRUE);
setEnabled(TRUE);

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

//if (PPhysicsShell()->Animated())
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/script_binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class CSE_Abstract;
class ScriptObjectBinder;
class NET_Packet;
// XXX: Merge into CGameObject

class CScriptBinder {
protected:
ScriptObjectBinder *m_object;
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/script_game_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ bool CScriptGameObject::CheckObjectVisibility(const CScriptGameObject *tpLuaGame

ScriptObjectBinder *CScriptGameObject::binded_object ()
{
return (object().object());
return (object().GetScriptObjectBinder());
}

void CScriptGameObject::bind_object (ScriptObjectBinder *game_object)
{
object().set_object (game_object);
object().SetScriptObjectBinder(game_object);
}

void CScriptGameObject::set_previous_point (int point_index)
Expand Down

0 comments on commit 4410adb

Please sign in to comment.