2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2024-12-28 15:45:37 +03:00
metamod-r/metamod/src/sdk_util.cpp

64 lines
1.6 KiB
C++
Raw Normal View History

// vi: set ts=4 sw=4 :
// vim: set tw=75 :
// sdk_util.cpp - utility routines from HL SDK util.cpp
// Selected portions of dlls/util.cpp from SDK 2.1.
// Functions copied from there as needed...
// And modified to avoid buffer overflows (argh).
// Also modified to remove dependency on CBaseEntity class.
/***
*
* Copyright (c) 1999, 2000 Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/*
===== util.cpp ========================================================
Utility code. Really not optional after all.
*/
2016-07-26 03:22:47 +03:00
#include "precompiled.h"
char* UTIL_VarArgs(char *format, ...)
2016-07-26 03:22:47 +03:00
{
va_list argptr;
static char string[1024];
2016-07-26 03:22:47 +03:00
va_start(argptr, format);
vsnprintf(string, sizeof(string), format, argptr);
2016-07-26 03:22:47 +03:00
va_end(argptr);
return string;
}
//=========================================================
// UTIL_LogPrintf - Prints a logged message to console.
// Preceded by LOG: ( timestamp ) < message >
//=========================================================
void UTIL_LogPrintf(char *fmt, ...)
2016-07-26 03:22:47 +03:00
{
va_list argptr;
static char string[1024];
2016-07-26 03:22:47 +03:00
va_start(argptr, fmt);
vsnprintf(string, sizeof(string), fmt, argptr);
va_end(argptr);
2016-07-26 03:22:47 +03:00
// Print to server console
ALERT(at_logged, "%s", string);
2016-07-26 03:22:47 +03:00
}