2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _MISC_AUTOMOBILE_HPP_
|
|
|
|
#define _MISC_AUTOMOBILE_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include "Misc/Shared.hpp"
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2015-10-29 21:58:13 +01:00
|
|
|
* Class responsible for managing and interacting with vehicle models.
|
2015-09-30 02:56:11 +02:00
|
|
|
*/
|
|
|
|
class CAutomobile : public IdentifierStorage< CAutomobile, SQMOD_VEHICLEID_CAP >
|
|
|
|
{
|
|
|
|
public:
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Helper member for times when a null reference to an instance of this type is needed.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
static const CAutomobile NIL;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile() noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Construct an instance of this type and reference the model specified.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile(SQInt32 id) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Construct an instance of this type and reference the model extracted from the specified name.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile(const SQChar * name, SQInt32 id) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Copy constructor.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile(const CAutomobile & a) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Move constructor.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile(CAutomobile && a) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
~CAutomobile();
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Copy assignment operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile & operator = (const CAutomobile & a) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Move assignment operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile & operator = (CAutomobile && a) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Model identifier assignment operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile & operator = (SQInt32 id) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Equality comparison operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool operator == (const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Inequality comparison operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool operator != (const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Less than comparison operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool operator < (const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Greater than comparison operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool operator > (const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Less than or equal comparison operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool operator <= (const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Greater than or equal comparison operator.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool operator >= (const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Implicit conversion to model identifier.
|
|
|
|
*/
|
|
|
|
operator SQInt32 () const noexcept
|
|
|
|
{
|
|
|
|
return m_ID;
|
|
|
|
}
|
|
|
|
|
2015-11-01 04:36:03 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Implicit conversion to model identifier.
|
|
|
|
*/
|
|
|
|
operator Int64 () const noexcept
|
|
|
|
{
|
|
|
|
return _SCI64(m_ID);
|
|
|
|
}
|
|
|
|
|
2015-10-29 21:58:13 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Implicit conversion to boolean.
|
|
|
|
*/
|
|
|
|
operator bool () const noexcept
|
|
|
|
{
|
|
|
|
return IsAutomobileValid(m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Negation operator.
|
|
|
|
*/
|
|
|
|
bool operator ! () const noexcept
|
|
|
|
{
|
|
|
|
return !IsAutomobileValid(m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Used by the script to compare two instances of this type.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SQInteger Cmp(const CAutomobile & a) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Convert this type to a string.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
const SQChar * ToString() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the identifier referenced by this instance.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SQInteger GetID() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Change the identifier referenced by this instance.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
void SetID(SQInt32 id) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Set the identifier that this insance should reference and
|
|
|
|
* get a reference to the instance to chain operations.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
CAutomobile & SetnGet(SQInt32 id) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the global tag.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
const SQChar * GetGlobalTag() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Change the global tag.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
void SetGlobalTag(const SQChar * tag) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the global data.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SqObj & GetGlobalData() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Change the global data.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
void SetGlobalData(SqObj & data) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the local tag.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
const SQChar * GetLocalTag() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Change the local tag.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
void SetLocalTag(const SQChar * tag) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the local data.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SqObj & GetLocalData() noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Change the local data.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
void SetLocalData(SqObj & data) noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* See whether the referenced model identifier is valid.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
bool IsValid() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the name of the referenced model.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
const SQChar * GetName() const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Change the identifier of the referenced model.
|
|
|
|
*/
|
|
|
|
void SetName(const SQChar * name) noexcept;
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Create a vehicle instance using the referenced model.
|
|
|
|
*/
|
|
|
|
Reference < CVehicle > Create(SQInt32 world, const Vector3 & pos, SQFloat angle,
|
2015-10-11 23:25:26 +02:00
|
|
|
SQInt32 header, SqObj & payload) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Create a vehicle instance using the referenced model.
|
|
|
|
*/
|
|
|
|
Reference < CVehicle > Create(SQInt32 world, const Vector3 & pos, SQFloat angle,
|
|
|
|
SQInt32 primary, SQInt32 secondary, SQInt32 header,
|
2015-10-11 23:25:26 +02:00
|
|
|
SqObj & payload) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Create a vehicle instance using the referenced model.
|
|
|
|
*/
|
|
|
|
Reference < CVehicle > Create(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQFloat angle,
|
2015-10-11 23:25:26 +02:00
|
|
|
SQInt32 header, SqObj & payload) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Create a vehicle instance using the referenced model.
|
|
|
|
*/
|
|
|
|
Reference < CVehicle > Create(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQFloat angle,
|
|
|
|
SQInt32 primary, SQInt32 secondary, SQInt32 header,
|
2015-10-11 23:25:26 +02:00
|
|
|
SqObj & payload) const noexcept;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
2015-09-30 02:56:11 +02:00
|
|
|
private:
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* The identifier of the referenced model.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SQInt32 m_ID;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* The local tag associated with this instance.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SqTag m_Tag;
|
2015-10-29 21:58:13 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* The local data associated with this instance.
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
SqObj m_Data;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
|
|
|
#endif // _MISC_AUTOMOBILE_HPP_
|