Put the game provider in its own header.
This commit is contained in:
parent
401aa038f8
commit
23feee0e00
@ -45,6 +45,7 @@
|
|||||||
#include "CoreConfig.h"
|
#include "CoreConfig.h"
|
||||||
#include "ConCmdManager.h"
|
#include "ConCmdManager.h"
|
||||||
#include "IDBDriver.h"
|
#include "IDBDriver.h"
|
||||||
|
#include "provider.h"
|
||||||
#if SOURCE_ENGINE == SE_DOTA
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
# include "convar_sm_dota.h"
|
# include "convar_sm_dota.h"
|
||||||
#elif SOURCE_ENGINE >= SE_ALIENSWARM
|
#elif SOURCE_ENGINE >= SE_ALIENSWARM
|
||||||
@ -127,7 +128,7 @@ public:
|
|||||||
serverpluginhelpers->ClientCommand(pEdict, szCommand);
|
serverpluginhelpers->ClientCommand(pEdict, szCommand);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
} engine_wrapper;
|
||||||
|
|
||||||
class VFileSystem_Logic : public IFileSystem_Logic
|
class VFileSystem_Logic : public IFileSystem_Logic
|
||||||
{
|
{
|
||||||
@ -216,7 +217,7 @@ public:
|
|||||||
{
|
{
|
||||||
filesystem->CreateDirHierarchy(path, pathID);
|
filesystem->CreateDirHierarchy(path, pathID);
|
||||||
}
|
}
|
||||||
};
|
} fs_wrapper;
|
||||||
|
|
||||||
class VPlayerInfo_Logic : public IPlayerInfo_Logic
|
class VPlayerInfo_Logic : public IPlayerInfo_Logic
|
||||||
{
|
{
|
||||||
@ -285,7 +286,7 @@ public:
|
|||||||
{
|
{
|
||||||
pInfo->ChangeTeam(iTeamNum);
|
pInfo->ChangeTeam(iTeamNum);
|
||||||
}
|
}
|
||||||
};
|
} playerinfo_wrapper;
|
||||||
|
|
||||||
static ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY, "Activity display setting (see sourcemod.cfg)");
|
static ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY, "Activity display setting (see sourcemod.cfg)");
|
||||||
static ConVar sm_immunity_mode("sm_immunity_mode", "1", FCVAR_SPONLY, "Mode for deciding immunity protection");
|
static ConVar sm_immunity_mode("sm_immunity_mode", "1", FCVAR_SPONLY, "Mode for deciding immunity protection");
|
||||||
@ -413,15 +414,14 @@ void UTIL_ConsolePrint(const char *fmt, ...)
|
|||||||
|
|
||||||
static ServerGlobals serverGlobals;
|
static ServerGlobals serverGlobals;
|
||||||
|
|
||||||
class CoreProviderImpl : public CoreProvider
|
CoreProviderImpl sCoreProviderImpl;
|
||||||
{
|
|
||||||
public:
|
CoreProviderImpl::CoreProviderImpl()
|
||||||
CoreProviderImpl()
|
|
||||||
{
|
{
|
||||||
this->sm = &g_SourceMod;
|
this->sm = &g_SourceMod;
|
||||||
this->engine = &engine_wrapper_;
|
this->engine = &engine_wrapper;
|
||||||
this->filesystem = &fs_wrapper_;
|
this->filesystem = &fs_wrapper;
|
||||||
this->playerInfo = &playerinfo_wrapper_;
|
this->playerInfo = &playerinfo_wrapper;
|
||||||
this->timersys = &g_Timers;
|
this->timersys = &g_Timers;
|
||||||
this->playerhelpers = &g_Players;
|
this->playerhelpers = &g_Players;
|
||||||
this->gamehelpers = &g_HL2;
|
this->gamehelpers = &g_HL2;
|
||||||
@ -446,37 +446,6 @@ public:
|
|||||||
this->listeners = nullptr;
|
this->listeners = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local functions.
|
|
||||||
void InitializeBridge();
|
|
||||||
bool LoadBridge(char *error, size_t maxlength);
|
|
||||||
void ShutdownBridge();
|
|
||||||
|
|
||||||
// Provider implementation.
|
|
||||||
ConVar *FindConVar(const char *name) override;
|
|
||||||
const char *GetCvarString(ConVar *cvar) override;
|
|
||||||
bool GetCvarBool(ConVar* cvar) override;
|
|
||||||
bool GetGameName(char *buffer, size_t maxlength) override;
|
|
||||||
const char *GetGameDescription() override;
|
|
||||||
const char *GetSourceEngineName() override;
|
|
||||||
bool SymbolsAreHidden() override;
|
|
||||||
bool IsMapLoading() override;
|
|
||||||
bool IsMapRunning() override;
|
|
||||||
int MaxClients() override;
|
|
||||||
bool DescribePlayer(int index, const char **namep, const char **authp, int *useridp) override;
|
|
||||||
void LogToGame(const char *message) override;
|
|
||||||
void ConPrint(const char *message) override;
|
|
||||||
void ConsolePrintVa(const char *fmt, va_list ap) override;
|
|
||||||
int LoadMMSPlugin(const char *file, bool *ok, char *error, size_t maxlength) override;
|
|
||||||
void UnloadMMSPlugin(int id) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ke::Ref<ke::SharedLib> logic_;
|
|
||||||
LogicInitFunction logic_init_;
|
|
||||||
VEngineServer_Logic engine_wrapper_;
|
|
||||||
VFileSystem_Logic fs_wrapper_;
|
|
||||||
VPlayerInfo_Logic playerinfo_wrapper_;
|
|
||||||
} sCoreProviderImpl;
|
|
||||||
|
|
||||||
ConVar *CoreProviderImpl::FindConVar(const char *name)
|
ConVar *CoreProviderImpl::FindConVar(const char *name)
|
||||||
{
|
{
|
||||||
return icvar->FindVar(name);
|
return icvar->FindVar(name);
|
||||||
|
68
core/provider.h
Normal file
68
core/provider.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// vim: set ts=4 sw=4 tw=99 noet :
|
||||||
|
// =============================================================================
|
||||||
|
// SourceMod
|
||||||
|
// Copyright (C) 2004-2015 AlliedModders LLC. All rights reserved.
|
||||||
|
// =============================================================================
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
// Free Software Foundation.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
// details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along with
|
||||||
|
// this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// As a special exception, AlliedModders LLC gives you permission to link the
|
||||||
|
// code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||||
|
// "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||||
|
// by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
|
// all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
|
// this exception to all derivative works. AlliedModders LLC defines further
|
||||||
|
// exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
|
// or <http://www.sourcemod.net/license.php>.
|
||||||
|
#ifndef _INCLUDE_SOURCEMOD_CORE_PROVIDER_IMPL_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_CORE_PROVIDER_IMPL_H_
|
||||||
|
|
||||||
|
#include "logic/intercom.h"
|
||||||
|
#include <amtl/os/am-shared-library.h>
|
||||||
|
|
||||||
|
class CoreProviderImpl : public CoreProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CoreProviderImpl();
|
||||||
|
|
||||||
|
// Local functions.
|
||||||
|
void InitializeBridge();
|
||||||
|
bool LoadBridge(char *error, size_t maxlength);
|
||||||
|
void ShutdownBridge();
|
||||||
|
|
||||||
|
// Provider implementation.
|
||||||
|
ConVar *FindConVar(const char *name) override;
|
||||||
|
const char *GetCvarString(ConVar *cvar) override;
|
||||||
|
bool GetCvarBool(ConVar* cvar) override;
|
||||||
|
bool GetGameName(char *buffer, size_t maxlength) override;
|
||||||
|
const char *GetGameDescription() override;
|
||||||
|
const char *GetSourceEngineName() override;
|
||||||
|
bool SymbolsAreHidden() override;
|
||||||
|
bool IsMapLoading() override;
|
||||||
|
bool IsMapRunning() override;
|
||||||
|
int MaxClients() override;
|
||||||
|
bool DescribePlayer(int index, const char **namep, const char **authp, int *useridp) override;
|
||||||
|
void LogToGame(const char *message) override;
|
||||||
|
void ConPrint(const char *message) override;
|
||||||
|
void ConsolePrintVa(const char *fmt, va_list ap) override;
|
||||||
|
int LoadMMSPlugin(const char *file, bool *ok, char *error, size_t maxlength) override;
|
||||||
|
void UnloadMMSPlugin(int id) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ke::Ref<ke::SharedLib> logic_;
|
||||||
|
LogicInitFunction logic_init_;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CoreProviderImpl sCoreProviderImpl;
|
||||||
|
|
||||||
|
#endif // _INCLUDE_SOURCEMOD_CORE_PROVIDER_IMPL_H_
|
Loading…
Reference in New Issue
Block a user