Move RootConsoleMenu::ConsolePrint into the logic bridge.
This commit is contained in:
parent
2c886943a0
commit
23d55dd9d5
@ -67,23 +67,10 @@ void RootConsoleMenu::OnSourceModShutdown()
|
|||||||
|
|
||||||
void RootConsoleMenu::ConsolePrint(const char *fmt, ...)
|
void RootConsoleMenu::ConsolePrint(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buffer[512];
|
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
size_t len = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
UTIL_ConsolePrintVa(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (len >= sizeof(buffer) - 1)
|
|
||||||
{
|
|
||||||
buffer[510] = '\n';
|
|
||||||
buffer[511] = '\0';
|
|
||||||
} else {
|
|
||||||
buffer[len++] = '\n';
|
|
||||||
buffer[len] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
META_CONPRINT(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RootConsoleMenu::AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler)
|
bool RootConsoleMenu::AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler)
|
||||||
|
@ -52,7 +52,7 @@ using namespace SourceHook;
|
|||||||
* Add 1 to the RHS of this expression to bump the intercom file
|
* Add 1 to the RHS of this expression to bump the intercom file
|
||||||
* This is to prevent mismatching core/logic binaries
|
* This is to prevent mismatching core/logic binaries
|
||||||
*/
|
*/
|
||||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 36)
|
#define SM_LOGIC_MAGIC (0x0F47C0DE - 37)
|
||||||
|
|
||||||
#if defined SM_LOGIC
|
#if defined SM_LOGIC
|
||||||
class IVEngineServer
|
class IVEngineServer
|
||||||
@ -318,6 +318,7 @@ struct sm_core_t
|
|||||||
bool (*DescribePlayer)(int index, const char **namep, const char **authp, int *useridp);
|
bool (*DescribePlayer)(int index, const char **namep, const char **authp, int *useridp);
|
||||||
int (*MaxClients)();
|
int (*MaxClients)();
|
||||||
int (*GetGlobalTarget)();
|
int (*GetGlobalTarget)();
|
||||||
|
void (*ConsolePrintVa)(const char *fmt, va_list ap);
|
||||||
const char *gamesuffix;
|
const char *gamesuffix;
|
||||||
/* Data */
|
/* Data */
|
||||||
ServerGlobals *serverGlobals;
|
ServerGlobals *serverGlobals;
|
||||||
|
@ -544,6 +544,30 @@ static int get_global_target()
|
|||||||
return g_SourceMod.GetGlobalTarget();
|
return g_SourceMod.GetGlobalTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UTIL_ConsolePrintVa(const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
size_t len = ke::SafeVsprintf(buffer, sizeof(buffer), fmt, ap);
|
||||||
|
|
||||||
|
if (len >= sizeof(buffer) - 1)
|
||||||
|
{
|
||||||
|
buffer[510] = '\n';
|
||||||
|
buffer[511] = '\0';
|
||||||
|
} else {
|
||||||
|
buffer[len++] = '\n';
|
||||||
|
buffer[len] = '\0';
|
||||||
|
}
|
||||||
|
META_CONPRINT(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UTIL_ConsolePrint(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
UTIL_ConsolePrintVa(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
#define GAMEFIX "2.l4d"
|
#define GAMEFIX "2.l4d"
|
||||||
@ -636,6 +660,7 @@ static sm_core_t core_bridge =
|
|||||||
describe_player,
|
describe_player,
|
||||||
get_max_clients,
|
get_max_clients,
|
||||||
get_global_target,
|
get_global_target,
|
||||||
|
UTIL_ConsolePrintVa,
|
||||||
GAMEFIX,
|
GAMEFIX,
|
||||||
&serverGlobals,
|
&serverGlobals,
|
||||||
};
|
};
|
||||||
|
@ -151,6 +151,9 @@ private:
|
|||||||
CVector<GAME_FRAME_HOOK> m_frame_hooks;
|
CVector<GAME_FRAME_HOOK> m_frame_hooks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void UTIL_ConsolePrintVa(const char *fmt, va_list ap);
|
||||||
|
void UTIL_ConsolePrint(const char *fmt, ...);
|
||||||
|
|
||||||
extern bool g_Loaded;
|
extern bool g_Loaded;
|
||||||
extern bool sm_show_debug_spew;
|
extern bool sm_show_debug_spew;
|
||||||
extern SourceModBase g_SourceMod;
|
extern SourceModBase g_SourceMod;
|
||||||
|
Loading…
Reference in New Issue
Block a user