1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-06 08:57:11 +02:00

Implemented the IRC library.

Fixed a bug in the Routine system that caused crashes when constructed with only the first three arguments because it wasn't attached.
Implemented a gentle release of functions to not release them if the reference count is 1.
Adjusted the Routine and Command system to not be necessary to include them in the module core.
Moved the INI and XML libraries into their own namespace.
Various other modifications and fixes.
This commit is contained in:
Sandu Liviu Catalin
2016-02-23 05:23:56 +02:00
parent b6e72e93a2
commit bedf03c9cd
32 changed files with 10554 additions and 297 deletions

View File

@ -1,8 +1,6 @@
// ------------------------------------------------------------------------------------------------
#include "Core.hpp"
#include "Logger.hpp"
#include "Command.hpp"
#include "Routine.hpp"
// ------------------------------------------------------------------------------------------------
#include "Entity/Blip.hpp"
@ -39,6 +37,18 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------
extern bool RegisterAPI(HSQUIRRELVM vm);
// ------------------------------------------------------------------------------------------------
extern void ProcessIrc();
extern void TerminateIrc();
// ------------------------------------------------------------------------------------------------
extern void ProcessRoutine();
extern void TerminateRoutine();
// ------------------------------------------------------------------------------------------------
extern Int32 RunCommand(Int32 invoker, CSStr command);
extern void TerminateCommand();
// ------------------------------------------------------------------------------------------------
Core * _Core = NULL;
@ -332,10 +342,12 @@ void Core::Terminate()
m_Textdraws.clear();
m_Vehicles.clear();
m_Scripts.clear();
// Release all resources from command manager
_Cmd->Terminate();
// Release all resources from routines
Routine::Cleanup();
TerminateRoutine();
// Release all resources from command manager
TerminateCommand();
// Release all resources from irc sessions
TerminateIrc();
// Is there a VM to close?
if (m_VM)
{
@ -1251,7 +1263,7 @@ void Core::EmitPlayerCommand(Int32 player, CCStr command)
Emit(_player.mOnCommand, command);
Emit(mOnPlayerCommand, _player.mObj, command);
// Send it to the command manager
_Cmd->Run(player, command);
RunCommand(player, command);
}
void Core::EmitPlayerMessage(Int32 player, Int32 receiver, CCStr message)
@ -1664,7 +1676,10 @@ void Core::EmitForcefieldExited(Int32 player, Int32 forcefield)
void Core::EmitServerFrame(Float32 delta)
{
Emit(mOnServerFrame, delta);
Routine::Process();
// Update routines
ProcessRoutine();
// Update IRC sessions
ProcessIrc();
}
void Core::EmitServerStartup()