From dec8f3d094a914590e4018e5691f41eb762e75c6 Mon Sep 17 00:00:00 2001 From: Lev Date: Wed, 8 Feb 2017 03:47:59 +0500 Subject: [PATCH] Use __FUNCTION__ in calls to Sys_Error and Host_Error. --- rehlds/engine/crc.cpp | 2 +- rehlds/engine/decals.cpp | 47 ++++++++++++------------- rehlds/engine/hashpak.cpp | 8 ++--- rehlds/engine/host.cpp | 4 +-- rehlds/engine/host_cmd.cpp | 8 ++--- rehlds/engine/mathlib.cpp | 2 +- rehlds/engine/model.cpp | 63 +++++++++++++++++----------------- rehlds/engine/net_ws.cpp | 19 ++++++----- rehlds/engine/pmovetst.cpp | 2 +- rehlds/engine/pr_cmds.cpp | 66 ++++++++++++++++-------------------- rehlds/engine/pr_edict.cpp | 2 +- rehlds/engine/sv_main.cpp | 28 +++++++-------- rehlds/engine/sv_phys.cpp | 6 ++-- rehlds/engine/sv_upld.cpp | 4 +-- rehlds/engine/sv_user.cpp | 2 +- rehlds/engine/sys_dll.cpp | 10 +++--- rehlds/engine/sys_dll2.cpp | 6 ++-- rehlds/engine/sys_engine.cpp | 2 +- rehlds/engine/textures.cpp | 8 ++--- rehlds/engine/tmessage.cpp | 2 +- rehlds/engine/wad.cpp | 10 +++--- rehlds/engine/world.cpp | 6 ++-- 22 files changed, 151 insertions(+), 156 deletions(-) diff --git a/rehlds/engine/crc.cpp b/rehlds/engine/crc.cpp index e1e6119..a68b1f3 100644 --- a/rehlds/engine/crc.cpp +++ b/rehlds/engine/crc.cpp @@ -133,7 +133,7 @@ byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence) CRC32_t crc; if (sequence < 0) - Sys_Error("sequence < 0, in COM_BlockSequenceCRCByte\n"); + Sys_Error("%s: sequence < 0\n", __FUNCTION__); p = (byte *)pulCRCTable + sequence % 0x3FC; if (length > 60) length = 60; diff --git a/rehlds/engine/decals.cpp b/rehlds/engine/decals.cpp index 7bcb13b..ac50243 100644 --- a/rehlds/engine/decals.cpp +++ b/rehlds/engine/decals.cpp @@ -78,7 +78,7 @@ void Draw_CacheWadInitFromFile(FileHandle_t hFile, int len, char *name, int cach #ifdef REHLDS_FIXES FS_Close(hFile); #endif - Sys_Error("Wad file %s doesn't have WAD3 id\n", name); + Sys_Error("%s: Wad file %s doesn't have WAD3 id\n", __FUNCTION__, name); } wad->lumps = (lumpinfo_s *)Mem_Malloc(len - header.infotableofs); @@ -103,7 +103,7 @@ void Draw_CacheWadInit(char *name, int cacheMax, cachewad_t *wad) int len; FileHandle_t hFile = FS_Open(name, "rb"); if (!hFile) - Sys_Error("Draw_LoadWad: Couldn't open %s\n", name); + Sys_Error("%s: Couldn't open %s\n", __FUNCTION__, name); len = FS_Size(hFile); Draw_CacheWadInitFromFile(hFile, len, name, cacheMax, wad); FS_Close(hFile); @@ -180,7 +180,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data) byte *pal; if (wad->cacheExtra != DECAL_EXTRASIZE) - Sys_Error("Draw_MiptexTexture: Bad cached wad %s\n", wad->name); + Sys_Error("%s: Bad cached wad %s\n", __FUNCTION__, wad->name); tex = (texture_t *)data; mip = (miptex_t *)(data + wad->cacheExtra); @@ -198,7 +198,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data) tex->offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]); pix = tex->width * tex->height; - palette = (pix>>2) + (pix>>4) + (pix>>6) + pix; + palette = (pix >> 2) + (pix >> 4) + (pix >> 6) + pix; paloffset = tex->offsets[0] + palette + 2; nSize = *(u_short *)&data[wad->cacheExtra + 40 + palette]; pal = (byte *)tex + paloffset; @@ -228,6 +228,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data) if (gfCustomBuild) GL_UnloadTexture(tex); paloffset = GL_LoadTexture2(data, GLT_DECAL, tex->width, tex->height, v8, TRUE, 3, pal, gl_filter_max); + } else { tex->name[0] = '{'; @@ -273,14 +274,14 @@ void Draw_FreeWad(cachewad_t *pWad) } if (pWad->cache) { - #ifndef SWDS +#ifndef SWDS if (pWad->tempWad) { Mem_Free(pWad->cache); pWad->cache = NULL; return; } - #endif // SWDS +#endif // SWDS for (i = 0, pic = pWad->cache; i < pWad->cacheCount; i++, pic++) { if (Cache_Check(&pic->cache)) @@ -310,7 +311,7 @@ NOXREF int Draw_DecalIndex(int id) char tmp[32]; char *pName; if (!decal_names[id][0]) - Sys_Error("Used decal #%d without a name\n", id); + Sys_Error("%s: Used decal #%d without a name\n", __FUNCTION__, id); pName = decal_names[id]; if (!Host_IsServerActive() && violence_hblood.value == 0.0f && !Q_strncmp(pName, "{blood", 6)) @@ -359,7 +360,7 @@ NOXREF texture_t *Draw_DecalTexture(int index) { pCust = g_pcl.players[~index].customdata.pNext; if (!pCust || !pCust->bInUse || !pCust->pInfo || !pCust->pBuffer) - Sys_Error("Failed to load custom decal for player #%i:%s using default decal 0.\n",~index,g_pcl.players[~index].name); + Sys_Error("%s: Failed to load custom decal for player #%i:%s using default decal 0.\n", __FUNCTION__, ~index, g_pcl.players[~index].name); retval = (texture_t *)Draw_CustomCacheGet((cachewad_t *)pCust->pInfo, pCust->pBuffer, pCust->resource.nDownloadSize, pCust->nUserData1); if (!retval) @@ -382,7 +383,7 @@ int Draw_CacheByIndex(cachewad_t *wad, int nIndex, int playernum) if (i == wad->cacheCount) { if (i == wad->cacheMax) - Sys_Error("Cache wad (%s) out of %d entries", wad->name, i); + Sys_Error("%s: Cache wad (%s) out of %d entries", __FUNCTION__, wad->name, i); wad->cacheCount++; Q_snprintf(pic->name, sizeof(pic->name), "%s", szTestName); } @@ -459,7 +460,7 @@ void Decal_MergeInDecals(cachewad_t *pwad, const char *pathID) cachewad_t *final; if (!pwad) - Sys_Error("Decal_MergeInDecals called with NULL wad\n"); + Sys_Error("%s: called with NULL wad\n", __FUNCTION__); lumplist = NULL; if (!decal_wad) @@ -545,7 +546,7 @@ void Decal_Init(void) #else if (i == 0 && !hfile) #endif - Sys_Error("Couldn't find '%s' in \"%s\" search path\n", "decals.wad", pszPathID[i]); + Sys_Error("%s: Couldn't find '%s' in \"%s\" search path\n", __FUNCTION__, "decals.wad", pszPathID[i]); #ifdef REHLDS_FIXES found = true; @@ -563,7 +564,7 @@ void Decal_Init(void) sv_decalnamecount = Draw_DecalCount(); if (sv_decalnamecount > MAX_DECALS) - Sys_Error("Too many decals: %d / %d\n", sv_decalnamecount, MAX_DECALS); + Sys_Error("%s: Too many decals: %d / %d\n", __FUNCTION__, sv_decalnamecount, MAX_DECALS); for (i = 0; i < sv_decalnamecount; i++) { @@ -614,7 +615,7 @@ NOXREF void *Draw_CacheGet(cachewad_t *wad, int index) lumpinfo_t *pLump; if (index >= wad->cacheCount) - Sys_Error("Cache wad indexed before load %s: %d", wad->name, index); + Sys_Error("%s: Cache wad indexed before load %s: %d", __FUNCTION__, wad->name, index); pic = wad->cache; dat = Cache_Check(&pic[index].cache); @@ -639,7 +640,7 @@ NOXREF void *Draw_CacheGet(cachewad_t *wad, int index) if (Draw_CacheReload(wad, i, pLump, pic, clean, path)) { if (pic->cache.data == NULL) - Sys_Error("Draw_CacheGet: failed to load %s", path); + Sys_Error("%s: failed to load %s", __FUNCTION__, path); dat = pic->cache.data; } } @@ -654,7 +655,7 @@ void *Draw_CustomCacheGet(cachewad_t *wad, void *raw, int rawsize, int index) char clean[16]; if (wad->cacheCount <= index) - Sys_Error("Cache wad indexed before load %s: %d", wad->name, index); + Sys_Error("%s: Cache wad indexed before load %s: %d", __FUNCTION__, wad->name, index); pic = &wad->cache[index]; pdata = Cache_Check(&pic->cache); @@ -666,7 +667,7 @@ void *Draw_CustomCacheGet(cachewad_t *wad, void *raw, int rawsize, int index) if (Draw_CacheLoadFromCustom(clean, wad, raw, rawsize, pic)) { if (!pic->cache.data) - Sys_Error("Draw_CacheGet: failed to load %s", pic->name); + Sys_Error("%s: failed to load %s", __FUNCTION__, pic->name); pdata = pic->cache.data; } } @@ -696,9 +697,9 @@ NOXREF qboolean Draw_CacheReload(cachewad_t *wad, int i, lumpinfo_t *pLump, cach } else #endif // SWDS - buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean); + buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean); if (!buf) - Sys_Error("Draw_CacheGet: not enough space for %s in %s", path, wad->name); + Sys_Error("%s: not enough space for %s in %s", __FUNCTION__, path, wad->name); buf[pLump->size + wad->cacheExtra] = 0; FS_Seek(hFile, pLump->filepos, FILESYSTEM_SEEK_HEAD); @@ -745,9 +746,9 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_ tex.offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]); pix = tex.width * tex.height; - pixoffset = pix + (pix>>2) + (pix>>4) + (pix>>6); - paloffset = (pix>>2) + tmp.offsets[0] + pix; - palettesize = (pix>>4) + paloffset; + pixoffset = pix + (pix >> 2) + (pix >> 4) + (pix >> 6); + paloffset = (pix >> 2) + tmp.offsets[0] + pix; + palettesize = (pix >> 4) + paloffset; nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t)); if (!tex.width || tex.width > 256 || tex.height > 256 @@ -791,7 +792,7 @@ qboolean Draw_CacheLoadFromCustom(char *clean, cachewad_t *wad, void *raw, int r pLump = &wad->lumps[idx]; buf = (byte *)Cache_Alloc(&pic->cache, wad->cacheExtra + pLump->size + 1, clean); if (!buf) - Sys_Error("Draw_CacheGet: not enough space for %s in %s", clean, wad->name); + Sys_Error("%s: not enough space for %s in %s", __FUNCTION__, clean, wad->name); buf[wad->cacheExtra + pLump->size] = 0; Q_memcpy((char *)buf + wad->cacheExtra, (char *)raw + pLump->filepos, pLump->size); @@ -824,7 +825,7 @@ NOXREF int Draw_CacheIndex(cachewad_t *wad, char *path) if (i == wad->cacheCount) { if (wad->cacheMax == wad->cacheCount) - Sys_Error("Cache wad (%s) out of %d entries"); + Sys_Error("%s: Cache wad (%s) out of %d entries", __FUNCTION__); wad->cacheCount++; Q_strncpy(wad->name, path, 63); diff --git a/rehlds/engine/hashpak.cpp b/rehlds/engine/hashpak.cpp index f911144..85acc8e 100644 --- a/rehlds/engine/hashpak.cpp +++ b/rehlds/engine/hashpak.cpp @@ -72,7 +72,7 @@ qboolean HPAK_GetDataPointer(char *pakname, struct resource_s *pResource, unsign { pbuf = (byte *)Mem_Malloc(p->datasize); if (!pbuf) - Sys_Error("Error allocating %i bytes for hpak!", p->datasize); + Sys_Error("%s: Error allocating %i bytes for hpak!", __FUNCTION__, p->datasize); Q_memcpy((void *)pbuf, p->data, p->datasize); *pbuffer = pbuf; } @@ -173,7 +173,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F { hash_pack_queue_t *n = (hash_pack_queue_t *)Mem_Malloc(sizeof(hash_pack_queue_t)); if (!n) - Sys_Error("Unable to allocate %i bytes for hpak queue!", sizeof(hash_pack_queue_t)); + Sys_Error("%s: Unable to allocate %i bytes for hpak queue!", __FUNCTION__, sizeof(hash_pack_queue_t)); Q_memset(n, 0, sizeof(hash_pack_queue_t)); n->pakname = Mem_Strdup(pakname); @@ -181,7 +181,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F n->datasize = pResource->nDownloadSize; n->data = Mem_Malloc(pResource->nDownloadSize); if (!n->data) - Sys_Error("Unable to allocate %i bytes for hpak queue!", n->datasize); + Sys_Error("%s: Unable to allocate %i bytes for hpak queue!", __FUNCTION__, n->datasize); if (pData) { @@ -192,7 +192,7 @@ void HPAK_AddToQueue(char *pakname, struct resource_s *pResource, void *pData, F else { if (!fpSource) - Sys_Error("Add to Queue called without data or file pointer!"); + Sys_Error("%s: Add to Queue called without data or file pointer!", __FUNCTION__); FS_Read(n->data, n->datasize, 1, fpSource); n->next = gp_hpak_queue; gp_hpak_queue = n; diff --git a/rehlds/engine/host.cpp b/rehlds/engine/host.cpp index 23b50c0..497a448 100644 --- a/rehlds/engine/host.cpp +++ b/rehlds/engine/host.cpp @@ -1161,11 +1161,11 @@ int Host_Init(quakeparms_t *parms) Q_memset(&g_module, 0, sizeof(g_module)); if (g_pcls.state != ca_dedicated) { - //Sys_Error("Only dedicated server mode is supported"); + //Sys_Error("%s: Only dedicated server mode is supported", __FUNCTION__); color24 *disk_basepal = (color24 *)COM_LoadHunkFile("gfx/palette.lmp"); if (!disk_basepal) - Sys_Error("Host_Init: Couldn't load gfx/palette.lmp"); + Sys_Error("%s: Couldn't load gfx/palette.lmp", __FUNCTION__); host_basepal = (unsigned short *)Hunk_AllocName(sizeof(PackedColorVec) * 256, "palette.lmp"); for (int i = 0; i < 256; i++) diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index c12a837..48b3b56 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -1715,7 +1715,7 @@ void EntityInit(edict_t *pEdict, int className) { ENTITYINIT pEntityInit; if (!className) - Sys_Error("Bad class!!\n"); + Sys_Error("%s: Bad class!!\n", __FUNCTION__); ReleaseEntityDLLFields(pEdict); InitEntityDLLFields(pEdict); @@ -1935,7 +1935,7 @@ int LoadGamestate(char *level, int createPlayers) else { if (!(pEntInfo->flags & FENTTABLE_PLAYER)) - Sys_Error("ENTITY IS NOT A PLAYER: %d\n", i); + Sys_Error("%s: ENTITY IS NOT A PLAYER: %d\n", __FUNCTION__, i); pent = g_psvs.clients[pEntInfo->id - 1].edict; if (createPlayers && pent) @@ -2048,7 +2048,7 @@ int CreateEntityList(SAVERESTOREDATA *pSaveData, int levelMask) if (pent && !pent->free) { if (!(pEntInfo->flags & FENTTABLE_PLAYER)) - Sys_Error("ENTITY IS NOT A PLAYER: %d\n", i); + Sys_Error("%s: ENTITY IS NOT A PLAYER: %d\n", __FUNCTION__, i); if (cl->active) EntityInit(pent, pEntInfo->classname); @@ -2339,7 +2339,7 @@ void Host_Changelevel2_f(void) FS_LogLevelLoadStarted(level); if (!SV_SpawnServer(FALSE, level, startspot)) - Sys_Error("Host_Changelevel2: Couldn't load map %s\n", level); + Sys_Error("%s: Couldn't load map %s\n", __FUNCTION__, level); if (pSaveData) SaveExit(pSaveData); diff --git a/rehlds/engine/mathlib.cpp b/rehlds/engine/mathlib.cpp index 276f5db..4a9759d 100644 --- a/rehlds/engine/mathlib.cpp +++ b/rehlds/engine/mathlib.cpp @@ -116,7 +116,7 @@ float anglemod(float a) void BOPS_Error(void) { - Sys_Error("BoxOnPlaneSide: Bad signbits"); + Sys_Error("%s: Bad signbits", __FUNCTION__); } #ifdef REHLDS_OPT_PEDANTIC diff --git a/rehlds/engine/model.cpp b/rehlds/engine/model.cpp index 645efa2..01f2f1f 100644 --- a/rehlds/engine/model.cpp +++ b/rehlds/engine/model.cpp @@ -140,7 +140,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name) avail = NULL; if (!name[0]) - Sys_Error("Mod_ForName: NULL name"); + Sys_Error("%s: NULL name", __FUNCTION__); for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) { @@ -164,7 +164,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name) else { if (!avail) - Sys_Error("mod_numknown >= MAX_KNOWN_MODELS"); + Sys_Error("%s: mod_numknown >= MAX_KNOWN_MODELS", __FUNCTION__); mod = avail; Mod_FillInCRCInfo(trackCRC, avail - mod_known); } @@ -286,7 +286,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC) if (!buf) { if (crash) - Sys_Error("Mod_NumForName: %s not found", mod->name); + Sys_Error("%s: %s not found", __FUNCTION__, mod->name); return 0; } @@ -303,7 +303,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC) { if (currentCRC != p->initialCRC) { - Sys_Error("%s has been modified since starting the engine. Consider running system diagnostics to check for faulty hardware.\n", mod->name); + Sys_Error("%s: %s has been modified since starting the engine. Consider running system diagnostics to check for faulty hardware.\n", __FUNCTION__, mod->name); } } else @@ -495,7 +495,7 @@ void Mod_LoadTextures(lump_t *l) mt->width = LittleLong(mt->width); mt->height = LittleLong(mt->height); if (mt->width & 0xF || mt->height & 0xF) - Sys_Error("Texture %s is not 16 aligned", mt); + Sys_Error("%s: Texture %s is not 16 aligned", __FUNCTION__, mt); pixels = 85 * mt->height * mt->width / 64; palette = *(uint16*)((char*)mt + sizeof(miptex_t) + pixels); @@ -559,7 +559,7 @@ void Mod_LoadTextures(lump_t *l) if (max < '0' || max > '9') { if (max < 'A' || max > 'J') - Sys_Error("Bad animating texture %s", tx); + Sys_Error("%s: Bad animating texture %s", __FUNCTION__, tx); altmax = max - 'A'; max = 0; altanims[altmax] = tx; @@ -592,7 +592,7 @@ void Mod_LoadTextures(lump_t *l) if (num < '0' || num > '9') { if (num < 'A' || num > 'J') - Sys_Error("Bad animating texture %s", tx); + Sys_Error("%s: Bad animating texture %s", __FUNCTION__, tx); num -= 'A'; altanims[num] = tx2; @@ -613,7 +613,7 @@ void Mod_LoadTextures(lump_t *l) { tx2 = anims[j]; if (!tx2) - Sys_Error("Missing frame %i of %s", j, tx); + Sys_Error("%s: Missing frame %i of %s", __FUNCTION__, j, tx); tx2->anim_min = j; tx2->anim_total = max; tx2->anim_max = j + 1; @@ -626,7 +626,7 @@ void Mod_LoadTextures(lump_t *l) { tx2 = altanims[j]; if (!tx2) - Sys_Error("Missing frame %i of %s", j, tx); + Sys_Error("%s: Missing frame %i of %s", __FUNCTION__, j, tx); tx2->anim_min = j; tx2->anim_total = altmax; @@ -706,7 +706,7 @@ void Mod_LoadVertexes(lump_t *l) in = (dvertex_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (mvertex_t*) Hunk_AllocName(count * sizeof(*out), loadname); @@ -729,7 +729,7 @@ void Mod_LoadSubmodels(lump_t *l) in = (dmodel_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (dmodel_t *)Hunk_AllocName(count*sizeof(*out), loadname); @@ -760,7 +760,7 @@ void Mod_LoadEdges(lump_t *l) in = (dedge_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (medge_t*) Hunk_AllocName((count + 1) * sizeof(*out), loadname); @@ -784,7 +784,7 @@ void Mod_LoadTexinfo(lump_t *l) in = (texinfo_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (mtexinfo_t*) Hunk_AllocName(count*sizeof(*out), loadname); @@ -829,7 +829,7 @@ void Mod_LoadTexinfo(lump_t *l) else { if (_miptex >= loadmodel->numtextures) - Sys_Error("miptex >= loadmodel->numtextures"); + Sys_Error("%s: miptex >= loadmodel->numtextures", __FUNCTION__); out->texture = loadmodel->textures[_miptex]; if (!out->texture) { @@ -882,7 +882,7 @@ void CalcSurfaceExtents(msurface_t *s) s->texturemins[i] = bmins[i] * 16; s->extents[i] = (bmaxs[i] - bmins[i]) * 16; if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > 256) - Sys_Error("Bad surface extents"); + Sys_Error("%s: Bad surface extents", __FUNCTION__); } } @@ -895,7 +895,7 @@ void Mod_LoadFaces(lump_t *l) in = (dface_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (msurface_t *) Hunk_AllocName(count*sizeof(*out), loadname); @@ -985,7 +985,7 @@ void Mod_LoadNodes(lump_t *l) in = (dnode_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (mnode_t*) Hunk_AllocName(count*sizeof(*out), loadname); @@ -1027,7 +1027,7 @@ void Mod_LoadLeafs(lump_t *l) in = (dleaf_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (mleaf_t*) Hunk_AllocName(count*sizeof(*out), loadname); @@ -1078,7 +1078,7 @@ void Mod_LoadClipnodes(lump_t *l) in = (dclipnode_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (dclipnode_t*) Hunk_AllocName(count*sizeof(*out), loadname); @@ -1169,7 +1169,7 @@ void Mod_LoadMarksurfaces(lump_t *l) in = (short *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (msurface_t **) Hunk_AllocName(count * sizeof(*out), loadname); @@ -1180,7 +1180,7 @@ void Mod_LoadMarksurfaces(lump_t *l) { j = LittleShort(in[i]); if (j >= loadmodel->numsurfaces) - Sys_Error("Mod_ParseMarksurfaces: bad surface number"); + Sys_Error("%s: bad surface number", __FUNCTION__); out[i] = loadmodel->surfaces + j; } } @@ -1192,7 +1192,7 @@ void Mod_LoadSurfedges(lump_t *l) in = (int *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (int*) Hunk_AllocName(count * sizeof(*out), loadname); @@ -1213,7 +1213,7 @@ void Mod_LoadPlanes(lump_t *l) in = (dplane_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) - Sys_Error("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error("%s: funny lump size in %s", __FUNCTION__, loadmodel->name); count = l->filelen / sizeof(*in); out = (mplane_t*) Hunk_AllocName(count * 2 * sizeof(*out), loadname); @@ -1265,7 +1265,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer) i = LittleLong(header->version); if (i != Q1BSP_VERSION && i != HLBSP_VERSION) - Sys_Error("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod, i, HLBSP_VERSION); + Sys_Error("%s: %s has wrong version number (%i should be %i)", __FUNCTION__, mod, i, HLBSP_VERSION); // swap all the lumps mod_base = (byte *)header; @@ -1512,7 +1512,7 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer) version = LittleLong(pinmodel->version); if (version != ALIAS_MODEL_VERSION) - Sys_Error("%s has wrong version number (%i should be %i)", mod->name, version, ALIAS_MODEL_VERSION); + Sys_Error("%s: %s has wrong version number (%i should be %i)", __FUNCTION__, mod->name, version, ALIAS_MODEL_VERSION); // allocate space for a working header, plus all the data except the frames, // skin and group info @@ -1532,20 +1532,20 @@ void Mod_LoadAliasModel(model_t *mod, void *buffer) pmodel->skinheight = LittleLong(pinmodel->skinheight); if (pmodel->skinheight > MAX_LBM_HEIGHT) - Sys_Error("model %s has a skin taller than %d", mod->name, MAX_LBM_HEIGHT); + Sys_Error("%s: model %s has a skin taller than %d", __FUNCTION__, mod->name, MAX_LBM_HEIGHT); pmodel->numverts = LittleLong(pinmodel->numverts); if (pmodel->numverts <= 0) - Sys_Error("model %s has no vertices", mod->name); + Sys_Error("%s: model %s has no vertices", __FUNCTION__, mod->name); if (pmodel->numverts > MAX_ALIAS_MODEL_VERTS) - Sys_Error("model %s has too many vertices", mod->name); + Sys_Error("%s: model %s has too many vertices", __FUNCTION__, mod->name); pmodel->numtris = LittleLong(pinmodel->numtris); if (pmodel->numtris <= 0) - Sys_Error("model %s has no triangles", mod->name); + Sys_Error("%s: model %s has no triangles", __FUNCTION__, mod->name); pmodel->numframes = LittleLong(pinmodel->numframes); pmodel->size = LittleFloat(pinmodel->size) * 0.09090909090909091; @@ -1713,7 +1713,7 @@ void *Mod_LoadSpriteFrame(void *pin, mspriteframe_t **ppframe) } else { - Sys_Error("Mod_LoadSpriteFrame: driver set invalid r_pixbytes: %d\n", r_pixbytes); + Sys_Error("%s: driver set invalid r_pixbytes: %d\n", __FUNCTION__, r_pixbytes); } return (void *)((byte *)pinframe + sizeof(dspriteframe_t) + size); @@ -1777,8 +1777,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer) version = LittleLong(pin->version); if (version != SPRITE_VERSION) - Sys_Error("%s has wrong version number " - "(%i should be %i)", mod->name, version, SPRITE_VERSION); + Sys_Error("%s: %s has wrong version number (%i should be %i)", __FUNCTION__, mod->name, version, SPRITE_VERSION); numframes = LittleLong(pin->numframes); int palsize = *(uint16*)&pin[1]; diff --git a/rehlds/engine/net_ws.cpp b/rehlds/engine/net_ws.cpp index 935a043..357952d 100644 --- a/rehlds/engine/net_ws.cpp +++ b/rehlds/engine/net_ws.cpp @@ -1004,14 +1004,15 @@ qboolean NET_QueuePacket(netsrc_t sock) { if (err == WSAEMSGSIZE) { - Con_DPrintf("NET_QueuePacket: Ignoring oversized network message\n"); + Con_DPrintf("%s: Ignoring oversized network message\n", __FUNCTION__); } else { if (g_pcls.state != ca_dedicated) - Sys_Error("NET_QueuePacket: %s", NET_ErrorString(err)); - else - Con_Printf("NET_QueuePacket: %s\n", NET_ErrorString(err)); + { + Sys_Error("%s: %s", __FUNCTION__, NET_ErrorString(err)); + } + Con_Printf("%s: %s\n", __FUNCTION__, NET_ErrorString(err)); } } continue; @@ -1021,7 +1022,7 @@ qboolean NET_QueuePacket(netsrc_t sock) if (ret != MAX_UDP_PACKET) break; - Con_NetPrintf("NET_QueuePacket: Oversize packet from %s\n", NET_AdrToString(in_from)); + Con_NetPrintf("%s: Oversize packet from %s\n", __FUNCTION__, NET_AdrToString(in_from)); } if (ret == -1 || ret == MAX_UDP_PACKET) { @@ -1168,7 +1169,7 @@ void NET_StartThread(void) if (!net_thread_initialized) { net_thread_initialized = TRUE; - Sys_Error("-net_thread is not reversed yet"); + Sys_Error("%s: -net_thread is not reversed yet", __FUNCTION__); #ifdef _WIN32 /* InitializeCriticalSection(&net_cs); @@ -1178,7 +1179,7 @@ void NET_StartThread(void) DeleteCriticalSection(&net_cs); net_thread_initialized = 0; use_thread = 0; - Sys_Error("Couldn't initialize network thread, run without -net_thread\n"); + Sys_Error("%s: Couldn't initialize network thread, run without -net_thread\n", __FUNCTION__); } */ #endif // _WIN32 @@ -1199,7 +1200,7 @@ void NET_StopThread(void) */ #endif // _WIN32 net_thread_initialized = FALSE; - Sys_Error("-net_thread is not reversed yet"); + Sys_Error("%s: -net_thread is not reversed yet", __FUNCTION__); } } } @@ -1667,7 +1668,7 @@ void NET_OpenIP(void) if (!ip_sockets[NS_SERVER] && dedicated) #endif { - Sys_Error("Couldn't allocate dedicated server IP port %d.", port); + Sys_Error("%s: Couldn't allocate dedicated server IP port %d.", __FUNCTION__, port); } sv_port = port; } diff --git a/rehlds/engine/pmovetst.cpp b/rehlds/engine/pmovetst.cpp index 2946767..9b237ae 100644 --- a/rehlds/engine/pmovetst.cpp +++ b/rehlds/engine/pmovetst.cpp @@ -113,7 +113,7 @@ int EXT_FUNC PM_HullPointContents(hull_t *hull, int num, vec_t *p) while (num >= 0) { if (num < hull->firstclipnode || num > hull->lastclipnode) - Sys_Error("PM_HullPointContents: bad node number"); + Sys_Error("%s: bad node number", __FUNCTION__); node = &hull->clipnodes[num]; plane = &hull->planes[node->planenum]; diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index 290ebf6..6630620 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -99,7 +99,7 @@ void EXT_FUNC SetMinMaxSize(edict_t *e, const float *min, const float *max, qboo for (int i = 0; i < 3; i++) { if (min[i] > max[i]) - Host_Error("backwards mins/maxs"); + Host_Error("%s: backwards mins/maxs", __FUNCTION__); } e->v.mins[0] = min[0]; @@ -161,7 +161,7 @@ void EXT_FUNC PF_setmodel_I(edict_t *e, const char *m) } } - Host_Error("no precache: %s\n", m); + Host_Error("%s: no precache: %s\n", __FUNCTION__, m); } int EXT_FUNC PF_modelindex(const char *pstr) @@ -324,13 +324,13 @@ void EXT_FUNC PF_ambientsound_I(edict_t *entity, float *pos, const char *samp, f void EXT_FUNC PF_sound_I(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch) { if (volume < 0.0 || volume > 255.0) - Sys_Error("EMIT_SOUND: volume = %i", volume); + Sys_Error("%s: volume = %i", __FUNCTION__, volume); if (attenuation < 0.0 || attenuation > 4.0) - Sys_Error("EMIT_SOUND: attenuation = %f", attenuation); + Sys_Error("%s: attenuation = %f", __FUNCTION__, attenuation); if (channel < 0 || channel > 7) - Sys_Error("EMIT_SOUND: channel = %i", channel); + Sys_Error("%s: channel = %i", __FUNCTION__, channel); if (pitch < 0 || pitch > 255) - Sys_Error("EMIT_SOUND: pitch = %i", pitch); + Sys_Error("%s: pitch = %i", __FUNCTION__, pitch); SV_StartSound(0, entity, channel, sample, (int)(volume * 255), attenuation, fFlags, pitch); } @@ -390,7 +390,7 @@ void EXT_FUNC TraceHull(const float *v1, const float *v2, int fNoMonsters, int h void EXT_FUNC TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr) { - Sys_Error("TraceSphere not yet implemented!\n"); + Sys_Error("%s: TraceSphere not yet implemented!\n", __FUNCTION__); } void EXT_FUNC TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr) @@ -906,7 +906,7 @@ edict_t* EXT_FUNC CreateNamedEntity(int className) ENTITYINIT pEntityInit; if (!className) - Sys_Error("Spawned a NULL entity!"); + Sys_Error("%s: Spawned a NULL entity!", __FUNCTION__); pedict = ED_Alloc(); pedict->v.classname = className; @@ -1614,7 +1614,7 @@ void EXT_FUNC PF_SetKeyValue_I(char *infobuffer, const char *key, const char *va { if (infobuffer != Info_Serverinfo()) { - Sys_Error("Can't set client keys with SetKeyValue"); + Sys_Error("%s: Can't set client keys with SetKeyValue", __FUNCTION__); } #ifdef REHLDS_FIXES Info_SetValueForKey(infobuffer, key, value, MAX_INFO_STRING); // Use correct length @@ -1906,7 +1906,7 @@ void EXT_FUNC PF_setview_I(const edict_t *clientent, const edict_t *viewent) { int clientnum = NUM_FOR_EDICT(clientent); if (clientnum < 1 || clientnum > g_psvs.maxclients) - Host_Error("PF_setview_I: not a client"); + Host_Error("%s: not a client", __FUNCTION__); client_t *client = &g_psvs.clients[clientnum - 1]; if (!client->fakeclient) @@ -2049,7 +2049,7 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest) entnum = NUM_FOR_EDICT(gMsgEntity); if (entnum <= 0 || entnum > g_psvs.maxclients) { - Host_Error("WriteDest_Parm: not a client"); + Host_Error("%s: not a client", __FUNCTION__); } if (dest == MSG_ONE) { @@ -2069,7 +2069,7 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest) case MSG_SPEC: return &g_psv.spectator; default: - Host_Error("WriteDest_Parm: bad destination=%d", dest); + Host_Error("%s: bad destination = %d", __FUNCTION__, dest); } } @@ -2078,19 +2078,19 @@ void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin if (msg_dest == MSG_ONE || msg_dest == MSG_ONE_UNRELIABLE) { if (!ed) - Sys_Error("MSG_ONE or MSG_ONE_UNRELIABLE with no target entity\n"); + Sys_Error("%s: with no target entity\n", __FUNCTION__); } else { if (ed) - Sys_Error("Invalid message; cannot use broadcast message with a target entity"); + Sys_Error("%s: Invalid message: Cannot use broadcast message with a target entity", __FUNCTION__); } if (gMsgStarted) - Sys_Error("New message started when msg '%d' has not been sent yet", gMsgType); + Sys_Error("%s: New message started when msg '%d' has not been sent yet", __FUNCTION__, gMsgType); if (msg_type == 0) - Sys_Error("Tried to create a message with a bogus message type ( 0 )"); + Sys_Error("%s: Tried to create a message with a bogus message type ( 0 )", __FUNCTION__); gMsgStarted = 1; gMsgType = msg_type; @@ -2117,14 +2117,14 @@ void EXT_FUNC PF_MessageEnd_I(void) { qboolean MsgIsVarLength = 0; if (!gMsgStarted) - Sys_Error("MESSAGE_END called with no active message\n"); + Sys_Error("%s: called with no active message\n", __FUNCTION__); gMsgStarted = 0; if (gMsgEntity && (gMsgEntity->v.flags & FL_FAKECLIENT)) return; if (gMsgBuffer.flags & SIZEBUF_OVERFLOWED) - Sys_Error("MESSAGE_END called, but message buffer from .dll had overflowed\n"); + Sys_Error("%s: called, but message buffer from .dll had overflowed\n", __FUNCTION__); if (gMsgType > svc_startofusermessages) @@ -2142,7 +2142,7 @@ void EXT_FUNC PF_MessageEnd_I(void) if (!pUserMsg) { - Con_DPrintf("PF_MessageEnd_I: Unknown User Msg %d\n", gMsgType); + Con_DPrintf("%s: Unknown User Msg %d\n", __FUNCTION__, gMsgType); return; } @@ -2152,22 +2152,12 @@ void EXT_FUNC PF_MessageEnd_I(void) // Limit packet sizes if (gMsgBuffer.cursize > MAX_USER_MSG_DATA) - Host_Error( - "PF_MessageEnd_I: Refusing to send user message %s of %i bytes to client, user message size limit is %i bytes\n", - pUserMsg->szName, - gMsgBuffer.cursize, - MAX_USER_MSG_DATA - ); + Host_Error("%s: Refusing to send user message %s of %i bytes to client, user message size limit is %i bytes\n", __FUNCTION__, pUserMsg->szName, gMsgBuffer.cursize, MAX_USER_MSG_DATA); } else { if (pUserMsg->iSize != gMsgBuffer.cursize) - Sys_Error( - "User Msg '%s': %d bytes written, expected %d\n", - pUserMsg->szName, - gMsgBuffer.cursize, - pUserMsg->iSize - ); + Sys_Error("%s: User Msg '%s': %d bytes written, expected %d\n", __FUNCTION__, pUserMsg->szName, gMsgBuffer.cursize, pUserMsg->iSize); } } #ifdef REHLDS_FIXES @@ -2182,7 +2172,7 @@ void EXT_FUNC PF_MessageEnd_I(void) { int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity); if (entnum < 1 || entnum > g_psvs.maxclients) - Host_Error("WriteDest_Parm: not a client"); + Host_Error("%s: not a client", __FUNCTION__); client_t* client = &g_psvs.clients[entnum - 1]; if (client->fakeclient || !client->hasusrmsgs || (!client->active && !client->spawned)) @@ -2197,9 +2187,11 @@ void EXT_FUNC PF_MessageEnd_I(void) #ifdef REHLDS_FIXES ; - if (gMsgDest == MSG_ALL) { + if (gMsgDest == MSG_ALL) + { gMsgDest = MSG_ONE; - for (int i = 0; i < g_psvs.maxclients; i++) { + for (int i = 0; i < g_psvs.maxclients; i++) + { gMsgEntity = g_psvs.clients[i].edict; if (gMsgEntity == nullptr) continue; @@ -2207,7 +2199,9 @@ void EXT_FUNC PF_MessageEnd_I(void) continue; writer(); } - } else { + } + else + { writer(); } #endif @@ -2337,7 +2331,7 @@ void EXT_FUNC PF_setspawnparms_I(edict_t *ent) { int i = NUM_FOR_EDICT(ent); if (i < 1 || i > g_psvs.maxclients) - Host_Error("Entity is not a client"); + Host_Error("%s: Entity is not a client", __FUNCTION__); } void EXT_FUNC PF_changelevel_I(const char *s1, const char *s2) diff --git a/rehlds/engine/pr_edict.cpp b/rehlds/engine/pr_edict.cpp index bfad691..294f520 100644 --- a/rehlds/engine/pr_edict.cpp +++ b/rehlds/engine/pr_edict.cpp @@ -625,7 +625,7 @@ void EXT_FUNC SaveSpawnParms(edict_t *pEdict) int eoffset = NUM_FOR_EDICT(pEdict); if (eoffset < 1 || eoffset > g_psvs.maxclients) { - Host_Error("Entity is not a client"); + Host_Error("%s: Entity is not a client", __FUNCTION__); } // Nothing more for this function even on client-side } diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 81d18ca..c2da8ab 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2655,19 +2655,19 @@ void SV_ResetModInfo(void) nFileSize = FS_Size(hLibListFile); if (!nFileSize || (signed int)nFileSize > 256 * 1024) { - Sys_Error("Game listing file size is bogus [%s: size %i]", "liblist.gam", nFileSize); + Sys_Error("%s: Game listing file size is bogus [%s: size %i]", __FUNCTION__, "liblist.gam", nFileSize); } pszInputStream = (char *)Mem_Malloc(nFileSize + 1); if (!pszInputStream) { - Sys_Error("Could not allocate space for game listing file of %i bytes", nFileSize + 1); + Sys_Error("%s: Could not allocate space for game listing file of %i bytes", __FUNCTION__, nFileSize + 1); } nBytesRead = FS_Read(pszInputStream, nFileSize, 1, hLibListFile); if (nBytesRead != nFileSize) { - Sys_Error("Error reading in game listing file, expected %i bytes, read %i", nFileSize, nBytesRead); + Sys_Error("%s: Error reading in game listing file, expected %i bytes, read %i", __FUNCTION__, nFileSize, nBytesRead); } pszInputStream[nFileSize] = 0; @@ -5064,7 +5064,7 @@ int SV_ModelIndex(const char *name) }; #endif - Sys_Error("SV_ModelIndex: model %s not precached", name); + Sys_Error("%s: SV_ModelIndex: model %s not precached", __FUNCTION__, name); } void EXT_FUNC SV_AddResource(resourcetype_t type, const char *name, int size, unsigned char flags, int index) @@ -5076,7 +5076,7 @@ void EXT_FUNC SV_AddResource(resourcetype_t type, const char *name, int size, un if (g_psv.num_resources >= MAX_RESOURCE_LIST) #endif // REHLDS_FIXES { - Sys_Error("Too many resources on server."); + Sys_Error("%s: Too many resources on server.", __FUNCTION__); } #ifdef REHLDS_FIXES @@ -5552,7 +5552,7 @@ void SV_BroadcastCommand(char *fmt, ...) MSG_WriteByte(&msg, svc_stufftext); MSG_WriteString(&msg, string); if (msg.flags & SIZEBUF_OVERFLOWED) - Sys_Error("SV_BroadcastCommand: Overflowed on %s, %i is max size\n", string, msg.maxsize); + Sys_Error("%s: Overflowed on %s, %i is max size\n", __FUNCTION__, string, msg.maxsize); for (int i = 0; i < g_psvs.maxclients; ++i) { @@ -7650,7 +7650,7 @@ void SV_RegisterDelta(char *name, char *loadfile) { delta_t *pdesc = NULL; if (!DELTA_Load(name, &pdesc, loadfile)) - Sys_Error("Error parsing %s!!!\n", loadfile); + Sys_Error("%s: Error parsing %s!!!\n", __FUNCTION__, loadfile); delta_info_t *p = (delta_info_t *)Mem_ZeroMalloc(sizeof(delta_info_t)); p->loadfile = Mem_Strdup(loadfile); @@ -7677,32 +7677,32 @@ void SV_InitDeltas(void) g_pplayerdelta = SV_LookupDelta("entity_state_player_t"); if (!g_pplayerdelta) - Sys_Error("No entity_state_player_t encoder on server!\n"); + Sys_Error("%s: No entity_state_player_t encoder on server!\n", __FUNCTION__); g_pentitydelta = SV_LookupDelta("entity_state_t"); if (!g_pentitydelta) - Sys_Error("No entity_state_t encoder on server!\n"); + Sys_Error("%s: No entity_state_t encoder on server!\n", __FUNCTION__); g_pcustomentitydelta = SV_LookupDelta("custom_entity_state_t"); if (!g_pcustomentitydelta) - Sys_Error("No custom_entity_state_t encoder on server!\n"); + Sys_Error("%s: No custom_entity_state_t encoder on server!\n", __FUNCTION__); g_pclientdelta = SV_LookupDelta("clientdata_t"); if (!g_pclientdelta) - Sys_Error("No clientdata_t encoder on server!\n"); + Sys_Error("%s: No clientdata_t encoder on server!\n", __FUNCTION__); g_pweapondelta = SV_LookupDelta("weapon_data_t"); if (!g_pweapondelta) - Sys_Error("No weapon_data_t encoder on server!\n"); + Sys_Error("%s: No weapon_data_t encoder on server!\n", __FUNCTION__); g_peventdelta = SV_LookupDelta("event_t"); if (!g_peventdelta) - Sys_Error("No event_t encoder on server!\n"); + Sys_Error("%s: No event_t encoder on server!\n", __FUNCTION__); #ifdef REHLDS_OPT_PEDANTIC g_pusercmddelta = SV_LookupDelta("usercmd_t"); if (!g_pusercmddelta) - Sys_Error("No usercmd_t encoder on server!\n"); + Sys_Error("%s: No usercmd_t encoder on server!\n", __FUNCTION__); #endif #if defined(REHLDS_OPT_PEDANTIC) || defined(REHLDS_FIXES) diff --git a/rehlds/engine/sv_phys.cpp b/rehlds/engine/sv_phys.cpp index 3382f7f..29d423e 100644 --- a/rehlds/engine/sv_phys.cpp +++ b/rehlds/engine/sv_phys.cpp @@ -255,7 +255,7 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace) break; if (!trace.ent) - Sys_Error("SV_FlyMove: !trace.ent"); + Sys_Error("%s: !trace.ent", __FUNCTION__); if (trace.plane.normal[2] > 0.7) { @@ -621,7 +621,7 @@ int SV_PushRotate(edict_t *pusher, float movetime) ++num_moved; if (num_moved >= g_psv.max_edicts) - Sys_Error("Out of edicts in simulator!\n"); + Sys_Error("%s: Out of edicts in simulator!\n", __FUNCTION__); vec3_t start, end, push, move; @@ -1392,7 +1392,7 @@ void SV_Physics(void) break; default: - Sys_Error("SV_Physics: %s bad movetype %d", &pr_strings[ent->v.classname], ent->v.movetype); + Sys_Error("%s: %s bad movetype %d", __FUNCTION__, &pr_strings[ent->v.classname], ent->v.movetype); } if (ent->v.flags & FL_KILLME) diff --git a/rehlds/engine/sv_upld.cpp b/rehlds/engine/sv_upld.cpp index 351e615..9495277 100644 --- a/rehlds/engine/sv_upld.cpp +++ b/rehlds/engine/sv_upld.cpp @@ -90,7 +90,7 @@ void SV_ClearResourceLists(client_t *cl) { if (!cl) { - Sys_Error("SV_ClearResourceLists with NULL client!"); + Sys_Error("%s: SV_ClearResourceLists with NULL client!", __FUNCTION__); } SV_ClearResourceList(&cl->resourcesneeded); @@ -165,7 +165,7 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl } if (i == g_psvs.maxclients) { - Sys_Error("Couldn't find player index for customization."); + Sys_Error("%s: Couldn't find player index for customization.", __FUNCTION__); } nPlayerNumber = i; diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index cd6ca39..9527375 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -315,7 +315,7 @@ int EXT_FUNC SV_TransferConsistencyInfo_internal(void) vec3_t maxs; if (!R_GetStudioBounds(filename, mins, maxs)) - Host_Error("Server unable to get bounds for %s\n", filename); + Host_Error("%s: Server unable to get bounds for %s\n", __FUNCTION__, filename); Q_memcpy(&r->rguc_reserved[1], mins, sizeof(mins)); Q_memcpy(&r->rguc_reserved[13], maxs, sizeof(maxs)); diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 8d6a96f..8650319 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -263,7 +263,7 @@ void __cdecl Sys_InitHardwareTimer() Sys_InitFPUControlWords(); if (!CRehldsPlatformHolder::get()->QueryPerfFreq(&perfFreq)) - Sys_Error("No hardware timer available"); + Sys_Error("%s: No hardware timer available", __FUNCTION__); perfHighPart = perfFreq.HighPart; perfLowPart = perfFreq.LowPart; @@ -406,7 +406,7 @@ NOXREF void Sys_MakeCodeWriteable(uint32 startaddr, uint32 length) NOXREFCHECK; #ifdef _WIN32 if (!VirtualProtect((LPVOID)startaddr, length, PAGE_EXECUTE_READWRITE, (PDWORD)&length)) - Sys_Error("Protection change failed."); + Sys_Error("%s: Protection change failed.", __FUNCTION__); #endif // _WIN32 } @@ -905,15 +905,15 @@ void LoadEntityDLLs(const char *szBaseDir) nFileSize = FS_Size(hLibListFile); nFileSize2 = nFileSize; if (!nFileSize || (signed int)nFileSize > 262144) - Sys_Error("Game listing file size is bogus [%s: size %i]", "liblist.gam", nFileSize); + Sys_Error("%s: Game listing file size is bogus [%s: size %i]", __FUNCTION__, "liblist.gam", nFileSize); pszInputStream = (char *)Mem_Malloc(nFileSize + 1); if (!pszInputStream) - Sys_Error("Could not allocate space for game listing file of %i bytes", nFileSize2 + 1); + Sys_Error("%s: Could not allocate space for game listing file of %i bytes", __FUNCTION__, nFileSize2 + 1); nBytesRead = FS_Read(pszInputStream, nFileSize2, 1, hLibListFile); if (nBytesRead != nFileSize2) - Sys_Error("Error reading in game listing file, expected %i bytes, read %i", nFileSize2, nBytesRead); + Sys_Error("%s: Error reading in game listing file, expected %i bytes, read %i", __FUNCTION__, nFileSize2, nBytesRead); pszInputStream[nFileSize2] = 0; pStreamPos = pszInputStream; diff --git a/rehlds/engine/sys_dll2.cpp b/rehlds/engine/sys_dll2.cpp index c7aaaa8..8e1a23d 100644 --- a/rehlds/engine/sys_dll2.cpp +++ b/rehlds/engine/sys_dll2.cpp @@ -203,7 +203,7 @@ void Sys_CheckOSVersion(void) Q_memset(&verInfo, 0, sizeof(verInfo)); verInfo.dwOSVersionInfoSize = sizeof(verInfo); if (!GetVersionEx(&verInfo)) - Sys_Error("Couldn't get OS info"); + Sys_Error("%s: Couldn't get OS info", __FUNCTION__); g_WinNTOrHigher = verInfo.dwMajorVersion >= 4; if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4) @@ -348,7 +348,7 @@ void Sys_InitMemory(void) if (lpBuffer.dwTotalPhys) { if (lpBuffer.dwTotalPhys < FIFTEEN_MB) - Sys_Error("Available memory less than 15MB!!! %i", host_parms.memsize); + Sys_Error("%s: Available memory less than 15MB!!! %i", __FUNCTION__, host_parms.memsize); host_parms.memsize = (int)(lpBuffer.dwTotalPhys >> 1); if (host_parms.memsize < MINIMUM_WIN_MEMORY) @@ -376,7 +376,7 @@ void Sys_InitMemory(void) #endif // _WIN32 if (!host_parms.membase) - Sys_Error("Unable to allocate %.2f MB\n", (float)host_parms.memsize / (1024.0f * 1024.0f)); + Sys_Error("%s: Unable to allocate %.2f MB\n", __FUNCTION__, (float)host_parms.memsize / (1024.0f * 1024.0f)); } void Sys_ShutdownMemory(void) diff --git a/rehlds/engine/sys_engine.cpp b/rehlds/engine/sys_engine.cpp index b2e31a0..7dbace4 100644 --- a/rehlds/engine/sys_engine.cpp +++ b/rehlds/engine/sys_engine.cpp @@ -88,7 +88,7 @@ void ForceReloadProfile() //SDL_GL_SetSwapInterval((gl_vsync.value <= 0.0) - 1); if (g_pcls.state != ca_dedicated) { - Sys_Error("Only dedicated mode is supported"); + Sys_Error("%s: Only dedicated mode is supported", __FUNCTION__); /* v0 = GetRateRegistrySetting(rate.string); Q_strncpy(szRate, v0, 0x20u); diff --git a/rehlds/engine/textures.cpp b/rehlds/engine/textures.cpp index 801e0fd..a941ad3 100644 --- a/rehlds/engine/textures.cpp +++ b/rehlds/engine/textures.cpp @@ -55,7 +55,7 @@ cvar_t r_wadtextures; void SafeRead(FileHandle_t f, void *buffer, int count) { if (FS_Read(buffer, count, 1, f) != count) - Sys_Error("File read failure"); + Sys_Error("%s: File read failure", __FUNCTION__); } void CleanupName(char *in, char *out) @@ -122,12 +122,12 @@ qboolean TEX_InitFromWad(char *path) texfile = FS_Open(wadPath, "rb"); texfiles[nTexFiles++] = texfile; if (!texfile) - Sys_Error("WARNING: couldn't open %s\n", wadPath); + Sys_Error("%s: couldn't open %s\n", __FUNCTION__, wadPath); Con_DPrintf("Using WAD File: %s\n", wadPath); SafeRead(texfile, &header, 12); if (Q_strncmp(header.identification, "WAD2", 4) && Q_strncmp(header.identification, "WAD3", 4)) - Sys_Error("TEX_InitFromWad: %s isn't a wadfile", wadPath); + Sys_Error("%s: %s isn't a wadfile", __FUNCTION__, wadPath); header.numlumps = LittleLong(header.numlumps); header.infotableofs = LittleLong(header.infotableofs); @@ -196,7 +196,7 @@ int FindMiptex(char *name) } if (nummiptex == 512) - Sys_Error("Exceeded MAX_MAP_TEXTURES"); + Sys_Error("%s: Exceeded MAX_MAP_TEXTURES", __FUNCTION__); Q_strncpy(miptex[i], name, 63); miptex[i][63] = 0; diff --git a/rehlds/engine/tmessage.cpp b/rehlds/engine/tmessage.cpp index 118956d..9f62272 100644 --- a/rehlds/engine/tmessage.cpp +++ b/rehlds/engine/tmessage.cpp @@ -347,7 +347,7 @@ NOXREF void TextMessageParse(unsigned char *pMemFile, int fileSize) while (memfgets(pMemFile, fileSize, &filePos, buf, 512) != NULL) { if(messageCount >= MAX_MESSAGES) - Sys_Error("tmessage::TextMessageParse : messageCount>=MAX_MESSAGES"); + Sys_Error("%s: messageCount >= MAX_MESSAGES", __FUNCTION__); TrimSpace(buf, trim); switch (mode) diff --git a/rehlds/engine/wad.cpp b/rehlds/engine/wad.cpp index edf8597..8eb0178 100644 --- a/rehlds/engine/wad.cpp +++ b/rehlds/engine/wad.cpp @@ -69,8 +69,8 @@ int W_LoadWadFile(char *filename) if (!wad->wad_base) { if (!slot) - Sys_Error("W_LoadWadFile: couldn't load %s", filename); - Con_Printf("WARNING: W_LoadWadFile, couldn't load %s\n", filename); + Sys_Error("%s: couldn't load %s", __FUNCTION__, filename); + Con_Printf("WARNING: %s, couldn't load %s\n", __FUNCTION__, filename); return -1; } @@ -79,7 +79,7 @@ int W_LoadWadFile(char *filename) wad->wadname[sizeof(wad->wadname) - 1] = 0; wad->loaded = TRUE; if (*(uint32 *)header->identification != MAKEID('W', 'A', 'D', '3')) - Sys_Error("Wad file %s doesn't have WAD3 id\n", filename); + Sys_Error("%s: Wad file %s doesn't have WAD3 id\n", __FUNCTION__, filename); wad->wad_numlumps = LittleLong(header->numlumps); lumpinfo_t * lump_p = (lumpinfo_t *)&wad->wad_base[LittleLong(header->infotableofs)]; @@ -112,7 +112,7 @@ lumpinfo_t *W_GetLumpinfo(int wad, char *name, qboolean doerror) } if (doerror) - Sys_Error("W_GetLumpinfo: %s not found", name); + Sys_Error("%s: %s not found", __FUNCTION__, name); return NULL; } @@ -130,7 +130,7 @@ NOXREF void *W_GetLumpNum(int wad, int num) NOXREFCHECK; lumpinfo_t *lump; if (num < 0 || num > wads[wad].wad_numlumps) - Sys_Error("W_GetLumpNum: bad number: %i", num); + Sys_Error("%s: bad number: %i", __FUNCTION__, num); lump = wads[wad].wad_lumps; return (void *)&wads[wad].wad_base[lump->filepos]; diff --git a/rehlds/engine/world.cpp b/rehlds/engine/world.cpp index f3f2c10..16347e7 100644 --- a/rehlds/engine/world.cpp +++ b/rehlds/engine/world.cpp @@ -164,7 +164,7 @@ struct hull_s *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs, model = Mod_Handle(ent->v.modelindex); if (!model || model->type != mod_brush) - Sys_Error("Hit a %s with no model (%s)", &pr_strings[ent->v.classname], &pr_strings[ent->v.model]); + Sys_Error("%s: Hit a %s with no model (%s)", __FUNCTION__, &pr_strings[ent->v.classname], &pr_strings[ent->v.model]); float xSize = maxs[0] - mins[0]; if (xSize > 8.0f) @@ -220,7 +220,7 @@ hull_t *SV_HullForEntity(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec if (ent->v.solid == SOLID_BSP) { if (ent->v.movetype != MOVETYPE_PUSH && ent->v.movetype != MOVETYPE_PUSHSTEP) - Sys_Error("SOLID_BSP without MOVETYPE_PUSH"); + Sys_Error("%s: SOLID_BSP without MOVETYPE_PUSH", __FUNCTION__); return SV_HullForBsp(ent, mins, maxs, offset); } @@ -1185,7 +1185,7 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip) continue; if (touch->v.solid == SOLID_TRIGGER) - Sys_Error("Trigger in clipping list"); + Sys_Error("%s: Trigger in clipping list", __FUNCTION__); if (gNewDLLFunctions.pfnShouldCollide && !gNewDLLFunctions.pfnShouldCollide(touch, clip->passedict)) #ifdef REHLDS_FIXES