Added VSP listening and a function to SMGlobalClass
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40681
This commit is contained in:
parent
b6e9922394
commit
4c3d5673e6
@ -27,6 +27,8 @@
|
||||
using namespace SourcePawn;
|
||||
using namespace SourceMod;
|
||||
|
||||
class IServerPluginCallbacks;
|
||||
|
||||
/**
|
||||
* @brief Lists result codes possible from attempting to set a core configuration option.
|
||||
*/
|
||||
@ -51,6 +53,7 @@ enum ConfigSource
|
||||
*/
|
||||
class SMGlobalClass
|
||||
{
|
||||
friend class SourceMod_Core;
|
||||
friend class SourceModBase;
|
||||
friend class CoreConfig;
|
||||
public:
|
||||
@ -111,6 +114,13 @@ public:
|
||||
virtual void OnSourceModPluginsLoaded()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called when SourceMod receives a pointer to IServerPluginCallbacks from SourceMM
|
||||
*/
|
||||
virtual void OnSourceModVSPReceived(IServerPluginCallbacks *iface)
|
||||
{
|
||||
}
|
||||
private:
|
||||
SMGlobalClass *m_pGlobalClassNext;
|
||||
static SMGlobalClass *head;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "sourcemm_api.h"
|
||||
#include "sm_version.h"
|
||||
#include "sourcemod.h"
|
||||
#include "Logger.h"
|
||||
|
||||
SourceMod_Core g_SourceMod_Core;
|
||||
IVEngineServer *engine = NULL;
|
||||
@ -63,6 +64,9 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
||||
|
||||
gpGlobals = ismm->pGlobals();
|
||||
|
||||
ismm->AddListener(this, this);
|
||||
ismm->EnableVSPListener();
|
||||
|
||||
return g_SourceMod.InitializeSourceMod(error, maxlen, late);
|
||||
}
|
||||
|
||||
@ -125,3 +129,21 @@ const char *SourceMod_Core::GetLogTag()
|
||||
{
|
||||
return "SM";
|
||||
}
|
||||
|
||||
void SourceMod_Core::OnVSPListening(IServerPluginCallbacks *iface)
|
||||
{
|
||||
/* This shouldn't happen */
|
||||
if (!iface)
|
||||
{
|
||||
g_Logger.LogFatal("Metamod:Source version is out of date. SourceMod requires 1.4 or greater.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Notify! */
|
||||
SMGlobalClass *pBase = SMGlobalClass::head;
|
||||
while (pBase)
|
||||
{
|
||||
pBase->OnSourceModVSPReceived(iface);
|
||||
pBase = pBase->m_pGlobalClassNext;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,9 @@
|
||||
* @file Contains wrappers around required Metamod:Source API exports
|
||||
*/
|
||||
|
||||
class SourceMod_Core : public ISmmPlugin
|
||||
class SourceMod_Core :
|
||||
public ISmmPlugin,
|
||||
public IMetamodListener
|
||||
{
|
||||
public:
|
||||
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
|
||||
@ -45,6 +47,8 @@ public:
|
||||
const char *GetVersion();
|
||||
const char *GetDate();
|
||||
const char *GetLogTag();
|
||||
public:
|
||||
void OnVSPListening(IServerPluginCallbacks *iface);
|
||||
};
|
||||
|
||||
extern SourceMod_Core g_SourceMod_Core;
|
||||
|
Loading…
Reference in New Issue
Block a user