Skip to content

Commit

Permalink
DLL_Pure: move data to FactoryObjectBase, introduce interface IFactor…
Browse files Browse the repository at this point in the history
…yObject.
  • Loading branch information
nitrocaster committed Nov 12, 2015
1 parent 5d3320e commit 676b645
Show file tree
Hide file tree
Showing 66 changed files with 115 additions and 96 deletions.
2 changes: 1 addition & 1 deletion src/xrEngine/CustomHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ENGINE_API IRender_Visual;
class CUI;

class ENGINE_API CCustomHUD :
public DLL_Pure,
public FactoryObjectBase,
public IEventReceiver,
public pureScreenResolutionChanged
{
Expand Down
25 changes: 19 additions & 6 deletions src/xrEngine/EngineAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,29 @@
#pragma once
#include "xrEngine/Engine.h"

// Abstract 'Pure' class for DLL interface
class ENGINE_API DLL_Pure
class IFactoryObject
{
public:
virtual ~IFactoryObject() = 0;
virtual CLASS_ID &GetClassId() = 0;
virtual IFactoryObject *_construct() = 0;
};

inline IFactoryObject::~IFactoryObject() {}
inline IFactoryObject *IFactoryObject::_construct() { return this; }

using DLL_Pure = IFactoryObject;

class ENGINE_API FactoryObjectBase : public IFactoryObject
{
public:
CLASS_ID CLS_ID;

DLL_Pure(void* params) { CLS_ID = 0; };
DLL_Pure() { CLS_ID = 0; };
virtual DLL_Pure* _construct() { return this; }
virtual ~DLL_Pure() {};
FactoryObjectBase(void* params) { CLS_ID = 0; };
FactoryObjectBase() { CLS_ID = 0; };
virtual CLASS_ID &GetClassId() override { return CLS_ID; }
virtual IFactoryObject *_construct() override { return IFactoryObject::_construct(); }
virtual ~FactoryObjectBase() {};
};

// Class creation/destroying interface
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/IGame_Level.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ENGINE_API CServerInfo

//-----------------------------------------------------------------------------------------------------------
class ENGINE_API IGame_Level :
public DLL_Pure,
public FactoryObjectBase,
public IInputReceiver,
public pureRender,
public pureFrame,
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/IGame_Persistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ENGINE_API CPS_Instance;
//-----------------------------------------------------------------------------------------------------------
class ENGINE_API IGame_Persistent :
#ifndef _EDITOR
public DLL_Pure,
public FactoryObjectBase,
#endif
public pureAppStart,
public pureAppEnd,
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xr_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IPhysicsShell;
xr_pure_interface IObjectPhysicsCollision;
#pragma pack(push,4)
class ENGINE_API CObject :
public DLL_Pure,
public FactoryObjectBase,
public SpatialBase,
public ScheduledBase,
public RenderableBase,
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ CEntityConditionSimple *CActor::create_entity_condition (CEntityConditionSimple*
return (inherited::create_entity_condition(m_entity_condition));
}

DLL_Pure *CActor::_construct ()
IFactoryObject *CActor::_construct ()
{
m_pPhysics_support = xr_new<CCharacterPhysicsSupport>(CCharacterPhysicsSupport::etActor,this);
CEntityAlive::_construct ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ virtual void HideAllWeapons ( bool v ){ SetWeaponHideState(INV_STATE_BLOCK

public:
IC CActorCondition &conditions () const;
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual bool natural_weapon () const {return false;}
virtual bool natural_detector () const {return false;}
virtual bool use_center_to_aim () const;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ IC void CCar::fill_doors_map(LPCSTR S,xr_map<u16,SDoor>& doors)
}
}

DLL_Pure *CCar::_construct ()
IFactoryObject *CCar::_construct ()
{
inherited::_construct ();
CScriptEntity::_construct ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Car.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ IC size_t CurrentTransmission (){return m_current_transmission_num;}
bool Use (const Fvector& pos,const Fvector& dir,const Fvector& foot_pos);
u16 DriverAnimationType ();
// Core events
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual void Load ( LPCSTR section );
virtual BOOL net_Spawn ( CSE_Abstract* DC );
virtual void net_Destroy ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/CustomMonster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ const MonsterSpace::SBoneRotation &CCustomMonster::head_orientation () const
return (movement().m_body);
}

DLL_Pure *CCustomMonster::_construct()
IFactoryObject *CCustomMonster::_construct()
{
m_memory_manager = create_memory_manager();
m_movement_manager = create_movement_manager();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/CustomMonster.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class CCustomMonster :

public:

virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual BOOL net_Spawn ( CSE_Abstract* DC);
virtual void Die ( CObject* who);

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/DestroyablePhysicsObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool CDestroyablePhysicsObject::CanRemoveObject()
{
return !CParticlesPlayer::IsPlaying()&& !m_destroy_sound._feedback();//&& sound!
}
DLL_Pure *CDestroyablePhysicsObject::_construct()
IFactoryObject *CDestroyablePhysicsObject::_construct()
{

CDamageManager::_construct();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/DestroyablePhysicsObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef CPhysicObject inherited;
virtual void Hit (SHit* pHDS);
virtual void InitServerObject (CSE_Abstract* D) ;
virtual ICollisionDamageReceiver *PHCollisionDamageReceiver () {return (this);}
virtual DLL_Pure *_construct () ;
virtual IFactoryObject *_construct () ;
virtual CPhysicsShellHolder* cast_physics_shell_holder () {return this;}
virtual CParticlesPlayer* cast_particles_player () {return this;}
virtual CPHDestroyable* ph_destroyable () {return this;}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void CEntity::set_ready_to_save ()
{
}

DLL_Pure *CEntity::_construct ()
IFactoryObject *CEntity::_construct ()
{
inherited::_construct ();
CDamageManager::_construct ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CEntity :
// General
CEntity ();
virtual ~CEntity ();
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual CEntity* cast_entity () {return this;}
public:

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ExplosiveRocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CExplosiveRocket::~CExplosiveRocket()
{
}

DLL_Pure *CExplosiveRocket::_construct ()
IFactoryObject *CExplosiveRocket::_construct ()
{
CCustomRocket::_construct ();
CInventoryItem::_construct ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ExplosiveRocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CExplosiveRocket :
public:
CExplosiveRocket(void);
virtual ~CExplosiveRocket(void);
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
public:
virtual CExplosive *cast_explosive () {return this;}
virtual CInventoryItem *cast_inventory_item () {return this;}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Helicopter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void CHelicopter::init()
SetfHealth (1.0f);
}

DLL_Pure* CHelicopter::_construct()
IFactoryObject* CHelicopter::_construct()
{
CEntity::_construct ();
init ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/HudItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CHudItem::CHudItem()
m_started_rnd_anim_idx = u8(-1);
}

DLL_Pure *CHudItem::_construct ()
IFactoryObject *CHudItem::_construct ()
{
m_object = smart_cast<CPhysicItem*>(this);
VERIFY (m_object);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/HudItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CHudItem :public CHUDState
protected:
CHudItem ();
virtual ~CHudItem ();
virtual DLL_Pure* _construct ();
virtual IFactoryObject* _construct ();

Flags16 m_huditem_flags;
enum{
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/InventoryOwner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ CInventoryOwner::CInventoryOwner ()
m_play_show_hide_reload_sounds = true;
}

DLL_Pure *CInventoryOwner::_construct ()
IFactoryObject *CInventoryOwner::_construct ()
{
m_trade_parameters = 0;
m_purchase_list = 0;

return (smart_cast<DLL_Pure*>(this));
return (smart_cast<IFactoryObject*>(this));
}

CInventoryOwner::~CInventoryOwner ()
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/InventoryOwner.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CInventoryOwner : public CAttachmentOwner {
virtual CInventoryOwner* cast_inventory_owner () {return this;}
public:

virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual BOOL net_Spawn (CSE_Abstract* DC);
virtual void net_Destroy ();
void Init ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ bool CMainMenu::ReloadUI()
m_startDialog->HideDialog ();
CleanInternals ();
}
DLL_Pure* dlg = NEW_INSTANCE(TEXT2CLSID("MAIN_MNU"));
IFactoryObject* dlg = NEW_INSTANCE(TEXT2CLSID("MAIN_MNU"));
if(!dlg)
{
m_Flags.set (flActive|flNeedChangeCapture,FALSE);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/UIGameCustom.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CMapListHelper
extern CMapListHelper gMapListHelper;

class CUIGameCustom :
public DLL_Pure,
public FactoryObjectBase,
public CDialogHolder
{
protected:
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/basemonster/base_monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ CMovementManager *CBaseMonster::create_movement_manager ()
return (m_movement_manager);
}

DLL_Pure *CBaseMonster::_construct ()
IFactoryObject *CBaseMonster::_construct ()
{
create_base_controls ();

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/basemonster/base_monster.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CBaseMonster : public CCustomMonster, public CStepManager
// must be called at the end of most derived's Load
virtual void PostLoad (LPCSTR section);

virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();

virtual BOOL net_Spawn (CSE_Abstract* DC);
virtual void net_Destroy ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/pseudodog/pseudodog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CAI_PseudoDog::CAI_PseudoDog()
com_man().add_ability(ControlCom::eControlRotationJump);
}

DLL_Pure *CAI_PseudoDog::_construct()
IFactoryObject *CAI_PseudoDog::_construct()
{
inherited::_construct ();
StateMan = create_state_manager ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/pseudodog/pseudodog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CAI_PseudoDog : public CBaseMonster {
CAI_PseudoDog ();
virtual ~CAI_PseudoDog ();

virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();

virtual void Load (LPCSTR section);

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/rats/ai_rat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ BOOL CAI_Rat::renderable_ShadowGenerate ()
return FALSE;
}

DLL_Pure *CAI_Rat::_construct ()
IFactoryObject *CAI_Rat::_construct ()
{
CCustomMonster::_construct ();
CEatableItem::_construct ();
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/rats/ai_rat.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class CAI_Rat : public CCustomMonster, public CEatableItem
public:
CAI_Rat ();
virtual ~CAI_Rat ();
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();

public:
virtual CGameObject* cast_game_object () {return this;};
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/stalker/ai_stalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ CMemoryManager *CAI_Stalker::create_memory_manager ()
return (xr_new<CMemoryManager>(this,create_sound_visitor()));
}

DLL_Pure *CAI_Stalker::_construct ()
IFactoryObject *CAI_Stalker::_construct ()
{
#ifdef DEBUG_MEMORY_MANAGER
u32 start = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/stalker/ai_stalker.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class CAI_Stalker :

public:
IC stalker_movement_manager_smart_cover &movement () const;
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();

private:
IC bool frame_check (u32 &frame);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/trader/ai_trader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ ALife::ERelationType CAI_Trader::tfGetRelationType (const CEntityAlive *tpEntit
return inherited::tfGetRelationType(tpEntityAlive);
}

DLL_Pure *CAI_Trader::_construct ()
IFactoryObject *CAI_Trader::_construct ()
{
m_sound_player = xr_new<CSoundPlayer>(this);

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/trader/ai_trader.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CAI_Trader : public CEntityAlive,
virtual CParticlesPlayer* cast_particles_player () {return this;}
virtual CScriptEntity* cast_script_entity () {return this;}

virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual void Load ( LPCSTR section );
virtual BOOL net_Spawn ( CSE_Abstract* DC );
virtual void net_Export (NET_Packet& P);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/attachable_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ IC CPhysicsShellHolder &CAttachableItem::object () const
return (item().object());
}

DLL_Pure *CAttachableItem::_construct ()
IFactoryObject *CAttachableItem::_construct ()
{
VERIFY (!m_item);
m_item = smart_cast<CInventoryItem*>(this);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/attachable_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CAttachableItem {
public:
IC CAttachableItem ();
virtual ~CAttachableItem ();
virtual DLL_Pure *_construct ();
virtual IFactoryObject *_construct ();
virtual CAttachableItem *cast_attachable_item () {return this;}
virtual void reload (LPCSTR section);
virtual void OnH_A_Chield ();
Expand Down
3 changes: 2 additions & 1 deletion src/xrGame/base_client_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
////////////////////////////////////////////////////////////////////////////

#pragma once
// XXX: delete/review
/*
class DLL_Pure;
class IFactoryObject;
class ISpatial;
class ISheduled;
class IRenderable;
Expand Down
Loading

0 comments on commit 676b645

Please sign in to comment.