This commit is contained in:
Nicholas Hastings 2011-03-13 14:05:11 -04:00
commit 0750b93797
5 changed files with 30 additions and 44 deletions

View File

@ -1766,6 +1766,11 @@ unsigned int CPlayer::GetLanguageId()
return m_LangId; return m_LangId;
} }
void CPlayer::SetLanguageId(unsigned int id)
{
m_LangId = id;
}
int CPlayer::GetUserId() int CPlayer::GetUserId()
{ {
if (m_UserId == -1) if (m_UserId == -1)

View File

@ -82,6 +82,7 @@ public:
bool IsInKickQueue(); bool IsInKickQueue();
IPlayerInfo *GetPlayerInfo(); IPlayerInfo *GetPlayerInfo();
unsigned int GetLanguageId(); unsigned int GetLanguageId();
void SetLanguageId(unsigned int id);
int GetUserId(); int GetUserId();
bool RunAdminCacheChecks(); bool RunAdminCacheChecks();
void NotifyPostAdminChecks(); void NotifyPostAdminChecks();

View File

@ -113,7 +113,7 @@ static cell_t sm_SetClientLanguage(IPluginContext *pContext, const cell_t *param
return pContext->ThrowNativeError("Invalid client index %d", params[1]); return pContext->ThrowNativeError("Invalid client index %d", params[1]);
} }
player->m_LangId = params[2]; player->SetLanguageId(params[2]);
return 1; return 1;
} }

View File

@ -53,7 +53,6 @@ enum ListenOverride
size_t g_VoiceFlags[65]; size_t g_VoiceFlags[65];
size_t g_VoiceHookCount = 0; size_t g_VoiceHookCount = 0;
int g_ClientOverrides[65];
ListenOverride g_VoiceMap[65][65]; ListenOverride g_VoiceMap[65][65];
bool g_ClientMutes[65][65]; bool g_ClientMutes[65][65];
@ -65,10 +64,10 @@ SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *,
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *); SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
#endif #endif
bool DecHookCount(int amount = 1); bool DecHookCount()
bool DecHookCount(int amount)
{ {
g_VoiceHookCount -= amount; g_VoiceHookCount--;
if (g_VoiceHookCount == 0) if (g_VoiceHookCount == 0)
{ {
SH_REMOVE_HOOK_MEMFUNC(IVoiceServer, SetClientListening, voiceserver, &g_SdkTools, &SDKTools::OnSetClientListening, false); SH_REMOVE_HOOK_MEMFUNC(IVoiceServer, SetClientListening, voiceserver, &g_SdkTools, &SDKTools::OnSetClientListening, false);
@ -89,7 +88,6 @@ void IncHookCount()
void SDKTools::VoiceInit() void SDKTools::VoiceInit()
{ {
memset(g_VoiceMap, 0, sizeof(g_VoiceMap)); memset(g_VoiceMap, 0, sizeof(g_VoiceMap));
memset(g_ClientOverrides, 0, sizeof(g_ClientOverrides));
memset(g_ClientMutes, 0, sizeof(g_ClientMutes)); memset(g_ClientMutes, 0, sizeof(g_ClientMutes));
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &SDKTools::OnClientCommand, true); SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &SDKTools::OnClientCommand, true);
@ -130,6 +128,11 @@ bool SDKTools::OnSetClientListening(int iReceiver, int iSender, bool bListen)
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false)); RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false));
} }
if (g_VoiceFlags[iSender] & SPEAK_MUTED)
{
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false));
}
if (g_VoiceMap[iReceiver][iSender] == Listen_No) if (g_VoiceMap[iReceiver][iSender] == Listen_No)
{ {
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false)); RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false));
@ -139,11 +142,6 @@ bool SDKTools::OnSetClientListening(int iReceiver, int iSender, bool bListen)
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true)); RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true));
} }
if (g_VoiceFlags[iSender] & SPEAK_MUTED)
{
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false));
}
if ((g_VoiceFlags[iSender] & SPEAK_ALL) || (g_VoiceFlags[iReceiver] & SPEAK_LISTENALL)) if ((g_VoiceFlags[iSender] & SPEAK_ALL) || (g_VoiceFlags[iReceiver] & SPEAK_LISTENALL))
{ {
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true)); RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true));
@ -193,6 +191,7 @@ void SDKTools::OnClientDisconnecting(int client)
} }
g_ClientMutes[i][client] = false; g_ClientMutes[i][client] = false;
g_ClientMutes[client][i] = false;
if (g_VoiceMap[i][client] != Listen_Default) if (g_VoiceMap[i][client] != Listen_Default)
{ {
@ -202,22 +201,19 @@ void SDKTools::OnClientDisconnecting(int client)
break; break;
} }
} }
} if (g_VoiceMap[client][i] != Listen_Default)
{
/* Reset this client's mutes */ g_VoiceMap[client][i] = Listen_Default;
memset(&g_ClientMutes[client], 0, sizeof(bool) * 65); if (DecHookCount())
{
/* Reset other clients who send to this client */ break;
if (g_ClientOverrides[client] > 0) }
{ }
DecHookCount(g_ClientOverrides[client]);
g_ClientOverrides[client] = 0;
memset(&g_VoiceMap[client], false, sizeof(ListenOverride) * 65);
} }
if (g_VoiceFlags[client]) if (g_VoiceFlags[client])
{ {
g_VoiceFlags[client] = 0; g_VoiceFlags[client] = SPEAK_NORMAL;
DecHookCount(); DecHookCount();
} }
} }
@ -294,13 +290,11 @@ static cell_t SetClientListening(IPluginContext *pContext, const cell_t *params)
if (g_VoiceMap[r][s] == Listen_Default && params[3] != Listen_Default) if (g_VoiceMap[r][s] == Listen_Default && params[3] != Listen_Default)
{ {
g_VoiceMap[r][s] = (ListenOverride) params[3]; g_VoiceMap[r][s] = (ListenOverride) params[3];
g_ClientOverrides[r]++;
IncHookCount(); IncHookCount();
} }
else if (g_VoiceMap[r][s] != Listen_Default && params[3] == Listen_Default) else if (g_VoiceMap[r][s] != Listen_Default && params[3] == Listen_Default)
{ {
g_VoiceMap[r][s] = (ListenOverride) params[3]; g_VoiceMap[r][s] = (ListenOverride) params[3];
g_ClientOverrides[r]--;
DecHookCount(); DecHookCount();
} }
else else

