mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Prevent server callbacks not being bound when compiling on linux.
This commit is contained in:
parent
1229e7f59f
commit
5ddb222903
@ -14,16 +14,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -163,7 +153,10 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnServerFrame = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -175,24 +168,6 @@ static void OnServerFrame(float /*delta*/)
|
||||
Session::Process();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnServerFrame = OnServerFrame;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnServerFrame = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void RegisterAPI(HSQUIRRELVM vm)
|
||||
{
|
||||
@ -532,8 +507,11 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQIRC_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnServerFrame = OnServerFrame;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQIRC_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -8,16 +8,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -155,20 +145,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -243,8 +219,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQJSON_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQJSON_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -10,16 +10,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -157,20 +147,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -326,8 +302,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQMG_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQMG_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -8,16 +8,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -155,20 +145,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -220,8 +196,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQMMDB_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQMMDB_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -8,16 +8,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -155,20 +145,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -233,8 +209,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQMYSQL_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQMYSQL_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -8,16 +8,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -156,20 +146,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -229,8 +205,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQSAMPLE_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQSAMPLE_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -8,16 +8,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -155,20 +145,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -239,8 +215,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQSQLITE_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQSQLITE_NAME);
|
||||
// Dummy spacing
|
||||
|
@ -13,16 +13,6 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind specific functions to certain server events.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Undo changes made with BindCallbacks().
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Register the module API under the specified virtual machine.
|
||||
*/
|
||||
@ -160,20 +150,6 @@ static uint8_t OnServerInitialise()
|
||||
static void OnServerShutdown(void)
|
||||
{
|
||||
// The server may still send callbacks
|
||||
UnbindCallbacks();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
@ -517,8 +493,10 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * functions, PluginCall
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQXML_HOST_NAME);
|
||||
// Bind callbacks
|
||||
BindCallbacks();
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnPluginCommand = OnPluginCommand;
|
||||
// Notify that the plug-in was successfully loaded
|
||||
OutputMessage("Successfully loaded %s", SQXML_NAME);
|
||||
// Dummy spacing
|
||||
|
184
source/Main.cpp
184
source/Main.cpp
@ -61,16 +61,6 @@ void DoReload()
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Bind all server callbacks.
|
||||
*/
|
||||
void BindCallbacks();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Unbind all server callbacks.
|
||||
*/
|
||||
void UnbindCallbacks();
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
#define SQMOD_CATCH_EVENT_EXCEPTION(ev) /*
|
||||
*/ catch (const Sqrat::Exception & e) /*
|
||||
@ -138,7 +128,50 @@ static void OnServerShutdown(void)
|
||||
// See if a reload was requested (quite useless here but why not)
|
||||
SQMOD_RELOAD_CHECK(g_Reload)
|
||||
// The server still triggers callbacks and we deallocated everything!
|
||||
UnbindCallbacks();
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnServerFrame = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
_Clbk->OnIncomingConnection = nullptr;
|
||||
_Clbk->OnClientScriptData = nullptr;
|
||||
_Clbk->OnPlayerConnect = nullptr;
|
||||
_Clbk->OnPlayerDisconnect = nullptr;
|
||||
_Clbk->OnPlayerRequestClass = nullptr;
|
||||
_Clbk->OnPlayerRequestSpawn = nullptr;
|
||||
_Clbk->OnPlayerSpawn = nullptr;
|
||||
_Clbk->OnPlayerDeath = nullptr;
|
||||
_Clbk->OnPlayerUpdate = nullptr;
|
||||
_Clbk->OnPlayerRequestEnterVehicle = nullptr;
|
||||
_Clbk->OnPlayerEnterVehicle = nullptr;
|
||||
_Clbk->OnPlayerExitVehicle = nullptr;
|
||||
_Clbk->OnPlayerNameChange = nullptr;
|
||||
_Clbk->OnPlayerStateChange = nullptr;
|
||||
_Clbk->OnPlayerActionChange = nullptr;
|
||||
_Clbk->OnPlayerOnFireChange = nullptr;
|
||||
_Clbk->OnPlayerCrouchChange = nullptr;
|
||||
_Clbk->OnPlayerGameKeysChange = nullptr;
|
||||
_Clbk->OnPlayerBeginTyping = nullptr;
|
||||
_Clbk->OnPlayerEndTyping = nullptr;
|
||||
_Clbk->OnPlayerAwayChange = nullptr;
|
||||
_Clbk->OnPlayerMessage = nullptr;
|
||||
_Clbk->OnPlayerCommand = nullptr;
|
||||
_Clbk->OnPlayerPrivateMessage = nullptr;
|
||||
_Clbk->OnPlayerKeyBindDown = nullptr;
|
||||
_Clbk->OnPlayerKeyBindUp = nullptr;
|
||||
_Clbk->OnPlayerSpectate = nullptr;
|
||||
_Clbk->OnPlayerCrashReport = nullptr;
|
||||
_Clbk->OnVehicleUpdate = nullptr;
|
||||
_Clbk->OnVehicleExplode = nullptr;
|
||||
_Clbk->OnVehicleRespawn = nullptr;
|
||||
_Clbk->OnObjectShot = nullptr;
|
||||
_Clbk->OnObjectTouched = nullptr;
|
||||
_Clbk->OnPickupPickAttempt = nullptr;
|
||||
_Clbk->OnPickupPicked = nullptr;
|
||||
_Clbk->OnPickupRespawn = nullptr;
|
||||
_Clbk->OnCheckpointEntered = nullptr;
|
||||
_Clbk->OnCheckpointExited = nullptr;
|
||||
_Clbk->OnEntityPoolChange = nullptr;
|
||||
_Clbk->OnServerPerformanceReport = nullptr;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -805,9 +838,44 @@ static void OnServerPerformanceReport(size_t /*entry_count*/, CCStr * /*descript
|
||||
// Ignored for now...
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BindCallbacks()
|
||||
} // Namespace:: SqMod
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Plugiun initialization procedure.
|
||||
*/
|
||||
SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * funcs, PluginCallbacks * calls, PluginInfo * info)
|
||||
{
|
||||
using namespace SqMod;
|
||||
// Output plug-in header
|
||||
puts("");
|
||||
OutputMessage("--------------------------------------------------------------------");
|
||||
OutputMessage("Plug-in: %s", SQMOD_NAME);
|
||||
OutputMessage("Author: %s", SQMOD_AUTHOR);
|
||||
OutputMessage("Legal: %s", SQMOD_COPYRIGHT);
|
||||
OutputMessage("--------------------------------------------------------------------");
|
||||
puts("");
|
||||
// Store server proxies
|
||||
_Func = funcs;
|
||||
_Clbk = calls;
|
||||
_Info = info;
|
||||
// Assign plug-in version
|
||||
_Info->pluginVersion = SQMOD_VERSION;
|
||||
_Info->apiMajorVersion = PLUGIN_API_MAJOR;
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQMOD_HOST_NAME);
|
||||
// Attempt to initialize the logger before anything else
|
||||
Logger::Get().Initialize(nullptr);
|
||||
// Attempt to initialize the plug-in core
|
||||
if (!Core::Get().Initialize())
|
||||
{
|
||||
LogFtl("Unable to initialize the plug-in central core");
|
||||
// Attempt to terminate
|
||||
Core::Get().Terminate(false);
|
||||
// Stop here!
|
||||
return SQMOD_FAILURE;
|
||||
}
|
||||
// Bind to the server callbacks
|
||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||
_Clbk->OnServerFrame = OnServerFrame;
|
||||
@ -852,96 +920,6 @@ void BindCallbacks()
|
||||
_Clbk->OnCheckpointExited = OnCheckpointExited;
|
||||
_Clbk->OnEntityPoolChange = OnEntityPoolChange;
|
||||
_Clbk->OnServerPerformanceReport = OnServerPerformanceReport;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void UnbindCallbacks()
|
||||
{
|
||||
_Clbk->OnServerInitialise = nullptr;
|
||||
_Clbk->OnServerShutdown = nullptr;
|
||||
_Clbk->OnServerFrame = nullptr;
|
||||
_Clbk->OnPluginCommand = nullptr;
|
||||
_Clbk->OnIncomingConnection = nullptr;
|
||||
_Clbk->OnClientScriptData = nullptr;
|
||||
_Clbk->OnPlayerConnect = nullptr;
|
||||
_Clbk->OnPlayerDisconnect = nullptr;
|
||||
_Clbk->OnPlayerRequestClass = nullptr;
|
||||
_Clbk->OnPlayerRequestSpawn = nullptr;
|
||||
_Clbk->OnPlayerSpawn = nullptr;
|
||||
_Clbk->OnPlayerDeath = nullptr;
|
||||
_Clbk->OnPlayerUpdate = nullptr;
|
||||
_Clbk->OnPlayerRequestEnterVehicle = nullptr;
|
||||
_Clbk->OnPlayerEnterVehicle = nullptr;
|
||||
_Clbk->OnPlayerExitVehicle = nullptr;
|
||||
_Clbk->OnPlayerNameChange = nullptr;
|
||||
_Clbk->OnPlayerStateChange = nullptr;
|
||||
_Clbk->OnPlayerActionChange = nullptr;
|
||||
_Clbk->OnPlayerOnFireChange = nullptr;
|
||||
_Clbk->OnPlayerCrouchChange = nullptr;
|
||||
_Clbk->OnPlayerGameKeysChange = nullptr;
|
||||
_Clbk->OnPlayerBeginTyping = nullptr;
|
||||
_Clbk->OnPlayerEndTyping = nullptr;
|
||||
_Clbk->OnPlayerAwayChange = nullptr;
|
||||
_Clbk->OnPlayerMessage = nullptr;
|
||||
_Clbk->OnPlayerCommand = nullptr;
|
||||
_Clbk->OnPlayerPrivateMessage = nullptr;
|
||||
_Clbk->OnPlayerKeyBindDown = nullptr;
|
||||
_Clbk->OnPlayerKeyBindUp = nullptr;
|
||||
_Clbk->OnPlayerSpectate = nullptr;
|
||||
_Clbk->OnPlayerCrashReport = nullptr;
|
||||
_Clbk->OnVehicleUpdate = nullptr;
|
||||
_Clbk->OnVehicleExplode = nullptr;
|
||||
_Clbk->OnVehicleRespawn = nullptr;
|
||||
_Clbk->OnObjectShot = nullptr;
|
||||
_Clbk->OnObjectTouched = nullptr;
|
||||
_Clbk->OnPickupPickAttempt = nullptr;
|
||||
_Clbk->OnPickupPicked = nullptr;
|
||||
_Clbk->OnPickupRespawn = nullptr;
|
||||
_Clbk->OnCheckpointEntered = nullptr;
|
||||
_Clbk->OnCheckpointExited = nullptr;
|
||||
_Clbk->OnEntityPoolChange = nullptr;
|
||||
_Clbk->OnServerPerformanceReport = nullptr;
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Plugiun initialization procedure.
|
||||
*/
|
||||
SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * funcs, PluginCallbacks * calls, PluginInfo * info)
|
||||
{
|
||||
using namespace SqMod;
|
||||
// Output plug-in header
|
||||
puts("");
|
||||
OutputMessage("--------------------------------------------------------------------");
|
||||
OutputMessage("Plug-in: %s", SQMOD_NAME);
|
||||
OutputMessage("Author: %s", SQMOD_AUTHOR);
|
||||
OutputMessage("Legal: %s", SQMOD_COPYRIGHT);
|
||||
OutputMessage("--------------------------------------------------------------------");
|
||||
puts("");
|
||||
// Store server proxies
|
||||
_Func = funcs;
|
||||
_Clbk = calls;
|
||||
_Info = info;
|
||||
// Assign plug-in version
|
||||
_Info->pluginVersion = SQMOD_VERSION;
|
||||
_Info->apiMajorVersion = PLUGIN_API_MAJOR;
|
||||
_Info->apiMinorVersion = PLUGIN_API_MINOR;
|
||||
// Assign the plug-in name
|
||||
std::snprintf(_Info->name, sizeof(_Info->name), "%s", SQMOD_HOST_NAME);
|
||||
// Attempt to initialize the logger before anything else
|
||||
Logger::Get().Initialize(nullptr);
|
||||
// Attempt to initialize the plug-in core
|
||||
if (!Core::Get().Initialize())
|
||||
{
|
||||
LogFtl("Unable to initialize the plug-in central core");
|
||||
// Attempt to terminate
|
||||
Core::Get().Terminate(false);
|
||||
// Stop here!
|
||||
return SQMOD_FAILURE;
|
||||
}
|
||||
// Bind to server callbacks
|
||||
BindCallbacks();
|
||||
// Attempt to initialize the plug-in exports
|
||||
InitExports();
|
||||
// Dummy spacing
|
||||
|
Loading…
Reference in New Issue
Block a user