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 SourcePawn;
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
|
class IServerPluginCallbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Lists result codes possible from attempting to set a core configuration option.
|
* @brief Lists result codes possible from attempting to set a core configuration option.
|
||||||
*/
|
*/
|
||||||
@ -51,6 +53,7 @@ enum ConfigSource
|
|||||||
*/
|
*/
|
||||||
class SMGlobalClass
|
class SMGlobalClass
|
||||||
{
|
{
|
||||||
|
friend class SourceMod_Core;
|
||||||
friend class SourceModBase;
|
friend class SourceModBase;
|
||||||
friend class CoreConfig;
|
friend class CoreConfig;
|
||||||
public:
|
public:
|
||||||
@ -111,6 +114,13 @@ public:
|
|||||||
virtual void OnSourceModPluginsLoaded()
|
virtual void OnSourceModPluginsLoaded()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Called when SourceMod receives a pointer to IServerPluginCallbacks from SourceMM
|
||||||
|
*/
|
||||||
|
virtual void OnSourceModVSPReceived(IServerPluginCallbacks *iface)
|
||||||
|
{
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
SMGlobalClass *m_pGlobalClassNext;
|
SMGlobalClass *m_pGlobalClassNext;
|
||||||
static SMGlobalClass *head;
|
static SMGlobalClass *head;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "sm_version.h"
|
#include "sm_version.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
SourceMod_Core g_SourceMod_Core;
|
SourceMod_Core g_SourceMod_Core;
|
||||||
IVEngineServer *engine = NULL;
|
IVEngineServer *engine = NULL;
|
||||||
@ -62,6 +63,9 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
|||||||
}
|
}
|
||||||
|
|
||||||
gpGlobals = ismm->pGlobals();
|
gpGlobals = ismm->pGlobals();
|
||||||
|
|
||||||
|
ismm->AddListener(this, this);
|
||||||
|
ismm->EnableVSPListener();
|
||||||
|
|
||||||
return g_SourceMod.InitializeSourceMod(error, maxlen, late);
|
return g_SourceMod.InitializeSourceMod(error, maxlen, late);
|
||||||
}
|
}
|
||||||
@ -125,3 +129,21 @@ const char *SourceMod_Core::GetLogTag()
|
|||||||
{
|
{
|
||||||
return "SM";
|
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
|
* @file Contains wrappers around required Metamod:Source API exports
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SourceMod_Core : public ISmmPlugin
|
class SourceMod_Core :
|
||||||
|
public ISmmPlugin,
|
||||||
|
public IMetamodListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
|
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
|
||||||
@ -45,6 +47,8 @@ public:
|
|||||||
const char *GetVersion();
|
const char *GetVersion();
|
||||||
const char *GetDate();
|
const char *GetDate();
|
||||||
const char *GetLogTag();
|
const char *GetLogTag();
|
||||||
|
public:
|
||||||
|
void OnVSPListening(IServerPluginCallbacks *iface);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SourceMod_Core g_SourceMod_Core;
|
extern SourceMod_Core g_SourceMod_Core;
|
||||||
|
@ -74,8 +74,8 @@ public:
|
|||||||
unsigned int GetGlobalTarget() const;
|
unsigned int GetGlobalTarget() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets whether if SoureMod needs to check player auths.
|
* @brief Sets whether if SoureMod needs to check player auths.
|
||||||
*/
|
*/
|
||||||
void SetAuthChecking(bool set);
|
void SetAuthChecking(bool set);
|
||||||
public: // SMGlobalClass
|
public: // SMGlobalClass
|
||||||
ConfigResult OnSourceModConfigChanged(const char *key,
|
ConfigResult OnSourceModConfigChanged(const char *key,
|
||||||
|
Loading…
Reference in New Issue
Block a user