View File

@ -10,13 +10,8 @@ require 'helpers.pm';
chdir('..'); chdir('..');
chdir('..'); chdir('..');
our $SSH = 'ssh -i ../../smpvkey';
open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n"; open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n";
#Sync us up with the main symbol store
rsync('sourcemod@alliedmods.net:~/public_html/symbols/', '..\\..\\symstore');
#Get version info #Get version info
my ($version); my ($version);
$version = Build::ProductVersion(Build::PathFormat('product.version')); $version = Build::ProductVersion(Build::PathFormat('product.version'));
@ -41,14 +36,14 @@ while (<PDBLOG>)
$line = $_; $line = $_;
$line =~ s/\.pdb/\*/; $line =~ s/\.pdb/\*/;
chomp $line; chomp $line;
Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s ..\\..\\symstore /t \"SourceMod\" /v \"$version\" /c \"$build_type\""); Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s \"S:\\sourcemod\" /t \"SourceMod\" /v \"$version\" /c \"$build_type\"");
} }
close(PDBLOG); close(PDBLOG);
#Lowercase DLLs. Sigh. #Lowercase DLLs. Sigh.
my (@files); my (@files);
opendir(DIR, "..\\..\\symstore"); opendir(DIR, "S:\\sourcemod");
@files = readdir(DIR); @files = readdir(DIR);
closedir(DIR); closedir(DIR);
@ -57,23 +52,14 @@ for ($i = 0; $i <= $#files; $i++)
{ {
$file = $files[$i]; $file = $files[$i];
next unless ($file =~ /\.dll$/); next unless ($file =~ /\.dll$/);
next unless (-d "..\\..\\symstore\\$file"); next unless (-d "S:\\sourcemod\\$file");
opendir(DIR, "..\\..\\symstore\\$file"); opendir(DIR, "S:\\sourcemod\\$file");
@subdirs = readdir(DIR); @subdirs = readdir(DIR);
closedir(DIR); closedir(DIR);
for ($j = 0; $j <= $#subdirs; $j++) for ($j = 0; $j <= $#subdirs; $j++)
{ {
next unless ($subdirs[$j] =~ /[A-Z]/); next unless ($subdirs[$j] =~ /[A-Z]/);
Build::Command("rename ..\\..\\symstore\\$file\\" . $subdirs[$j] . " " . lc($subdirs[$j])); Build::Command("rename S:\\sourcemod\\$file\\" . $subdirs[$j] . " " . lc($subdirs[$j]));
} }
} }
#Now that we're done, rsync back.
rsync('../../symstore/', 'sourcemod@alliedmods.net:~/public_html/symbols');
sub rsync
{
my ($from, $to) = (@_);
Build::Command('rsync -av --delete -e="' . $SSH . '" ' . $from . ' ' . $to);
}