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

Replace GetObject with GetObj to avoid collisions on Windows.

ef you MS
This commit is contained in:
Sandu Liviu Catalin 2020-04-17 17:42:09 +03:00
parent 1242b8a2fc
commit e13d1a91e7
22 changed files with 94 additions and 95 deletions

View File

@ -31,11 +31,6 @@
#include <stdexcept>
#include <algorithm>
// ------------------------------------------------------------------------------------------------
#ifdef GetObject
#undef GetObject
#endif // ef you MS
// ------------------------------------------------------------------------------------------------
namespace SqMod {
@ -371,6 +366,8 @@ bool Core::Initialize()
// Initialize routines and tasks
InitializeRoutines();
InitializeTasks();
// Initialize third-party
// Initialization successful
return true;
@ -478,6 +475,8 @@ void Core::Terminate(bool shutdown)
const ContainerCleaner cc_blips(m_Blips, ENT_BLIP, !shutdown);
const ContainerCleaner cc_keybinds(m_Keybinds, ENT_KEYBIND, !shutdown);
cLogDbg(m_Verbosity >= 1, "Terminating routines an commands");
// Release third-party
// Release all resources from routines and tasks
TerminateRoutines();
TerminateTasks();

View File

@ -1056,7 +1056,7 @@ public:
BlipInst & GetBlip(Int32 id) { return m_Blips.at(static_cast< size_t >(id)); }
CheckpointInst & GetCheckpoint(Int32 id) { return m_Checkpoints.at(static_cast< size_t >(id)); }
KeybindInst & GetKeybind(Int32 id) { return m_Keybinds.at(static_cast< size_t >(id)); }
ObjectInst & GetObject(Int32 id) { return m_Objects.at(static_cast< size_t >(id)); }
ObjectInst & GetObj(Int32 id) { return m_Objects.at(static_cast< size_t >(id)); }
PickupInst & GetPickup(Int32 id) { return m_Pickups.at(static_cast< size_t >(id)); }
PlayerInst & GetPlayer(Int32 id) { return m_Players.at(static_cast< size_t >(id)); }
VehicleInst & GetVehicle(Int32 id) { return m_Vehicles.at(static_cast< size_t >(id)); }
@ -1067,7 +1067,7 @@ public:
const Blips & GetBlips() const { return m_Blips; }
const Checkpoints & GetCheckpoints() const { return m_Checkpoints; }
const Keybinds & GetKeybinds() const { return m_Keybinds; }
const Objects & GetObjects() const { return m_Objects; }
const Objects & GetObjs() const { return m_Objects; }
const Pickups & GetPickups() const { return m_Pickups; }
const Players & GetPlayers() const { return m_Players; }
const Vehicles & GetVehicles() const { return m_Vehicles; }

View File

@ -193,7 +193,7 @@ static LightObj & SqGetKeybind(Int32 id)
}
// ------------------------------------------------------------------------------------------------
static LightObj & SqGetObject(Int32 id)
static LightObj & SqGetObj(Int32 id)
{
// Validate the identifier first
if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL))
@ -201,7 +201,7 @@ static LightObj & SqGetObject(Int32 id)
STHROWF("Out of range object identifier: %d", id);
}
// Return the requested information
return Core::Get().GetObject(id).mObj;
return Core::Get().GetObj(id).mObj;
}
// ------------------------------------------------------------------------------------------------
@ -345,7 +345,7 @@ void Register_Core(HSQUIRRELVM vm)
.Func(_SC("GetBlip"), &SqGetBlip)
.Func(_SC("GetCheckpoint"), &SqGetCheckpoint)
.Func(_SC("GetKeybind"), &SqGetKeybind)
.Func(_SC("GetObject"), &SqGetObject)
.Func(_SC("GetObj"), &SqGetObj)
.Func(_SC("GetPickup"), &SqGetPickup)
.Func(_SC("GetPlayer"), &SqGetPlayer)
.Func(_SC("GetVehicle"), &SqGetVehicle)

View File

@ -15,7 +15,7 @@ const Int32 CBlip::Max = SQMOD_BLIP_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CBlip::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullBlip().GetObject());
sq_pushobject(vm, Core::Get().GetNullBlip().GetObj());
return 1;
}

View File

@ -18,7 +18,7 @@ const Int32 CCheckpoint::Max = SQMOD_CHECKPOINT_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CCheckpoint::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullCheckpoint().GetObject());
sq_pushobject(vm, Core::Get().GetNullCheckpoint().GetObj());
return 1;
}

