1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-11-02 15:27:19 +01:00

Code cleanup.

Get rid of ReleaseGently.
This commit is contained in:
Sandu Liviu Catalin
2020-04-27 13:10:54 +03:00
parent 48005a98f0
commit 22a17fe3c4
28 changed files with 212 additions and 223 deletions

View File

@@ -1835,11 +1835,11 @@ void Core::EmitClientScriptData(Int32 player_id, const uint8_t * data, size_t si
// Create a protected instance of a buffer wrapper
DeleteGuard< SqBuffer > ad(new SqBuffer(std::move(b)));
// Transform the pointer into a script object
PushVar< SqBuffer * >(DefaultVM::Get(), ad.Get());
PushVar< SqBuffer * >(SqVM(), ad.Get());
// The script took over the instance now
ad.Release();
// Get the object from the stack and store it
o = Var< LightObj >(DefaultVM::Get(), -1).value;
o = Var< LightObj >(SqVM(), -1).value;
}
catch (const std::exception & e)
{

View File

@@ -382,11 +382,11 @@ void Core::BlipInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 4);
sq_newtableex(SqVM(), 4);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");
@@ -409,11 +409,11 @@ void Core::CheckpointInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 8);
sq_newtableex(SqVM(), 8);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");
@@ -450,11 +450,11 @@ void Core::KeybindInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 8);
sq_newtableex(SqVM(), 8);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");
@@ -481,11 +481,11 @@ void Core::ObjectInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 12);
sq_newtableex(SqVM(), 12);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");
@@ -524,11 +524,11 @@ void Core::PickupInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 16);
sq_newtableex(SqVM(), 16);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");
@@ -573,11 +573,11 @@ void Core::PlayerInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 86);
sq_newtableex(SqVM(), 86);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");
@@ -758,11 +758,11 @@ void Core::VehicleInst::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 32);
sq_newtableex(SqVM(), 32);
// Grab the table object from the stack
mEvents = LightObj(-1, DefaultVM::Get());
mEvents = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnDestroyed, mEvents, "Destroyed");
InitSignalPair(mOnCustom, mEvents, "Custom");

View File

@@ -47,11 +47,11 @@ void Core::InitEvents()
return;
}
// Create a new table on the stack
sq_newtableex(DefaultVM::Get(), 128);
sq_newtableex(SqVM(), 128);
// Grab the table object from the stack
m_Events = LightObj(-1, DefaultVM::Get());
m_Events = LightObj(-1, SqVM());
// Pop the table object from the stack
sq_pop(DefaultVM::Get(), 1);
sq_pop(SqVM(), 1);
// Proceed to initializing the events
InitSignalPair(mOnCustomEvent, m_Events, "CustomEvent");
InitSignalPair(mOnBlipCreated, m_Events, "BlipCreated");