1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00
SqMod/source/Misc/Automobile.hpp

250 lines
9.7 KiB
C++
Raw Normal View History

2015-09-30 02:56:11 +02:00
#ifndef _MISC_AUTOMOBILE_HPP_
#define _MISC_AUTOMOBILE_HPP_
// ------------------------------------------------------------------------------------------------
#include "Misc/Shared.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* 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:
/* --------------------------------------------------------------------------------------------
* 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;
/* --------------------------------------------------------------------------------------------
* Default constructor.
*/
2015-09-30 02:56:11 +02:00
CAutomobile() noexcept;
/* --------------------------------------------------------------------------------------------
* Construct an instance of this type and reference the model specified.
*/
2015-09-30 02:56:11 +02:00
CAutomobile(SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* 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;
/* --------------------------------------------------------------------------------------------
* Copy constructor.
*/
2015-09-30 02:56:11 +02:00
CAutomobile(const CAutomobile & a) noexcept;
/* --------------------------------------------------------------------------------------------
* Move constructor.
*/
2015-09-30 02:56:11 +02:00
CAutomobile(CAutomobile && a) noexcept;
/* --------------------------------------------------------------------------------------------
* Destructor.
*/
2015-09-30 02:56:11 +02:00
~CAutomobile();
/* --------------------------------------------------------------------------------------------
* Copy assignment operator.
*/
2015-09-30 02:56:11 +02:00
CAutomobile & operator = (const CAutomobile & a) noexcept;
/* --------------------------------------------------------------------------------------------
* Move assignment operator.
*/
2015-09-30 02:56:11 +02:00
CAutomobile & operator = (CAutomobile && a) noexcept;
/* --------------------------------------------------------------------------------------------
* Model identifier assignment operator.
*/
2015-09-30 02:56:11 +02:00
CAutomobile & operator = (SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* Equality comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator == (const CAutomobile & a) const noexcept;
/* --------------------------------------------------------------------------------------------
* Inequality comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator != (const CAutomobile & a) const noexcept;
/* --------------------------------------------------------------------------------------------
* Less than comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator < (const CAutomobile & a) const noexcept;
/* --------------------------------------------------------------------------------------------
* Greater than comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator > (const CAutomobile & a) const noexcept;
/* --------------------------------------------------------------------------------------------
* Less than or equal comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator <= (const CAutomobile & a) const noexcept;
/* --------------------------------------------------------------------------------------------
* Greater than or equal comparison operator.
*/
2015-09-30 02:56:11 +02:00
bool operator >= (const CAutomobile & a) const noexcept;
/* --------------------------------------------------------------------------------------------
* Implicit conversion to model identifier.
*/
operator SQInt32 () const noexcept
{
return m_ID;
}
/* --------------------------------------------------------------------------------------------
* 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;
/* --------------------------------------------------------------------------------------------
* Convert this type to a string.
*/
2015-09-30 02:56:11 +02:00
const SQChar * ToString() const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier referenced by this instance.
*/
2015-09-30 02:56:11 +02:00
SQInteger GetID() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the identifier referenced by this instance.
*/
2015-09-30 02:56:11 +02:00
void SetID(SQInt32 id) noexcept;
/* --------------------------------------------------------------------------------------------
* 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;
/* --------------------------------------------------------------------------------------------
* Retrieve the global tag.
*/
2015-09-30 02:56:11 +02:00
const SQChar * GetGlobalTag() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the global tag.
*/
2015-09-30 02:56:11 +02:00
void SetGlobalTag(const SQChar * tag) const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the global data.
*/
2015-09-30 02:56:11 +02:00
SqObj & GetGlobalData() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the global data.
*/
2015-09-30 02:56:11 +02:00
void SetGlobalData(SqObj & data) const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the local tag.
*/
2015-09-30 02:56:11 +02:00
const SQChar * GetLocalTag() const noexcept;
/* --------------------------------------------------------------------------------------------
* Change the local tag.
*/
2015-09-30 02:56:11 +02:00
void SetLocalTag(const SQChar * tag) noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the local data.
*/
2015-09-30 02:56:11 +02:00
SqObj & GetLocalData() noexcept;
/* --------------------------------------------------------------------------------------------
* Change the local data.
*/
2015-09-30 02:56:11 +02:00
void SetLocalData(SqObj & data) noexcept;
/* --------------------------------------------------------------------------------------------
* See whether the referenced model identifier is valid.
*/
2015-09-30 02:56:11 +02:00
bool IsValid() const noexcept;
/* --------------------------------------------------------------------------------------------
* Retrieve the name of the referenced model.
*/
2015-09-30 02:56:11 +02:00
const SQChar * GetName() const noexcept;
/* --------------------------------------------------------------------------------------------
* 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,
SQInt32 header, SqObj & payload) const noexcept;
/* --------------------------------------------------------------------------------------------
* Create a vehicle instance using the referenced model.
*/
Reference < CVehicle > Create(SQInt32 world, const Vector3 & pos, SQFloat angle,
SQInt32 primary, SQInt32 secondary, SQInt32 header,
SqObj & payload) const noexcept;
/* --------------------------------------------------------------------------------------------
* Create a vehicle instance using the referenced model.
*/
Reference < CVehicle > Create(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQFloat angle,
SQInt32 header, SqObj & payload) const noexcept;
/* --------------------------------------------------------------------------------------------
* 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,
SqObj & payload) const noexcept;
2015-09-30 02:56:11 +02:00
private:
/* --------------------------------------------------------------------------------------------
* The identifier of the referenced model.
*/
2015-09-30 02:56:11 +02:00
SQInt32 m_ID;
/* --------------------------------------------------------------------------------------------
* The local tag associated with this instance.
*/
2015-09-30 02:56:11 +02:00
SqTag m_Tag;
/* --------------------------------------------------------------------------------------------
* The local data associated with this instance.
*/
2015-09-30 02:56:11 +02:00
SqObj m_Data;
};
} // Namespace:: SqMod
#endif // _MISC_AUTOMOBILE_HPP_