View File

@ -15,7 +15,7 @@ const Int32 CKeybind::Max = SQMOD_KEYBIND_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CKeybind::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullKeybind().GetObject());
sq_pushobject(vm, Core::Get().GetNullKeybind().GetObj());
return 1;
}

View File

@ -18,7 +18,7 @@ const Int32 CObject::Max = SQMOD_OBJECT_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CObject::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullObject().GetObject());
sq_pushobject(vm, Core::Get().GetNullObject().GetObj());
return 1;
}
@ -107,7 +107,7 @@ LightObj & CObject::GetEvents() const
// Validate the managed identifier
Validate();
// Return the associated event table
return Core::Get().GetObject(m_ID).mEvents;
return Core::Get().GetObj(m_ID).mEvents;
}
// ------------------------------------------------------------------------------------------------

View File

@ -17,7 +17,7 @@ const Int32 CPickup::Max = SQMOD_PICKUP_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CPickup::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullPickup().GetObject());
sq_pushobject(vm, Core::Get().GetNullPickup().GetObj());
return 1;
}

View File

@ -27,7 +27,7 @@ const Int32 CPlayer::Max = SQMOD_PLAYER_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CPlayer::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullPlayer().GetObject());
sq_pushobject(vm, Core::Get().GetNullPlayer().GetObj());
return 1;
}
@ -1329,7 +1329,7 @@ LightObj & CPlayer::StandingOnObject() const
if (VALID_ENTITYEX(id, SQMOD_OBJECT_POOL))
{
// Return the requested information
return Core::Get().GetObject(id).mObj;
return Core::Get().GetObj(id).mObj;
}
// Default to a null object
return Core::Get().GetNullObject();

View File

@ -20,7 +20,7 @@ const Int32 CVehicle::Max = SQMOD_VEHICLE_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CVehicle::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullVehicle().GetObject());
sq_pushobject(vm, Core::Get().GetNullVehicle().GetObj());
return 1;
}

View File

@ -661,7 +661,7 @@ Int32 SQLiteConnHnd::Flush(Uint32 num, Object & env, Function & func)
num = mQueue.size();
}
// Generate the function that should be called upon error
Function callback = Function(env.GetVM(), env.GetObject(), func.GetFunc());
Function callback = Function(env.GetVM(), env.GetObj(), func.GetFunc());
// Obtain iterators to the range of queries that should be flushed
auto itr = mQueue.begin();
auto end = mQueue.begin() + num;

View File

@ -712,7 +712,7 @@ template <> struct InstSpec< CObject >
*/
static inline Instances::const_iterator CBegin()
{
return Core::Get().GetObjects().cbegin();
return Core::Get().GetObjs().cbegin();
}
/* --------------------------------------------------------------------------------------------
@ -720,7 +720,7 @@ template <> struct InstSpec< CObject >
*/
static inline Instances::const_iterator CEnd()
{
return Core::Get().GetObjects().cend();
return Core::Get().GetObjs().cend();
}
/* --------------------------------------------------------------------------------------------
@ -907,7 +907,7 @@ template < typename T > struct AppendElemFunc
void operator () (const typename InstSpec< T >::Instance & inst) const
{
// Push the script object on the stack
sq_pushobject(mVM, inst.mObj.GetObject());
sq_pushobject(mVM, inst.mObj.GetObj());
// Append the object at the back of the array
if (SQ_FAILED(sq_arrayappend(mVM, mIdx)))
{

View File

@ -640,7 +640,7 @@ public:
}
else
{
m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc());
m_OnFail = Function(env.GetVM(), env.GetObj(), func.GetFunc());
}
}
@ -669,7 +669,7 @@ public:
}
else
{
m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc());
m_OnAuth = Function(env.GetVM(), env.GetObj(), func.GetFunc());
}
}
@ -1761,7 +1761,7 @@ public:
}
else
{
m_OnExec = Function(env.GetVM(), env.GetObject(), func.GetFunc());
m_OnExec = Function(env.GetVM(), env.GetObj(), func.GetFunc());
}
}
@ -1790,7 +1790,7 @@ public:
}
else
{
m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc());
m_OnAuth = Function(env.GetVM(), env.GetObj(), func.GetFunc());
}
}
@ -1819,7 +1819,7 @@ public:
}
else
{
m_OnPost = Function(env.GetVM(), env.GetObject(), func.GetFunc());
m_OnPost = Function(env.GetVM(), env.GetObj(), func.GetFunc());
}
}
@ -1848,7 +1848,7 @@ public:
}
else
{
m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc());
m_OnFail = Function(env.GetVM(), env.GetObj(), func.GetFunc());
}
}

View File

@ -434,7 +434,7 @@ public:
*/
void SetEnv(const LightObj & env)
{
GetValid().mEnv = env.IsNull() ? LightObj(RootTable().GetObject()) : env;
GetValid().mEnv = env.IsNull() ? LightObj(RootTable().GetObj()) : env;
}
/* --------------------------------------------------------------------------------------------

View File

@ -113,7 +113,7 @@ protected:
* Forwarding constructor.
*/
Slot(Object & env, Function & func)
: Slot(env.GetObject(), func.GetFunc())
: Slot(env.GetObj(), func.GetFunc())
{
/* ... */
}

