Skip to content
Closed
18 changes: 18 additions & 0 deletions Server/mods/deathmatch/logic/CBlip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ CBlip::~CBlip ( void )
}


CElement* CBlip::Clone ( bool* bAddEntity, CResource* pResource )
{
CBlip* pTemp = m_pBlipManager->Create ( GetParentEntity () );
if ( pTemp )
{
pTemp->m_ucIcon = m_ucIcon;
pTemp->m_ucSize = m_ucSize;
pTemp->SetColor ( GetColor () );

if ( pResource->HasStarted () )
pTemp->Sync ( true );
*bAddEntity = false;
}

return pTemp;
}


void CBlip::Unlink ( void )
{
// Remove us from the manager's list
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CBlip.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class CBlip : public CPerPlayerEntity
CBlip ( CElement* pParent, CXMLNode* pNode, class CBlipManager* pBlipManager );
~CBlip ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

void Unlink ( void );
bool ReadSpecialData ( void );

Expand Down
9 changes: 9 additions & 0 deletions Server/mods/deathmatch/logic/CDummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ CDummy::~CDummy ( void )
}


CElement* CDummy::Clone ( bool* bAddEntity, CResource* pResource )
{
CElement* pNewElement = new CDummy ( g_pGame->GetGroups (), GetParentEntity () );
pNewElement->SetName ( GetName () );
pNewElement->SetTypeName ( GetTypeName () );
return pNewElement;
}


void CDummy::Unlink ( void )
{
// Remove us from groupmanager's list
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CDummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class CDummy : public CElement
CDummy ( class CGroups* pGroups, CElement* pParent, CXMLNode* pNode = NULL );
~CDummy ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

bool IsEntity ( void ) { return true; }

void Unlink ( void );
Expand Down
20 changes: 20 additions & 0 deletions Server/mods/deathmatch/logic/CElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,26 @@ void CElement::GetAttachedRotation ( CVector & vecRotation )
}


bool CElement::IsCloneable ( void )
{
int iType = GetType ();
switch ( iType )
{
case CElement::DUMMY:
case CElement::VEHICLE:
case CElement::OBJECT:
case CElement::MARKER:
case CElement::BLIP:
case CElement::PICKUP:
case CElement::RADAR_AREA:
case CElement::PATH_NODE_UNUSED:
return true;
default:
return false;
}
}


unsigned char CElement::GenerateSyncTimeContext ( void )
{
// Increment the sync time index
Expand Down
3 changes: 3 additions & 0 deletions Server/mods/deathmatch/logic/CElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class CElement
CElement ( CElement* pParent, CXMLNode* pNode = NULL );
virtual ~CElement ( void );

virtual CElement* Clone ( bool* bAddEntity, CResource* pResource ) { return nullptr; };
bool IsCloneable ( void );

inline bool IsBeingDeleted ( void ) { return m_bIsBeingDeleted; };
inline void SetIsBeingDeleted ( bool bBeingDeleted ) { m_bIsBeingDeleted = bBeingDeleted; };
virtual void Unlink ( void ) = 0;
Expand Down
18 changes: 18 additions & 0 deletions Server/mods/deathmatch/logic/CMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ CMarker::~CMarker ( void )
}


CElement* CMarker::Clone ( bool* bAddEntity, CResource* pResource )
{
CMarker* pTemp = m_pMarkerManager->Create ( GetParentEntity () );
if ( pTemp )
{
pTemp->SetMarkerType ( GetMarkerType () );
pTemp->SetColor ( GetColor () );
pTemp->SetSize ( GetSize () );

if ( pResource->HasStarted () )
pTemp->Sync ( true );
*bAddEntity = false;
}

return pTemp;
}


