2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-04-16 22:32:30 +03:00

Refactoring around __FUNCTION__, small message changes.

This commit is contained in:
Lev 2017-01-25 01:14:09 +05:00
parent d13eed2256
commit 8f4b9b603c
9 changed files with 29 additions and 26 deletions

View File

@ -721,7 +721,7 @@ void Cmd_AddCommand(char *cmd_name, xcommand_t function)
if (host_initialized)
{
Sys_Error(__FUNCTION__ " after host_initialized");
Sys_Error(__FUNCTION__ ": called after host_initialized");
}
// Check in variables list

View File

@ -1363,13 +1363,13 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
if (!ppdesc)
{
Sys_Error(__FUNCTION__ " with no delta_description_t\n");
Sys_Error(__FUNCTION__ ": called with no delta_description_t\n");
}
*ppdesc = 0;
if (!pstream)
{
Sys_Error(__FUNCTION__ " with no data stream\n");
Sys_Error(__FUNCTION__ ": called with no data stream\n");
}
while (true)

View File

@ -1494,17 +1494,17 @@ void NET_SendPacket(netsrc_t sock, int length, void *data, const netadr_t& to)
// let dedicated servers continue after errors
if (g_pcls.state == ca_dedicated)
{
Con_Printf(__FUNCTION__ " ERROR: %s\n", NET_ErrorString(err));
Con_Printf(__FUNCTION__ ": ERROR: %s\n", NET_ErrorString(err));
}
else
{
if (err == WSAEADDRNOTAVAIL || err == WSAENOBUFS)
{
Con_DPrintf(__FUNCTION__ " Warning: %s : %s\n", NET_ErrorString(err), NET_AdrToString(to));
Con_DPrintf(__FUNCTION__ ": Warning: %s : %s\n", NET_ErrorString(err), NET_AdrToString(to));
}
else
{
Sys_Error(__FUNCTION__ " ERROR: %s\n", NET_ErrorString(err));
Sys_Error(__FUNCTION__ ": ERROR: %s\n", NET_ErrorString(err));
}
}
}

View File

@ -1049,7 +1049,7 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
return i;
}
Host_Error(__FUNCTION__ ": Sound '%s' failed to precache because the item count is over the %d limit.\n"
Host_Error(__FUNCTION__ ": Sound '%s' failed to precache because the item count is over the %d limit.\n"
"Reduce the number of brush models and/or regular models in the map to correct this.",
s, MAX_SOUNDS);
}
@ -2238,56 +2238,56 @@ void EXT_FUNC PF_MessageEnd_I(void)
void EXT_FUNC PF_WriteByte_I(int iValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteByte(&gMsgBuffer, iValue);
}
void EXT_FUNC PF_WriteChar_I(int iValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteChar(&gMsgBuffer, iValue);
}
void EXT_FUNC PF_WriteShort_I(int iValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteShort(&gMsgBuffer, iValue);
}
void EXT_FUNC PF_WriteLong_I(int iValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteLong(&gMsgBuffer, iValue);
}
void EXT_FUNC PF_WriteAngle_I(float flValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteAngle(&gMsgBuffer, flValue);
}
void EXT_FUNC PF_WriteCoord_I(float flValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteShort(&gMsgBuffer, (int)(flValue * 8.0));
}
void EXT_FUNC PF_WriteString_I(const char *sz)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteString(&gMsgBuffer, sz);
}
void EXT_FUNC PF_WriteEntity_I(int iValue)
{
if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n");
Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteShort(&gMsgBuffer, iValue);
}

View File