View File

@ -190,7 +190,7 @@ LightObj & Tasks::FindEntity(Int32 id, Int32 type)
case ENT_BLIP: return Core::Get().GetBlip(id).mObj;
case ENT_CHECKPOINT: return Core::Get().GetCheckpoint(id).mObj;
case ENT_KEYBIND: return Core::Get().GetKeybind(id).mObj;
case ENT_OBJECT: return Core::Get().GetObject(id).mObj;
case ENT_OBJECT: return Core::Get().GetObj(id).mObj;
case ENT_PICKUP: return Core::Get().GetPickup(id).mObj;
case ENT_PLAYER: return Core::Get().GetPlayer(id).mObj;
case ENT_VEHICLE: return Core::Get().GetVehicle(id).mObj;
@ -244,7 +244,7 @@ SQInteger Tasks::Create(Int32 id, Int32 type, HSQUIRRELVM vm)
// Attempt to retrieve the entity instance
try
{
inst = FindEntity(id, type).GetObject();
inst = FindEntity(id, type).GetObj();
}
catch (const std::exception & e)
{

View File

@ -140,9 +140,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQInteger index, Object& obj) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
sq_pushobject(vm, obj.GetObject());
sq_pushobject(vm, obj.GetObj());
sq_set(vm, -3);
sq_pop(vm,1); // pop array
}
@ -158,7 +158,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& SquirrelFunc(const SQInteger index, SQFUNCTION func, const SQChar* name = nullptr) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -181,7 +181,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& SquirrelFunc(const SQInteger index, SQFUNCTION func, SQInteger pnum, const SQChar * mask, const SQChar* name = nullptr) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -206,7 +206,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& SetValue(const SQInteger index, const V& val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
PushVar(vm, val);
sq_set(vm, -3);
@ -303,7 +303,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function GetFunction(const SQInteger index) {
HSQOBJECT funcObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if(SQ_FAILED(sq_get(vm, -2))) {
@ -319,7 +319,7 @@ public:
sq_get(vm, -2);
#endif
sq_getstackobj(vm, -1, &funcObj);
Function ret(vm, GetObject(), funcObj); // must addref before the pop!
Function ret(vm, GetObj(), funcObj); // must addref before the pop!
sq_pop(vm, 2);
return ret;
}
@ -339,7 +339,7 @@ public:
template <typename T>
void GetArray(T* array, int size) const
{
HSQOBJECT value = GetObject();
HSQOBJECT value = GetObj();
sq_pushobject(vm, value);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if (size > sq_getsize(vm, -1)) {
@ -384,7 +384,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Append(const V& val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayappend(vm, -2);
sq_pop(vm,1); // pop array
@ -403,7 +403,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Append(V* val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayappend(vm, -2);
sq_pop(vm,1); // pop array
@ -423,7 +423,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Insert(const SQInteger destpos, const V& val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayinsert(vm, -2, destpos);
sq_pop(vm,1); // pop array
@ -443,7 +443,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Insert(const SQInteger destpos, V* val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayinsert(vm, -2, destpos);
sq_pop(vm,1); // pop array
@ -458,7 +458,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Object Pop() {
HSQOBJECT slotObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
if(SQ_FAILED(sq_arraypop(vm, -1, true))) {
sq_pop(vm, 1);
return Object(); // Return a NULL object
@ -479,7 +479,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& Remove(const SQInteger itemidx) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_arrayremove(vm, -1, itemidx);
sq_pop(vm,1); // pop array
return *this;
@ -494,7 +494,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& Resize(const SQInteger newsize) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_arrayresize(vm, -1, newsize);
sq_pop(vm,1); // pop array
return *this;
@ -507,7 +507,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& Reverse() {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_arrayreverse(vm, -1);
sq_pop(vm,1); // pop array
return *this;
@ -539,7 +539,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class F>
ArrayBase& AppendFrom(F&& func) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
while (func(vm))
{
sq_arrayappend(vm, -2);
@ -695,7 +695,7 @@ struct Var<Array> {
static void push(HSQUIRRELVM vm, const Array& value) {
HSQOBJECT obj;
sq_resetobject(&obj);
obj = value.GetObject();
obj = value.GetObj();
sq_pushobject(vm,obj);
}
};

View File

@ -132,7 +132,7 @@ public:
/// \return Squirrel object representing the Squirrel class
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT GetObject() const {
virtual HSQOBJECT GetObj() const {
return ClassType<C>::getClassData(vm)->classObj;
}
@ -142,7 +142,7 @@ public:
/// \return Squirrel object representing the Squirrel class
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT& GetObject() {
virtual HSQOBJECT& GetObj() {
return ClassType<C>::getClassData(vm)->classObj;
}

View File

@ -359,9 +359,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ConstTable& Enum(const SQChar* name, Enumeration& en) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, en.GetObject());
sq_pushobject(vm, en.GetObj());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
return *this;

View File

@ -65,10 +65,10 @@ struct Function {
sq_resetobject(&sf.GetFunc());
}
// Constructs a Function from a slot in an Object
Function(const Object& e, const SQChar* slot) : mEnv(e.GetObject()) {
Function(const Object& e, const SQChar* slot) : mEnv(e.GetObj()) {
sq_addref(DefaultVM::Get_(), &mEnv);
Object so = e.GetSlot(slot);
mObj = so.GetObject();
mObj = so.GetObj();
sq_addref(DefaultVM::Get_(), &mObj);
#if !defined (SCRAT_NO_ERROR_CHECKING)
SQObjectType value_type = so.GetType();

View File

@ -223,7 +223,7 @@ public:
vm = so.vm;
obj = so.obj;
release = so.release;
sq_addref(vm, &GetObject());
sq_addref(vm, &GetObj());
return *this;
}
@ -271,7 +271,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ResetObj() {
sq_resetobject(&GetObject());
sq_resetobject(&GetObj());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -280,7 +280,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Reset() {
vm = nullptr;
sq_resetobject(&GetObject());
sq_resetobject(&GetObj());
release = false;
}
@ -311,7 +311,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SQObjectType GetType() const {
return GetObject()._type;
return GetObj()._type;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -321,7 +321,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool IsNull() const {
return sq_isnull(GetObject());
return sq_isnull(GetObj());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -330,7 +330,7 @@ public:
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT GetObject() const {
virtual HSQOBJECT GetObj() const {
return obj;
}
@ -340,7 +340,7 @@ public:
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT& GetObject() {
virtual HSQOBJECT& GetObj() {
return obj;
}
@ -349,7 +349,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
operator HSQOBJECT&() {
return GetObject();
return GetObj();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -371,7 +371,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Object GetSlot(const SQChar* slot) const {
HSQOBJECT slotObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, slot, -1);
#if !defined (SCRAT_NO_ERROR_CHECKING)
@ -403,7 +403,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Object GetSlot(SQInteger index) const {
HSQOBJECT slotObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
#if !defined (SCRAT_NO_ERROR_CHECKING)
@ -434,7 +434,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(const SQChar* key) const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, key, -1);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
@ -453,7 +453,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(SQInteger index) const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
@ -476,7 +476,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <class T>
T Cast() const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
T ret = Var<T>(vm, -1).value;
sq_pop(vm, 1);
return ret;
@ -505,7 +505,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SQInteger GetSize() const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
SQInteger ret = sq_getsize(vm, -1);
sq_pop(vm, 1);
return ret;
@ -623,7 +623,7 @@ protected:
// Bind a function and it's associated Squirrel closure to the object
inline void BindFunc(const SQChar* name, void* method, size_t methodSize, SQFUNCTION func, bool staticVar = false) {
// Push object/environment
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
// Push name where the closure will be stored
sq_pushstring(vm, name, -1);
// Push the native closure pointer as a free variable
@ -641,7 +641,7 @@ protected:
inline void BindFunc(const SQInteger index, void* method, size_t methodSize, SQFUNCTION func, bool staticVar = false, const SQChar* name = nullptr) {
// Push object/environment
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
// Push index where the closure will be stored
sq_pushinteger(vm, index);
// Push the native closure pointer as a free variable
@ -664,7 +664,7 @@ protected:
overloadName.reserve(15);
SqOverloadName::Get(name, argCount, overloadName);
// Push object/environment
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
// Bind overload handler
sq_pushstring(vm, name, -1);
@ -694,7 +694,7 @@ protected:
// Set the value of a variable on the object. Changes to values set this way are not reciprocated
template<class V>
inline void BindValue(const SQChar* name, const V& val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -702,7 +702,7 @@ protected:
}
template<class V>
inline void BindValue(const SQInteger index, const V& val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -712,7 +712,7 @@ protected:
// Set the value of an instance on the object. Changes to values set this way are reciprocated back to the source instance
template<class V>
inline void BindInstance(const SQChar* name, V* val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -720,7 +720,7 @@ protected:
}
template<class V>
inline void BindInstance(const SQInteger index, V* val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -733,7 +733,7 @@ protected:
/// @cond DEV
template<>
inline void Object::BindValue<int>(const SQChar* name, const int & val, bool staticVar /* = false */) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
PushVar<int>(vm, val);
sq_newslot(vm, -3, staticVar);
@ -770,7 +770,7 @@ struct Var<Object> {
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void push(HSQUIRRELVM vm, const Object& value) {
sq_pushobject(vm, value.GetObject());
sq_pushobject(vm, value.GetObj());
}
};
@ -900,7 +900,7 @@ struct LightObj {
/// \param so Object to copy
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LightObj(const Object& obj) : mObj(obj.GetObject()) {
LightObj(const Object& obj) : mObj(obj.GetObj()) {
if (!sq_isnull(mObj)) {
sq_addref(obj.GetVM(), &mObj);
}
@ -1055,7 +1055,7 @@ struct LightObj {
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HSQOBJECT GetObject() const {
HSQOBJECT GetObj() const {
return mObj;
}
@ -1065,7 +1065,7 @@ struct LightObj {
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HSQOBJECT& GetObject() {
HSQOBJECT& GetObj() {
return mObj;
}
@ -1174,7 +1174,7 @@ inline Object& Object::operator=(const LightObj& so) {
vm = SqVM();
obj = so.mObj;
release = !so.IsNull();
sq_addref(vm, &GetObject());
sq_addref(vm, &GetObj());
return *this;
}

View File

@ -158,9 +158,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQChar* name, Object& obj) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, obj.GetObject());
sq_pushobject(vm, obj.GetObj());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
}
@ -176,9 +176,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQChar* name, LightObj& obj) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, obj.GetObject());
sq_pushobject(vm, obj.GetObj());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
}
@ -193,7 +193,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TableBase& SquirrelFunc(const SQChar* name, SQFUNCTION func) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -215,7 +215,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TableBase& SquirrelFunc(const SQChar* name, SQFUNCTION func, SQInteger pnum, const SQChar * mask) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -469,7 +469,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function GetFunction(const SQChar* name) {
HSQOBJECT funcObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if(SQ_FAILED(sq_get(vm, -2))) {
@ -485,7 +485,7 @@ public:
sq_get(vm, -2);
#endif
sq_getstackobj(vm, -1, &funcObj);
Function ret(vm, GetObject(), funcObj); // must addref before the pop!
Function ret(vm, GetObj(), funcObj); // must addref before the pop!
sq_pop(vm, 2);
return ret;
}
@ -500,7 +500,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function GetFunction(const SQInteger index) {
HSQOBJECT funcObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if(SQ_FAILED(sq_get(vm, -2))) {
@ -516,7 +516,7 @@ public:
sq_get(vm, -2);
#endif
sq_getstackobj(vm, -1, &funcObj);
Function ret(vm, GetObject(), funcObj); // must addref before the pop!
Function ret(vm, GetObj(), funcObj); // must addref before the pop!
sq_pop(vm, 2);
return ret;
}
@ -722,7 +722,7 @@ struct Var<Table> {
static void push(HSQUIRRELVM vm, const Table& value) {
HSQOBJECT obj;
sq_resetobject(&obj);
obj = value.GetObject();
obj = value.GetObj();
sq_pushobject(vm,obj);
}
};