1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-30 22:17:13 +02:00

Implement a simple system for snippets to be notified when the scripts were loaded and about to be unloaded.

This commit is contained in:
Sandu Liviu Catalin
2016-08-25 03:08:44 +03:00
parent fae1e51c7b
commit 64416c093c
3 changed files with 175 additions and 0 deletions

View File

@ -526,6 +526,8 @@ public:
// --------------------------------------------------------------------------------------------
typedef std::vector< ScriptSrc > Scripts; // List of loaded scripts.
typedef std::pair< Function, Object > FuncData; // Data about a function to be called.
typedef std::vector< FuncData > Functions; // List of functions to execute.
// --------------------------------------------------------------------------------------------
typedef std::unordered_map< String, String > Options; // List of custom options.
@ -563,6 +565,14 @@ private:
bool m_Debugging; // Enable debugging features, if any.
bool m_Executed; // Whether the scripts were executed.
bool m_Shutdown; // Whether the server currently shutting down.
bool m_LockPreLoadSignal; // Lock pre load signal container.
bool m_LockPostLoadSignal; // Lock post load signal container.
bool m_LockUnloadSignal; // Lock unload signal container.
// --------------------------------------------------------------------------------------------
Functions m_PreLoadSignal; // Functions to call before the loaded event.
Functions m_PostLoadSignal; // Functions to call after the loaded event.
Functions m_UnloadSignal; // Functions to call before unloading scripts.
// --------------------------------------------------------------------------------------------
Object m_NullBlip; // Null Blips instance.
@ -913,6 +923,21 @@ protected:
public:
/* --------------------------------------------------------------------------------------------
* Pre load signal binder.
*/
void BindPreLoad(Object & env, Function & func, Object & payload);
/* --------------------------------------------------------------------------------------------
* Post load signal binder.
*/
void BindPostLoad(Object & env, Function & func, Object & payload);
/* --------------------------------------------------------------------------------------------
* Unload signal binder.
*/
void BindUnload(Object & env, Function & func, Object & payload);
/* --------------------------------------------------------------------------------------------
* Global event binder.
*/