void CMarker::Unlink ( void )
{
// Remove us from the marker manager
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class CMarker : public CPerPlayerEntity, private CColCallback
CMarker ( class CMarkerManager* pMarkerManager, CColManager* pColManager, CElement* pParent, CXMLNode* pNode );
~CMarker ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

void Unlink ( void );
bool ReadSpecialData ( void );

Expand Down
17 changes: 17 additions & 0 deletions Server/mods/deathmatch/logic/CObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,21 @@ CObject::CObject ( const CObject& Copy ) : CElement ( Copy.m_pParent, Copy.m_pXM
, m_pLowLodObject ( Copy.m_pLowLodObject )
{
// Init
m_iType = CElement::OBJECT;
SetTypeName ( "object" );

m_pObjectManager = Copy.m_pObjectManager;
m_usModel = Copy.m_usModel;
m_vecPosition = Copy.m_vecPosition;
m_vecRotation = Copy.m_vecRotation;
m_ucAlpha = Copy.m_ucAlpha;
m_vecScale = CVector ( Copy.m_vecScale.fX, Copy.m_vecScale.fY, Copy.m_vecScale.fZ );
m_fHealth = Copy.m_fHealth;
m_bSyncable = Copy.m_bSyncable;
m_pSyncer = Copy.m_pSyncer;
m_bIsFrozen = Copy.m_bIsFrozen;
m_bDoubleSided = Copy.m_bDoubleSided;
m_bBreakable = Copy.m_bBreakable;

m_pMoveAnimation = NULL;
if ( Copy.m_pMoveAnimation != NULL )
Expand Down Expand Up @@ -82,6 +93,12 @@ CObject::~CObject ( void )
}


CElement* CObject::Clone ( bool* bAddEntity, CResource* pResource )
{
return new CObject ( *this );
}


void CObject::Unlink ( void )
{
// Remove us from the manager's list
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class CObject : public CElement
explicit CObject ( const CObject& Copy );
~CObject ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

bool IsEntity ( void ) { return true; }

void Unlink ( void );
Expand Down
16 changes: 16 additions & 0 deletions Server/mods/deathmatch/logic/CPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ CPed::~CPed ( void )
}


CElement* CPed::Clone ( bool* bAddEntity, CResource* pResource )
{
CPed* pTemp = m_pPedManager->Create ( GetModel (), GetParentEntity (), NULL );
if ( pTemp )
{
pTemp->SetPosition ( GetPosition () );
pTemp->SetRotation ( GetRotation () );
pTemp->SetHealth ( GetHealth () );
pTemp->SetArmor ( GetArmor () );
pTemp->SetSyncable ( IsSyncable () );
}

return pTemp;
}


void CPed::Unlink ( void )
{
// Remove us from the Ped manager
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CPed.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class CPed: public CElement
CPed ( class CPedManager* pPedManager, CElement* pParent, CXMLNode* pNode, unsigned short usModel );
~CPed ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

bool IsEntity ( void ) { return true; }

virtual void Unlink ( void );
Expand Down
18 changes: 17 additions & 1 deletion Server/mods/deathmatch/logic/CPickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ CPickup::~CPickup ( void )
}


CElement* CPickup::Clone ( bool* bAddEntity, CResource* pResource )
{
CPickup* pTemp = m_pPickupManager->Create ( GetParentEntity () );
if ( pTemp )
{
pTemp->SetPickupType ( GetPickupType () );
pTemp->SetModel ( GetModel () );
pTemp->SetWeaponType ( GetWeaponType () );
pTemp->SetAmmo ( GetAmmo () );
pTemp->SetRespawnIntervals ( GetRespawnIntervals () );
}

return pTemp;
}


void CPickup::Unlink ( void )
{
// Remove us from the pickup manager's list
Expand Down Expand Up @@ -546,4 +562,4 @@ void CPickup::Callback_OnCollisionDestroy ( CColShape* pCollision )
{
if ( pCollision == m_pCollision )
m_pCollision = NULL;
}
}
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CPickup.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class CPickup : public CElement, private CColCallback
CPickup ( CElement* pParent, CXMLNode* pNode, class CPickupManager* pPickupManager, CColManager* pColManager );
~CPickup ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

bool IsEntity ( void ) { return true; }

void Unlink ( void );
Expand Down
17 changes: 17 additions & 0 deletions Server/mods/deathmatch/logic/CRadarArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ CRadarArea::~CRadarArea ( void )
}


CElement* CRadarArea::Clone ( bool* bAddEntity, CResource* pResource )
{
CRadarArea* pTemp = m_pRadarAreaManager->Create ( GetParentEntity (), NULL );
if ( pTemp )
{
pTemp->SetSize ( GetSize () );
pTemp->SetColor ( GetColor () );

if ( pResource->HasStarted () )
pTemp->Sync ( true );
*bAddEntity = false;
}

return pTemp;
}


void CRadarArea::Unlink ( void )
{
// Remove us from the manager's list
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CRadarArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class CRadarArea : public CPerPlayerEntity
public:
~CRadarArea ( void );

CElement* Clone ( bool* bAddEntity, CResource* pResource );

void Unlink ( void );

bool ReadSpecialData ( void );
Expand Down
Loading