Serious-Engine/Sources/Engine/Entities/EntityClass.h
Ryan C. Gordon 24cb244d43 First attempt to hand-merge Ryan's Linux and Mac OS X port.
This was a _ton_ of changes, made 15 years ago, so there are probably some
problems to work out still.

Among others: Engine/Base/Stream.* was mostly abandoned and will need to be
re-ported.

Still, this is a pretty good start, and probably holds a world record for
lines of changes or something.  :)
2016-03-28 23:46:13 -04:00

76 lines
2.4 KiB
C++

/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#ifndef SE_INCL_ENTITYCLASS_H
#define SE_INCL_ENTITYCLASS_H
#ifdef PRAGMA_ONCE
#pragma once
#endif
#include <Engine/Base/Serial.h>
#include <Engine/Entities/Entity.h>
#include <Engine/Entities/EntityProperties.h> // rcg10042001
#include <Engine/Base/DynamicLoader.h> // rcg10112001
/*
* General structure of an entity class.
*/
class ENGINE_API CEntityClass : public CSerial {
public:
/* Obtain all components from component table. */
void ObtainComponents_t(void); // throw char *
/* Release all components from component table. */
void ReleaseComponents(void);
public:
CTFileName ec_fnmClassDLL; // filename of the DLL with the class
CDynamicLoader *ec_hiClassDLL;
class CDLLEntityClass *ec_pdecDLLClass; // pointer to DLL class in the DLL
/* Default constructor. */
CEntityClass(void);
/* Constructor for a fixed class. */
CEntityClass(class CDLLEntityClass *pdecDLLClass);
/* Destructor. */
~CEntityClass(void);
/* Clear the object. */
void Clear(void);
// reference counting functions
void AddReference(void);
void RemReference(void);
/* Check that all properties have been properly declared. */
void CheckClassProperties(void);
/* Construct a new member of the class. */
class CEntity *New(void);
/* Get pointer to entity property from its name. */
class CEntityProperty *PropertyForName(const CTString &strPropertyName);
/* Get pointer to entity property from its packed identifier. */
class CEntityProperty *PropertyForTypeAndID(ULONG ulType, ULONG ulID);
/* Get event handler for given state and event code. */
CEntity::pEventHandler HandlerForStateAndEvent(SLONG slState, SLONG slEvent);
/* Get pointer to component from its type and identifier. */
class CEntityComponent *ComponentForTypeAndID(
enum EntityComponentType ectType, SLONG slID);
/* Get pointer to component from the component. */
inline class CEntityComponent *ComponentForPointer(void *pv);
// overrides from CSerial
/* Read from stream. */
virtual void Read_t( CTStream *istr); // throw char *
/* Write to stream. */
virtual void Write_t( CTStream *ostr); // throw char *
// get amount of memory used by this object
SLONG GetUsedMemory(void);
// check if this kind of objects is auto-freed
BOOL IsAutoFreed(void);
// gather the CRC of the file
void AddToCRCTable(void);
};
#endif /* include-once check. */