2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-04-23 23:03:32 +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) if (host_initialized)
{ {
Sys_Error(__FUNCTION__ " after host_initialized"); Sys_Error(__FUNCTION__ ": called after host_initialized");
} }
// Check in variables list // Check in variables list

View File

@ -1363,13 +1363,13 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
if (!ppdesc) if (!ppdesc)
{ {
Sys_Error(__FUNCTION__ " with no delta_description_t\n"); Sys_Error(__FUNCTION__ ": called with no delta_description_t\n");
} }
*ppdesc = 0; *ppdesc = 0;
if (!pstream) if (!pstream)
{ {
Sys_Error(__FUNCTION__ " with no data stream\n"); Sys_Error(__FUNCTION__ ": called with no data stream\n");
} }
while (true) 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 // let dedicated servers continue after errors
if (g_pcls.state == ca_dedicated) 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 else
{ {
if (err == WSAEADDRNOTAVAIL || err == WSAENOBUFS) 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 else
{ {
Sys_Error(__FUNCTION__ " ERROR: %s\n", NET_ErrorString(err)); Sys_Error(__FUNCTION__ ": ERROR: %s\n", NET_ErrorString(err));
} }
} }
} }

View File

@ -2238,56 +2238,56 @@ void EXT_FUNC PF_MessageEnd_I(void)
void EXT_FUNC PF_WriteByte_I(int iValue) void EXT_FUNC PF_WriteByte_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteByte(&gMsgBuffer, iValue); MSG_WriteByte(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteChar_I(int iValue) void EXT_FUNC PF_WriteChar_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteChar(&gMsgBuffer, iValue); MSG_WriteChar(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteShort_I(int iValue) void EXT_FUNC PF_WriteShort_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteShort(&gMsgBuffer, iValue); MSG_WriteShort(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteLong_I(int iValue) void EXT_FUNC PF_WriteLong_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteLong(&gMsgBuffer, iValue); MSG_WriteLong(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteAngle_I(float flValue) void EXT_FUNC PF_WriteAngle_I(float flValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteAngle(&gMsgBuffer, flValue); MSG_WriteAngle(&gMsgBuffer, flValue);
} }
void EXT_FUNC PF_WriteCoord_I(float flValue) void EXT_FUNC PF_WriteCoord_I(float flValue)
{ {
if (!gMsgStarted) 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)); MSG_WriteShort(&gMsgBuffer, (int)(flValue * 8.0));
} }
void EXT_FUNC PF_WriteString_I(const char *sz) void EXT_FUNC PF_WriteString_I(const char *sz)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteString(&gMsgBuffer, sz); MSG_WriteString(&gMsgBuffer, sz);
} }
void EXT_FUNC PF_WriteEntity_I(int iValue) void EXT_FUNC PF_WriteEntity_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error(__FUNCTION__ " called with no active message\n"); Sys_Error(__FUNCTION__ ": called with no active message\n");
MSG_WriteShort(&gMsgBuffer, iValue); MSG_WriteShort(&gMsgBuffer, iValue);
} }

View File

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

View File

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

View File

@ -40,11 +40,11 @@ bool AbstractHookChainRegistry::findHook(void* hookFunc) const
void AbstractHookChainRegistry::addHook(void* hookFunc, int priority) void AbstractHookChainRegistry::addHook(void* hookFunc, int priority)
{ {
if (!hookFunc) { 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)) { 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++) 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) { 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++; m_NumHooks++;