mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 00:07:19 +01:00 
			
		
		
		
	Documented the Model type and made minor fixes.
This commit is contained in:
		@@ -12,27 +12,29 @@ const CModel CModel::NIL;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
CModel::CModel() noexcept
 | 
					CModel::CModel() noexcept
 | 
				
			||||||
    : m_ID(SQMOD_UNKNOWN), m_Name()
 | 
					    : m_ID(SQMOD_UNKNOWN)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CModel::CModel(SQInt32 id) noexcept
 | 
					CModel::CModel(SQInt32 id) noexcept
 | 
				
			||||||
    : m_ID(VALID_ENTITYGETEX(id, Max)), m_Name(GetModelName(id))
 | 
					    : m_ID(VALID_ENTITYGETEX(id, Max))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CModel::CModel(const SQChar * name, SQInt32 id) noexcept
 | 
					CModel::CModel(const SQChar * name, SQInt32 id) noexcept
 | 
				
			||||||
    : CModel(WeaponToModel(IsWeaponValid(GetWeaponID(name)) ? GetWeaponID(name) : id))
 | 
					    : m_ID(GetWeaponID(name))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if (VALID_ENTITYGETEX(m_ID, Max))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        m_ID = id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
CModel::CModel(const CModel & m) noexcept
 | 
					CModel::CModel(const CModel & m) noexcept
 | 
				
			||||||
    : m_ID(m.m_ID)
 | 
					    : m_ID(m.m_ID)
 | 
				
			||||||
    , m_Name(m.m_Name)
 | 
					 | 
				
			||||||
    , m_Tag(m.m_Tag)
 | 
					    , m_Tag(m.m_Tag)
 | 
				
			||||||
    , m_Data(m.m_Data)
 | 
					    , m_Data(m.m_Data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -41,7 +43,6 @@ CModel::CModel(const CModel & m) noexcept
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
CModel::CModel(CModel && m) noexcept
 | 
					CModel::CModel(CModel && m) noexcept
 | 
				
			||||||
    : m_ID(m.m_ID)
 | 
					    : m_ID(m.m_ID)
 | 
				
			||||||
    , m_Name(m.m_Name)
 | 
					 | 
				
			||||||
    , m_Tag(m.m_Tag)
 | 
					    , m_Tag(m.m_Tag)
 | 
				
			||||||
    , m_Data(m.m_Data)
 | 
					    , m_Data(m.m_Data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -58,29 +59,25 @@ CModel::~CModel()
 | 
				
			|||||||
CModel & CModel::operator = (const CModel & m) noexcept
 | 
					CModel & CModel::operator = (const CModel & m) noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_ID = m.m_ID;
 | 
					    m_ID = m.m_ID;
 | 
				
			||||||
    m_Name = m.m_Name;
 | 
					 | 
				
			||||||
    m_Tag = m.m_Tag;
 | 
					    m_Tag = m.m_Tag;
 | 
				
			||||||
    m_Data = m.m_Data;
 | 
					    m_Data = m.m_Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return *this;
 | 
					    return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CModel & CModel::operator = (CModel && m) noexcept
 | 
					CModel & CModel::operator = (CModel && m) noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_ID = m.m_ID;
 | 
					    m_ID = m.m_ID;
 | 
				
			||||||
    m_Name = m.m_Name;
 | 
					 | 
				
			||||||
    m_Tag = m.m_Tag;
 | 
					    m_Tag = m.m_Tag;
 | 
				
			||||||
    m_Data = m.m_Data;
 | 
					    m_Data = m.m_Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return *this;
 | 
					    return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
CModel & CModel::operator = (SQInt32 id) noexcept
 | 
					CModel & CModel::operator = (SQInt32 id) noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (m_ID != id)
 | 
					    m_ID = VALID_ENTITYGETEX(id, Max);
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        m_Name = GetModelName(id);
 | 
					 | 
				
			||||||
        m_ID = id;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return *this;
 | 
					    return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -119,13 +116,24 @@ bool CModel::operator >= (const CModel & m) const noexcept
 | 
				
			|||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
SQInteger CModel::Cmp(const CModel & m) const noexcept
 | 
					SQInteger CModel::Cmp(const CModel & m) const noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_ID == m.m_ID ? 0 : (m_ID > m.m_ID ? 1 : -1);
 | 
					    if (m_ID == m.m_ID)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if (m_ID > m.m_ID)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return -1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
const SQChar * CModel::ToString() const noexcept
 | 
					const SQChar * CModel::ToString() const noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_Name.c_str();
 | 
					    return GetModelName(m_ID);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
@@ -136,21 +144,13 @@ SQInteger CModel::GetID() const noexcept
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void CModel::SetID(SQInt32 id) noexcept
 | 
					void CModel::SetID(SQInt32 id) noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (m_ID != id)
 | 
					    m_ID = VALID_ENTITYGETEX(id, Max);
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        m_Name = GetModelName(id);
 | 
					 | 
				
			||||||
        m_ID = id;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
CModel & CModel::SetnGet(SQInt32 id) noexcept
 | 
					CModel & CModel::SetnGet(SQInt32 id) noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (m_ID != id)
 | 
					    m_ID = VALID_ENTITYGETEX(id, Max);
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        m_Name = GetModelName(id);
 | 
					 | 
				
			||||||
        m_ID = id;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return *this;
 | 
					    return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -202,13 +202,19 @@ void CModel::SetLocalData(SqObj & data) noexcept
 | 
				
			|||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
bool CModel::IsValid() const noexcept
 | 
					bool CModel::IsValid() const noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (m_ID > 0);
 | 
					    return (VALID_ENTITYEX(m_ID, Max));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
const SQChar * CModel::GetName() const noexcept
 | 
					const SQChar * CModel::GetName() const noexcept
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_Name.c_str();
 | 
					    return GetModelName(m_ID);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void CModel::SetName(const SQChar * name) noexcept
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    m_ID = -1; /* @TODO Implement! */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
@@ -255,29 +261,34 @@ bool Register_CModel(HSQUIRRELVM vm)
 | 
				
			|||||||
    LogDbg("Beginning registration of <CModel> type");
 | 
					    LogDbg("Beginning registration of <CModel> type");
 | 
				
			||||||
    // Attempt to register the specified type
 | 
					    // Attempt to register the specified type
 | 
				
			||||||
    Sqrat::RootTable(vm).Bind(_SC("CModel"), Sqrat::Class< CModel >(vm, _SC("CModel"))
 | 
					    Sqrat::RootTable(vm).Bind(_SC("CModel"), Sqrat::Class< CModel >(vm, _SC("CModel"))
 | 
				
			||||||
 | 
					        /* Constructors */
 | 
				
			||||||
        .Ctor()
 | 
					        .Ctor()
 | 
				
			||||||
        .Ctor< SQInt32 >()
 | 
					        .Ctor< SQInt32 >()
 | 
				
			||||||
        .Ctor< const SQChar *, SQInt32 >()
 | 
					        .Ctor< const SQChar *, SQInt32 >()
 | 
				
			||||||
 | 
					        /* Metamethods */
 | 
				
			||||||
        .Func(_SC("_cmp"), &CModel::Cmp)
 | 
					        .Func(_SC("_cmp"), &CModel::Cmp)
 | 
				
			||||||
        .Func(_SC("_tostring"), &CModel::ToString)
 | 
					        .Func(_SC("_tostring"), &CModel::ToString)
 | 
				
			||||||
 | 
					        /* Properties */
 | 
				
			||||||
        .Prop(_SC("id"), &CModel::GetID, &CModel::SetID)
 | 
					        .Prop(_SC("id"), &CModel::GetID, &CModel::SetID)
 | 
				
			||||||
        .Prop(_SC("gtag"), &CModel::GetGlobalTag, &CModel::SetGlobalTag)
 | 
					        .Prop(_SC("gtag"), &CModel::GetGlobalTag, &CModel::SetGlobalTag)
 | 
				
			||||||
        .Prop(_SC("gdata"), &CModel::GetGlobalData, &CModel::SetGlobalData)
 | 
					        .Prop(_SC("gdata"), &CModel::GetGlobalData, &CModel::SetGlobalData)
 | 
				
			||||||
        .Prop(_SC("ltag"), &CModel::GetLocalTag, &CModel::SetLocalTag)
 | 
					        .Prop(_SC("ltag"), &CModel::GetLocalTag, &CModel::SetLocalTag)
 | 
				
			||||||
        .Prop(_SC("ldata"), &CModel::GetLocalData, &CModel::SetLocalData)
 | 
					        .Prop(_SC("ldata"), &CModel::GetLocalData, &CModel::SetLocalData)
 | 
				
			||||||
        .Prop(_SC("valid"), &CModel::IsValid)
 | 
					        .Prop(_SC("valid"), &CModel::IsValid)
 | 
				
			||||||
        .Prop(_SC("name"), &CModel::GetName)
 | 
					        .Prop(_SC("name"), &CModel::GetName, &CModel::SetName)
 | 
				
			||||||
        .Prop(_SC("weapon"), &CModel::IsWeapon)
 | 
					        .Prop(_SC("weapon"), &CModel::IsWeapon)
 | 
				
			||||||
        .Prop(_SC("truly_weapon"), &CModel::IsActuallyWeapon)
 | 
					        .Prop(_SC("truly_weapon"), &CModel::IsActuallyWeapon)
 | 
				
			||||||
 | 
					        /* Functions */
 | 
				
			||||||
        .Func(_SC("setng"), &CModel::SetnGet)
 | 
					        .Func(_SC("setng"), &CModel::SetnGet)
 | 
				
			||||||
 | 
					        /* Overloads */
 | 
				
			||||||
        .Overload< Reference< CObject > (CModel::*)(SQInt32, const Vector3 &, SQInt32, SQInt32, SqObj &) const >(_SC("object"), &CModel::Object)
 | 
					        .Overload< Reference< CObject > (CModel::*)(SQInt32, const Vector3 &, SQInt32, SQInt32, SqObj &) const >
 | 
				
			||||||
        .Overload< Reference< CObject > (CModel::*)(SQInt32, SQFloat, SQFloat, SQFloat, SQInt32, SQInt32, SqObj &) const >(_SC("object"), &CModel::Object)
 | 
					            (_SC("object"), &CModel::Object)
 | 
				
			||||||
        .Overload< Reference< CPickup > (CModel::*)(SQInt32, SQInt32, const Vector3 &, SQInt32, bool, SQInt32, SqObj &) const >(_SC("pickup"), &CModel::Pickup)
 | 
					        .Overload< Reference< CObject > (CModel::*)(SQInt32, SQFloat, SQFloat, SQFloat, SQInt32, SQInt32, SqObj &) const >
 | 
				
			||||||
        .Overload< Reference< CPickup > (CModel::*)(SQInt32, SQInt32, SQFloat, SQFloat, SQFloat, SQInt32, bool, SQInt32, SqObj &) const >(_SC("pickup"), &CModel::Pickup)
 | 
					            (_SC("object"), &CModel::Object)
 | 
				
			||||||
 | 
					        .Overload< Reference< CPickup > (CModel::*)(SQInt32, SQInt32, const Vector3 &, SQInt32, bool, SQInt32, SqObj &) const >
 | 
				
			||||||
 | 
					            (_SC("pickup"), &CModel::Pickup)
 | 
				
			||||||
 | 
					        .Overload< Reference< CPickup > (CModel::*)(SQInt32, SQInt32, SQFloat, SQFloat, SQFloat, SQInt32, bool, SQInt32, SqObj &) const >
 | 
				
			||||||
 | 
					            (_SC("pickup"), &CModel::Pickup)
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    // Output debugging information
 | 
					    // Output debugging information
 | 
				
			||||||
    LogDbg("Registration of <CModel> type was successful");
 | 
					    LogDbg("Registration of <CModel> type was successful");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,83 +7,248 @@
 | 
				
			|||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
namespace SqMod {
 | 
					namespace SqMod {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Class responsible for managing and interacting with object and pickup models.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
class CModel : public IdentifierStorage< CModel, SQMOD_MODELID_CAP >
 | 
					class CModel : public IdentifierStorage< CModel, SQMOD_MODELID_CAP >
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Helper member for times when a null reference to an instance of this type is needed.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    static const CModel NIL;
 | 
					    static const CModel NIL;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Default constructor.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel() noexcept;
 | 
					    CModel() noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Construct an instance of this type and reference the model specified.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel(SQInt32 id) noexcept;
 | 
					    CModel(SQInt32 id) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Construct an instance of this type and reference the model extracted from the specified name.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel(const SQChar * name, SQInt32 id) noexcept;
 | 
					    CModel(const SQChar * name, SQInt32 id) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Copy constructor.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel(const CModel & m) noexcept;
 | 
					    CModel(const CModel & m) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Move constructor.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel(CModel && m) noexcept;
 | 
					    CModel(CModel && m) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Destructor.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    ~CModel();
 | 
					    ~CModel();
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Copy assignment operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel & operator = (const CModel & m) noexcept;
 | 
					    CModel & operator = (const CModel & m) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Move assignment operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel & operator = (CModel && m) noexcept;
 | 
					    CModel & operator = (CModel && m) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Model identifier assignment operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel & operator = (SQInt32 id) noexcept;
 | 
					    CModel & operator = (SQInt32 id) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Equality comparison operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool operator == (const CModel & m) const noexcept;
 | 
					    bool operator == (const CModel & m) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Inequality comparison operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool operator != (const CModel & m) const noexcept;
 | 
					    bool operator != (const CModel & m) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Less than comparison operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool operator < (const CModel & m) const noexcept;
 | 
					    bool operator < (const CModel & m) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Greater than comparison operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool operator > (const CModel & m) const noexcept;
 | 
					    bool operator > (const CModel & m) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Less than or equal comparison operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool operator <= (const CModel & m) const noexcept;
 | 
					    bool operator <= (const CModel & m) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Greater than or equal comparison operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool operator >= (const CModel & m) const noexcept;
 | 
					    bool operator >= (const CModel & m) const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
    operator SQInt32 () const noexcept { return m_ID; }
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
    operator bool () const noexcept { return IsModelValid(m_ID); }
 | 
					     * Implicit conversion to model identifier.
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					    */
 | 
				
			||||||
    bool operator ! () const noexcept { return !IsModelValid(m_ID); }
 | 
					    operator SQInt32 () const noexcept
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					    {
 | 
				
			||||||
 | 
					        return m_ID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Implicit conversion to boolean.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    operator bool () const noexcept
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return IsModelValid(m_ID);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Negation operator.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    bool operator ! () const noexcept
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return !IsModelValid(m_ID);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Used by the script to compare two instances of this type.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SQInteger Cmp(const CModel & m) const noexcept;
 | 
					    SQInteger Cmp(const CModel & m) const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Convert this type to a string.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    const SQChar * ToString() const noexcept;
 | 
					    const SQChar * ToString() const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Retrieve the identifier referenced by this instance.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SQInteger GetID() const noexcept;
 | 
					    SQInteger GetID() const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Change the identifier referenced by this instance.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    void SetID(SQInt32 id) noexcept;
 | 
					    void SetID(SQInt32 id) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Set the identifier that this insance should reference and
 | 
				
			||||||
 | 
					     * get a reference to the instance to chain operations.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    CModel & SetnGet(SQInt32 id) noexcept;
 | 
					    CModel & SetnGet(SQInt32 id) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Retrieve the global tag.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    const SQChar * GetGlobalTag() const noexcept;
 | 
					    const SQChar * GetGlobalTag() const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Change the global tag.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    void SetGlobalTag(const SQChar * tag) const noexcept;
 | 
					    void SetGlobalTag(const SQChar * tag) const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Retrieve the global data.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SqObj & GetGlobalData() const noexcept;
 | 
					    SqObj & GetGlobalData() const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Change the global data.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    void SetGlobalData(SqObj & data) const noexcept;
 | 
					    void SetGlobalData(SqObj & data) const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Retrieve the local tag.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    const SQChar * GetLocalTag() const noexcept;
 | 
					    const SQChar * GetLocalTag() const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Change the local tag.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    void SetLocalTag(const SQChar * tag) noexcept;
 | 
					    void SetLocalTag(const SQChar * tag) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Retrieve the local data.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SqObj & GetLocalData() noexcept;
 | 
					    SqObj & GetLocalData() noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Change the local data.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    void SetLocalData(SqObj & data) noexcept;
 | 
					    void SetLocalData(SqObj & data) noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * See whether the referenced model identifier is valid.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool IsValid() const noexcept;
 | 
					    bool IsValid() const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Retrieve the name of the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    const SQChar * GetName() const noexcept;
 | 
					    const SQChar * GetName() const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Change the identifier of the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    void SetName(const SQChar * name) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * See if the referenced model identifier is a weapon model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool IsWeapon() const noexcept;
 | 
					    bool IsWeapon() const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * See if the referenced model identifier is truly a weapon model
 | 
				
			||||||
 | 
					     * and not something like a camera.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    bool IsActuallyWeapon() const noexcept;
 | 
					    bool IsActuallyWeapon() const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
    Reference< CObject > Object(SQInt32 world, const Vector3 & pos, SQInt32 alpha, SQInt32 header, \
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Create an object instance using the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Reference< CObject > Object(SQInt32 world, const Vector3 & pos, SQInt32 alpha, SQInt32 header,
 | 
				
			||||||
                                SqObj & payload) const noexcept;
 | 
					                                SqObj & payload) const noexcept;
 | 
				
			||||||
    Reference< CObject > Object(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQInt32 alpha, \
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Create an object instance using the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Reference< CObject > Object(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQInt32 alpha,
 | 
				
			||||||
                                SQInt32 header, SqObj & payload) const noexcept;
 | 
					                                SQInt32 header, SqObj & payload) const noexcept;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
    Reference< CPickup > Pickup(SQInt32 world, SQInt32 quantity, const Vector3 & pos, SQInt32 alpha, \
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Create a pickup instance using the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Reference< CPickup > Pickup(SQInt32 world, SQInt32 quantity, const Vector3 & pos, SQInt32 alpha,
 | 
				
			||||||
                                bool automatic, SQInt32 header, SqObj & payload) const noexcept;
 | 
					                                bool automatic, SQInt32 header, SqObj & payload) const noexcept;
 | 
				
			||||||
    Reference< CPickup > Pickup(SQInt32 world, SQInt32 quantity, SQFloat x, SQFloat y, SQFloat z, \
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * Create a pickup instance using the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    Reference< CPickup > Pickup(SQInt32 world, SQInt32 quantity, SQFloat x, SQFloat y, SQFloat z,
 | 
				
			||||||
                                SQInt32 alpha, bool automatic, SQInt32 header, SqObj & payload) const noexcept;
 | 
					                                SQInt32 alpha, bool automatic, SQInt32 header, SqObj & payload) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * The identifier of the referenced model.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SQInt32     m_ID;
 | 
					    SQInt32     m_ID;
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					
 | 
				
			||||||
    String      m_Name;
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
    // --------------------------------------------------------------------------------------------
 | 
					     * The local tag associated with this instance.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SqTag       m_Tag;
 | 
					    SqTag       m_Tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					     * The local data associated with this instance.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
    SqObj       m_Data;
 | 
					    SqObj       m_Data;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user