All pastes #971351 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2008-04-04 17:59 UTC
rendered paste body
template <class T>class CEntityFactory : public IEntityFactory{public:	CEntityFactory( const char *pClassName )	{		EntityFactoryDictionary()->InstallFactory( this, pClassName );	}	IServerNetworkable *Create( const char *pClassName )	{		T* pEnt = _CreateEntityTemplate((T*)NULL, pClassName);		return pEnt->NetworkProp();	}	void Destroy( IServerNetworkable *pNetworkable )	{		if ( pNetworkable )		{			pNetworkable->Release();		}	}	virtual size_t GetEntitySize()	{		return sizeof(T);	}};#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \	static CEntityFactory<DLLClassName> mapClassName( #mapClassName );