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