Rename QueryHookMode to ClientCvarQueryMode.
This commit is contained in:
parent
fa93426f6a
commit
b63bfdc72a
@ -43,7 +43,7 @@ SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB
|
||||
#endif
|
||||
|
||||
GameHooks::GameHooks()
|
||||
: query_hook_mode_(QueryHookMode::Unavailable)
|
||||
: client_cvar_query_mode_(ClientCvarQueryMode::Unavailable)
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,14 +60,14 @@ void GameHooks::Start()
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
if (g_SMAPI->GetGameDLLVersion() >= 6) {
|
||||
hooks_ += SH_ADD_HOOK(IServerGameDLL, OnQueryCvarValueFinished, gamedll, SH_MEMBER(this, &GameHooks::OnQueryCvarValueFinished), false);
|
||||
query_hook_mode_ = QueryHookMode::DLL;
|
||||
client_cvar_query_mode_ = ClientCvarQueryMode::DLL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GameHooks::OnVSPReceived()
|
||||
{
|
||||
if (query_hook_mode_ != QueryHookMode::Unavailable)
|
||||
if (client_cvar_query_mode_ != ClientCvarQueryMode::Unavailable)
|
||||
return;
|
||||
|
||||
// For later MM:S versions, use the updated API, since it's cleaner.
|
||||
@ -81,7 +81,7 @@ void GameHooks::OnVSPReceived()
|
||||
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA
|
||||
hooks_ += SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &GameHooks::OnQueryCvarValueFinished), false);
|
||||
query_hook_mode_ = QueryHookMode::VSP;
|
||||
client_cvar_query_mode_ = ClientCvarQueryMode::VSP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ void GameHooks::Shutdown()
|
||||
SH_REMOVE_HOOK_ID(hooks_[i]);
|
||||
hooks_.clear();
|
||||
|
||||
query_hook_mode_ = QueryHookMode::Unavailable;
|
||||
client_cvar_query_mode_ = ClientCvarQueryMode::Unavailable;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
|
@ -38,7 +38,7 @@ class ConVar;
|
||||
|
||||
namespace SourceMod {
|
||||
|
||||
enum class QueryHookMode {
|
||||
enum class ClientCvarQueryMode {
|
||||
Unavailable,
|
||||
DLL,
|
||||
VSP
|
||||
@ -53,8 +53,8 @@ public:
|
||||
void Shutdown();
|
||||
void OnVSPReceived();
|
||||
|
||||
QueryHookMode GetQueryHookMode() const {
|
||||
return query_hook_mode_;
|
||||
ClientCvarQueryMode GetClientCvarQueryMode() const {
|
||||
return client_cvar_query_mode_;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -85,7 +85,7 @@ private:
|
||||
};
|
||||
HookList hooks_;
|
||||
|
||||
QueryHookMode query_hook_mode_;
|
||||
ClientCvarQueryMode client_cvar_query_mode_;
|
||||
};
|
||||
|
||||
} // namespace SourceMod
|
||||
|
@ -639,20 +639,20 @@ void CoreProviderImpl::UnloadMMSPlugin(int id)
|
||||
|
||||
bool CoreProviderImpl::IsClientConVarQueryingSupported()
|
||||
{
|
||||
return hooks_.GetQueryHookMode() != QueryHookMode::Unavailable;
|
||||
return hooks_.GetClientCvarQueryMode() != ClientCvarQueryMode::Unavailable;
|
||||
}
|
||||
|
||||
int CoreProviderImpl::QueryClientConVar(int client, const char *cvar)
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
switch (hooks_.GetQueryHookMode()) {
|
||||
case QueryHookMode::DLL:
|
||||
switch (hooks_.GetClientCvarQueryMode()) {
|
||||
case ClientCvarQueryMode::DLL:
|
||||
# if SOURCE_ENGINE == SE_DOTA
|
||||
return ::engine->StartQueryCvarValue(CEntityIndex(client), cvar);
|
||||
# else
|
||||
return ::engine->StartQueryCvarValue(PEntityOfEntIndex(client), cvar);
|
||||
# endif
|
||||
case QueryHookMode::VSP:
|
||||
case ClientCvarQueryMode::VSP:
|
||||
# if SOURCE_ENGINE != SE_DOTA
|
||||
return serverpluginhelpers->StartQueryCvarValue(PEntityOfEntIndex(client), cvar);
|
||||
# endif
|
||||
|
Loading…
Reference in New Issue
Block a user