@ -423,7 +423,7 @@ void SV_ReallocateDynamicData(void)
{
if (!g_psv.max_edicts)
{
Con_DPrintf(__FUNCTION__ " with sv.max_edicts == 0\n");
Con_DPrintf(__FUNCTION__ ": sv.max_edicts == 0\n");
return;
}

View File

@ -308,7 +308,7 @@ const char *Sys_FindFirst(const char *path, char *basename)
{
if (g_hfind != -1)
{
Sys_Error(__FUNCTION__ " without close");
Sys_Error(__FUNCTION__ ": called without close");
}
const char *psz = FS_FindFirst(path, &g_hfind, 0);
@ -333,7 +333,10 @@ const char *Sys_FindFirstPathID(const char *path, char *pathid)
{
//const char *psz;//unused?
if (g_hfind != -1)
Sys_Error("Sys_FindFirst without close");
{
Sys_Error(__FUNCTION__ ": called without close");
}
return FS_FindFirst(path, &g_hfind, pathid);
}

View File

@ -42,9 +42,9 @@
#define __LINE__AS_STRING __HACK_LINE_AS_STRING__(__LINE__) //Gives you the line number in constant string form
#if defined _MSC_VER || defined __INTEL_COMPILER
#define NOXREFCHECK __asm { push [ebp + 4] } Sys_Error("[NOXREFCHECK]:" __FUNCTION__ " (" __FILE__ ":" __LINE__AS_STRING") NOXREF, but called from 0x%.08x")
#define NOXREFCHECK __asm { push [ebp + 4] } Sys_Error("[NOXREFCHECK]: " __FUNCTION__ " (" __FILE__ ":" __LINE__AS_STRING") NOXREF, but called from 0x%.08x")
#else
#define NOXREFCHECK const char* noxref_msg = "[NOXREFCHECK]:" __FUNCTION__ " (" __FILE__ ":" __LINE__AS_STRING") NOXREF, but called from 0x%.08x"; \
#define NOXREFCHECK const char* noxref_msg = "[NOXREFCHECK]: " __FUNCTION__ " (" __FILE__ ":" __LINE__AS_STRING") NOXREF, but called from 0x%.08x"; \
asm volatile ( \
"pushl 4(%%ebp)\n\t" \
"pushl %0\n\t" \

View File

@ -40,11 +40,11 @@ bool AbstractHookChainRegistry::findHook(void* hookFunc) const
void AbstractHookChainRegistry::addHook(void* hookFunc, int priority)
{
if (!hookFunc) {
Sys_Error(__FUNCTION__ " Parameter hookFunc can't be a nullptr");
Sys_Error(__FUNCTION__ ": Parameter hookFunc can't be a nullptr");
}
if (findHook(hookFunc)) {
Sys_Error(__FUNCTION__ " The same handler can't be used twice on the hookchain.");
Sys_Error(__FUNCTION__ ": The same handler can't be used twice on the hookchain.");
}
for (auto i = 0; i < MAX_HOOKS_IN_CHAIN; i++)
@ -63,7 +63,7 @@ void AbstractHookChainRegistry::addHook(void* hookFunc, int priority)
}
if (m_NumHooks >= MAX_HOOKS_IN_CHAIN) {
Sys_Error(__FUNCTION__ " MAX_HOOKS_IN_CHAIN limit hit");
Sys_Error(__FUNCTION__ ": MAX_HOOKS_IN_CHAIN limit hit");
}
m_NumHooks++;

View File

@ -160,7 +160,7 @@ bool EXT_FUNC CRehldsServerStatic::IsLogActive()
IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id)
{
if (id < 0 || id >= g_psvs.maxclients)
Sys_Error(__FUNCTION__": invalid id provided: %d", id);
Sys_Error(__FUNCTION__ ": invalid id provided: %d", id);
return g_GameClients[id];
}
@ -168,7 +168,7 @@ IGameClient* EXT_FUNC CRehldsServerStatic::GetClient(int id)
client_t* EXT_FUNC CRehldsServerStatic::GetClient_t(int id)
{
if (id < 0 || id >= g_psvs.maxclients)
Sys_Error(__FUNCTION__": invalid id provided: %d", id);
Sys_Error(__FUNCTION__ ": invalid id provided: %d", id);
return &g_psvs.clients[id];
}
@ -285,7 +285,7 @@ IGameClient* GetRehldsApiClient(client_t* cl)
int idx = cl - g_psvs.clients;
if (idx < 0 || idx >= g_psvs.maxclients)
{
Sys_Error(__FUNCTION__": Invalid client index %d", idx);
Sys_Error(__FUNCTION__ ": Invalid client index %d", idx);
}
return g_GameClients[idx];