added SetGlobalTarget() calls to anything that uses Format()

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401017
This commit is contained in:
David Anderson 2007-06-24 19:40:25 +00:00
parent 5271043e92
commit 2f3e46f8f8
7 changed files with 27 additions and 0 deletions

View File

@ -659,6 +659,8 @@ static cell_t sm_ServerCommand(IPluginContext *pContext, const cell_t *params)
char buffer[1024];
size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 1);
g_SourceMod.SetGlobalTarget(LANG_SERVER);
/* One byte for null terminator, one for newline */
buffer[len++] = '\n';
buffer[len] = '\0';
@ -673,6 +675,8 @@ static cell_t sm_InsertServerCommand(IPluginContext *pContext, const cell_t *par
char buffer[1024];
size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 1);
g_SourceMod.SetGlobalTarget(LANG_SERVER);
/* One byte for null terminator, one for newline */
buffer[len++] = '\n';
buffer[len] = '\0';
@ -703,6 +707,8 @@ static cell_t sm_ClientCommand(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Client %d is not connected", params[1]);
}
g_SourceMod.SetGlobalTarget(params[1]);
char buffer[256];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
@ -738,6 +744,8 @@ static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
static cell_t ReplyToCommand(IPluginContext *pContext, const cell_t *params)
{
g_SourceMod.SetGlobalTarget(params[1]);
/* Build the format string */
char buffer[1024];
size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 2);

View File

@ -60,6 +60,8 @@ static cell_t ThrowError(IPluginContext *pContext, const cell_t *params)
{
char buffer[512];
g_SourceMod.SetGlobalTarget(LANG_SERVER);
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
if (pContext->GetContext()->n_err == SP_ERROR_NONE)

View File

@ -119,6 +119,8 @@ static cell_t ThrowNativeError(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Not called from inside a native function");
}
g_SourceMod.SetGlobalTarget(LANG_SERVER);
char buffer[512];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);

View File

@ -481,6 +481,8 @@ static cell_t sm_BuildPath(IPluginContext *pContext, const cell_t *params)
static cell_t sm_LogToGame(IPluginContext *pContext, const cell_t *params)
{
g_SourceMod.SetGlobalTarget(LANG_SERVER);
char buffer[1024];
size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
@ -500,6 +502,8 @@ static cell_t sm_LogToGame(IPluginContext *pContext, const cell_t *params)
static cell_t sm_LogMessage(IPluginContext *pContext, const cell_t *params)
{
g_SourceMod.SetGlobalTarget(LANG_SERVER);
char buffer[1024];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
@ -511,6 +515,8 @@ static cell_t sm_LogMessage(IPluginContext *pContext, const cell_t *params)
static cell_t sm_LogError(IPluginContext *pContext, const cell_t *params)
{
g_SourceMod.SetGlobalTarget(LANG_SERVER);
char buffer[1024];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);

View File

@ -273,6 +273,8 @@ static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Client %d is not in game", client);
}
g_SourceMod.SetGlobalTarget(client);
char buffer[192];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
@ -296,6 +298,8 @@ static cell_t PrintCenterText(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Client %d is not in game", client);
}
g_SourceMod.SetGlobalTarget(client);
char buffer[192];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);

View File

@ -19,6 +19,7 @@
#include "MenuStyle_Radio.h"
#include "HandleSys.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#if defined MENU_DEBUG
#include "Logger.h"
#endif
@ -587,6 +588,8 @@ static cell_t SetMenuTitle(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
}
g_SourceMod.SetGlobalTarget(LANG_SERVER);
char buffer[1024];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);

View File

@ -963,6 +963,8 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(client));
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
g_SourceMod.SetGlobalTarget(client);
char buffer[256];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);