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

Added constructor to create a player entity reference from a base reference.

This commit is contained in:
Sandu Liviu Catalin 2015-11-01 01:32:41 +02:00
parent 8d8c9be2fd
commit b0c174e75e
2 changed files with 15 additions and 1 deletions

View File

@ -18,6 +18,13 @@ Vector3 CPlayer::s_Vector3;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQChar CPlayer::s_Buffer[128]; SQChar CPlayer::s_Buffer[128];
// ------------------------------------------------------------------------------------------------
CPlayer::CPlayer(const Reference< CPlayer > & o) noexcept
: Reference(o)
{
/* ... */
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool CPlayer::IsStreamedFor(const Reference < CPlayer > & player) const noexcept bool CPlayer::IsStreamedFor(const Reference < CPlayer > & player) const noexcept
{ {
@ -1700,10 +1707,12 @@ bool Register_CPlayer(HSQUIRRELVM vm)
// Registration failed // Registration failed
return false; return false;
} }
// Typedef the base reference type for simplicity
typedef Reference< CPlayer > RefType;
// Output debugging information // Output debugging information
LogDbg("Beginning registration of <CPlayer> type"); LogDbg("Beginning registration of <CPlayer> type");
// Attempt to register the actual reference that implements all of the entity functionality // Attempt to register the actual reference that implements all of the entity functionality
Sqrat::RootTable(vm).Bind(_SC("CPlayer"), Sqrat::DerivedClass< CPlayer, Reference< CPlayer > >(vm, _SC("CPlayer")) Sqrat::RootTable(vm).Bind(_SC("CPlayer"), Sqrat::DerivedClass< CPlayer, RefType >(vm, _SC("CPlayer"))
/* Constructors */ /* Constructors */
.Ctor() .Ctor()
.Ctor< SQInt32 >() .Ctor< SQInt32 >()

View File

@ -30,6 +30,11 @@ public:
*/ */
using RefType::Reference; using RefType::Reference;
/* --------------------------------------------------------------------------------------------
* Construct a reference from a base reference.
*/
CPlayer(const Reference< CPlayer > & o) noexcept;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* See if the referenced player instance is streamed for the specified player. * See if the referenced player instance is streamed for the specified player.
*/ */