Skip to content

Commit 676b645

Browse files
author
nitrocaster
committed
DLL_Pure: move data to FactoryObjectBase, introduce interface IFactoryObject.
1 parent 5d3320e commit 676b645

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+115
-96
lines changed

src/xrEngine/CustomHUD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ENGINE_API IRender_Visual;
1818
class CUI;
1919

2020
class ENGINE_API CCustomHUD :
21-
public DLL_Pure,
21+
public FactoryObjectBase,
2222
public IEventReceiver,
2323
public pureScreenResolutionChanged
2424
{

src/xrEngine/EngineAPI.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,29 @@
99
#pragma once
1010
#include "xrEngine/Engine.h"
1111

12-
// Abstract 'Pure' class for DLL interface
13-
class ENGINE_API DLL_Pure
12+
class IFactoryObject
13+
{
14+
public:
15+
virtual ~IFactoryObject() = 0;
16+
virtual CLASS_ID &GetClassId() = 0;
17+
virtual IFactoryObject *_construct() = 0;
18+
};
19+
20+
inline IFactoryObject::~IFactoryObject() {}
21+
inline IFactoryObject *IFactoryObject::_construct() { return this; }
22+
23+
using DLL_Pure = IFactoryObject;
24+
25+
class ENGINE_API FactoryObjectBase : public IFactoryObject
1426
{
1527
public:
1628
CLASS_ID CLS_ID;
1729

18-
DLL_Pure(void* params) { CLS_ID = 0; };
19-
DLL_Pure() { CLS_ID = 0; };
20-
virtual DLL_Pure* _construct() { return this; }
21-
virtual ~DLL_Pure() {};
30+
FactoryObjectBase(void* params) { CLS_ID = 0; };
31+
FactoryObjectBase() { CLS_ID = 0; };
32+
virtual CLASS_ID &GetClassId() override { return CLS_ID; }
33+
virtual IFactoryObject *_construct() override { return IFactoryObject::_construct(); }
34+
virtual ~FactoryObjectBase() {};
2235
};
2336

2437
// Class creation/destroying interface

src/xrEngine/IGame_Level.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ENGINE_API CServerInfo
4040

4141
//-----------------------------------------------------------------------------------------------------------
4242
class ENGINE_API IGame_Level :
43-
public DLL_Pure,
43+
public FactoryObjectBase,
4444
public IInputReceiver,
4545
public pureRender,
4646
public pureFrame,

src/xrEngine/IGame_Persistent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ENGINE_API CPS_Instance;
1414
//-----------------------------------------------------------------------------------------------------------
1515
class ENGINE_API IGame_Persistent :
1616
#ifndef _EDITOR
17-
public DLL_Pure,
17+
public FactoryObjectBase,
1818
#endif
1919
public pureAppStart,
2020
public pureAppEnd,

src/xrEngine/xr_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class IPhysicsShell;
2727
xr_pure_interface IObjectPhysicsCollision;
2828
#pragma pack(push,4)
2929
class ENGINE_API CObject :
30-
public DLL_Pure,
30+
public FactoryObjectBase,
3131
public SpatialBase,
3232
public ScheduledBase,
3333
public RenderableBase,

src/xrGame/Actor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ CEntityConditionSimple *CActor::create_entity_condition (CEntityConditionSimple*
18591859
return (inherited::create_entity_condition(m_entity_condition));
18601860
}
18611861

1862-
DLL_Pure *CActor::_construct ()
1862+
IFactoryObject *CActor::_construct ()
18631863
{
18641864
m_pPhysics_support = xr_new<CCharacterPhysicsSupport>(CCharacterPhysicsSupport::etActor,this);
18651865
CEntityAlive::_construct ();

src/xrGame/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ virtual void HideAllWeapons ( bool v ){ SetWeaponHideState(INV_STATE_BLOCK
646646

647647
public:
648648
IC CActorCondition &conditions () const;
649-
virtual DLL_Pure *_construct ();
649+
virtual IFactoryObject *_construct ();
650650
virtual bool natural_weapon () const {return false;}
651651
virtual bool natural_detector () const {return false;}
652652
virtual bool use_center_to_aim () const;

src/xrGame/Car.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ IC void CCar::fill_doors_map(LPCSTR S,xr_map<u16,SDoor>& doors)
19341934
}
19351935
}
19361936

1937-
DLL_Pure *CCar::_construct ()
1937+
IFactoryObject *CCar::_construct ()
19381938
{
19391939
inherited::_construct ();
19401940
CScriptEntity::_construct ();

src/xrGame/Car.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ IC size_t CurrentTransmission (){return m_current_transmission_num;}
539539
bool Use (const Fvector& pos,const Fvector& dir,const Fvector& foot_pos);
540540
u16 DriverAnimationType ();
541541
// Core events
542-
virtual DLL_Pure *_construct ();
542+
virtual IFactoryObject *_construct ();
543543
virtual void Load ( LPCSTR section );
544544
virtual BOOL net_Spawn ( CSE_Abstract* DC );
545545
virtual void net_Destroy ();

src/xrGame/CustomMonster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ const MonsterSpace::SBoneRotation &CCustomMonster::head_orientation () const
983983
return (movement().m_body);
984984
}
985985

986-
DLL_Pure *CCustomMonster::_construct()
986+
IFactoryObject *CCustomMonster::_construct()
987987
{
988988
m_memory_manager = create_memory_manager();
989989
m_movement_manager = create_movement_manager();

0 commit comments

Comments
 (0)