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

Create null instances only after the plugin API was registered. Otherwise the server would've crashed at startup.

This commit is contained in:
Sandu Liviu Catalin 2016-08-17 13:30:48 +03:00
parent e770ac3405
commit 4e039d415a

View File

@ -254,14 +254,6 @@ bool Core::Initialize()
NullTable() = Table(); NullTable() = Table();
NullObject() = Object(); NullObject() = Object();
NullFunction() = Function(); NullFunction() = Function();
// Create the null entity instances
m_NullBlip = Object(new CBlip(-1));
m_NullCheckpoint = Object(new CCheckpoint(-1));
m_NullKeybind = Object(new CKeybind(-1));
m_NullObject = Object(new CObject(-1));
m_NullPickup = Object(new CPickup(-1));
m_NullPlayer = Object(new CPlayer(-1));
m_NullVehicle = Object(new CVehicle(-1));
LogDbg("Registering the standard libraries"); LogDbg("Registering the standard libraries");
// Push the root table on the stack // Push the root table on the stack
@ -294,6 +286,15 @@ bool Core::Initialize()
return false; // Can't execute scripts without a valid API! return false; // Can't execute scripts without a valid API!
} }
// Create the null entity instances
m_NullBlip = Object(new CBlip(-1));
m_NullCheckpoint = Object(new CCheckpoint(-1));
m_NullKeybind = Object(new CKeybind(-1));
m_NullObject = Object(new CObject(-1));
m_NullPickup = Object(new CPickup(-1));
m_NullPlayer = Object(new CPlayer(-1));
m_NullVehicle = Object(new CVehicle(-1));
CSimpleIniA::TNamesDepend scripts; CSimpleIniA::TNamesDepend scripts;
// Attempt to retrieve the list of keys to make sure there's actually something to process // Attempt to retrieve the list of keys to make sure there's actually something to process
if (conf.GetAllKeys("Scripts", scripts) && scripts.size() > 0) if (conf.GetAllKeys("Scripts", scripts) && scripts.size() > 0)