From 598fddaa9633afd444cb95d8e7eb74d9b05b899d Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 22 Jun 2005 17:35:17 +0000 Subject: [PATCH] changed a lot of Host_Error calls to Con_Printf or Sys_Error according to severity git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5460 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 2 +- cl_particles.c | 7 +++++-- collision.c | 2 +- common.c | 2 -- r_lerpanim.c | 5 ++++- snd_main.c | 5 ++++- snd_wav.c | 5 ++++- sv_main.c | 15 ++++++++++++--- sv_phys.c | 7 +++++-- svvm_cmds.c | 14 ++++++++------ world.c | 5 ++++- 11 files changed, 48 insertions(+), 21 deletions(-) diff --git a/cl_main.c b/cl_main.c index 5e4a52c1..d638d185 100644 --- a/cl_main.c +++ b/cl_main.c @@ -190,7 +190,7 @@ void CL_ExpandEntities(int num) if (num >= cl_max_entities) { if (!cl_entities) - Host_Error("CL_ExpandEntities: cl_entities not initialized\n"); + Sys_Error("CL_ExpandEntities: cl_entities not initialized\n"); if (num >= MAX_EDICTS) Host_Error("CL_ExpandEntities: num %i >= %i\n", num, MAX_EDICTS); oldmaxentities = cl_max_entities; diff --git a/cl_particles.c b/cl_particles.c index 235a5424..ef30aad8 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -955,7 +955,7 @@ void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int color } break; default: - Host_Error("CL_ParticleRain: unknown type %i (0 = rain, 1 = snow)\n", type); + Con_Printf ("CL_ParticleRain: unknown type %i (0 = rain, 1 = snow)\n", type); } } @@ -2025,7 +2025,10 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2) particle_texcoord2f[6] = 1;particle_texcoord2f[7] = v[1]; } else - Host_Error("R_DrawParticles: unknown particle orientation %i\n", p->type->orientation); + { + Con_Printf("R_DrawParticles: unknown particle orientation %i\n", p->type->orientation); + return; + } #if WORKINGLQUAKE if (blendmode == PBLEND_ALPHA) diff --git a/collision.c b/collision.c index 88a47951..30f4d766 100644 --- a/collision.c +++ b/collision.c @@ -511,7 +511,7 @@ colbrushf_t *Collision_AllocBrushFromPermanentPolygonFloat(mempool_t *mempool, i brush->numplanes = numpoints + 2; brush->planes = (void *)(brush + 1); brush->points = (colpointf_t *)points; - Host_Error("Collision_AllocBrushFromPermanentPolygonFloat: FIXME: this code needs to be updated to generate a mesh...\n"); + Sys_Error("Collision_AllocBrushFromPermanentPolygonFloat: FIXME: this code needs to be updated to generate a mesh...\n"); return brush; } diff --git a/common.c b/common.c index 6019461a..bfdb26ee 100644 --- a/common.c +++ b/common.c @@ -283,8 +283,6 @@ void MSG_WriteCoord (sizebuf_t *sb, float f, protocolversion_t protocol) MSG_WriteCoord16i (sb, f); else MSG_WriteCoord32f (sb, f); - //else - // Host_Error("MSG_WriteCoord: unknown protocol\n"); } void MSG_WriteVector (sizebuf_t *sb, float *v, protocolversion_t protocol) diff --git a/r_lerpanim.c b/r_lerpanim.c index f736a11c..831a16e4 100644 --- a/r_lerpanim.c +++ b/r_lerpanim.c @@ -32,7 +32,10 @@ void R_LerpAnimation(entity_render_t *r) // note: this could be removed, if the rendering code allows an empty blend array if (r->frame1 < 0) - Host_Error ("CL_LerpAnimation: frame1 is NULL\n"); + { + Con_Printf ("CL_LerpAnimation: frame1 is NULL\n"); + r->frame1 = 0; + } // check r_lerpmodels and round off very close blend percentages if (!r_lerpmodels.integer) diff --git a/snd_main.c b/snd_main.c index 365ebf85..1e9fd6ec 100644 --- a/snd_main.c +++ b/snd_main.c @@ -257,7 +257,10 @@ sfx_t *S_FindName (const char *name) return NULL; if (strlen (name) >= sizeof (sfx->name)) - Host_Error ("S_FindName: sound name too long (%s)", name); + { + Con_Printf ("S_FindName: sound name too long (%s)", name); + return NULL; + } // Look for this sound in the list of known sfx for (sfx = known_sfx; sfx != NULL; sfx = sfx->next) diff --git a/snd_wav.c b/snd_wav.c index ff4bb406..041a2552 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -204,7 +204,10 @@ static wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) if (info.samples) { if (samples < info.samples) - Host_Error ("Sound %s has a bad loop length", name); + { + Con_Printf ("Sound %s has a bad loop length", name); + info.samples = samples; + } } else info.samples = samples; diff --git a/sv_main.c b/sv_main.c index 63dd5a81..f811ee66 100644 --- a/sv_main.c +++ b/sv_main.c @@ -209,13 +209,22 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v int sound_num, field_mask, i, ent; if (volume < 0 || volume > 255) - Host_Error ("SV_StartSound: volume = %i", volume); + { + Con_Printf ("SV_StartSound: volume = %i", volume); + return; + } if (attenuation < 0 || attenuation > 4) - Host_Error ("SV_StartSound: attenuation = %f", attenuation); + { + Con_Printf ("SV_StartSound: attenuation = %f", attenuation); + return; + } if (channel < 0 || channel > 7) - Host_Error ("SV_StartSound: channel = %i", channel); + { + Con_Printf ("SV_StartSound: channel = %i", channel); + return; + } if (sv.datagram.cursize > MAX_PACKETFRAGMENT-21) return; diff --git a/sv_phys.c b/sv_phys.c index e4ca6e66..4ea63484 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -313,7 +313,10 @@ int SV_FlyMove (prvm_edict_t *ent, float time, float *stepnormal) } if (!trace.ent) - Host_Error("SV_FlyMove: !trace.ent"); + { + Con_Printf ("SV_FlyMove: !trace.ent"); + trace.ent = prog->edicts; + } if (((int) ent->fields.server->flags & FL_ONGROUND) && ent->fields.server->groundentity == PRVM_EDICT_TO_PROG(trace.ent)) impact = false; @@ -1433,7 +1436,7 @@ void SV_Physics_Entity (prvm_edict_t *ent, qboolean runmove) } break; default: - Host_Error ("SV_Physics: bad movetype %i", (int)ent->fields.server->movetype); + Con_Printf ("SV_Physics: bad movetype %i", (int)ent->fields.server->movetype); break; } diff --git a/svvm_cmds.c b/svvm_cmds.c index fe00a445..5dae1f94 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1182,18 +1182,20 @@ sizebuf_t *WriteDest (void) ent = PRVM_PROG_TO_EDICT(prog->globals.server->msg_entity); entnum = PRVM_NUM_FOR_EDICT(ent); if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) - Host_Error("WriteDest: tried to write to non-client\n"); - return &svs.clients[entnum-1].message; + { + Con_Printf ("WriteDest: tried to write to non-client\n"); + return &sv.reliable_datagram; + } + else + return &svs.clients[entnum-1].message; + default: + Con_Printf ("WriteDest: bad destination"); case MSG_ALL: return &sv.reliable_datagram; case MSG_INIT: return &sv.signon; - - default: - Host_Error("WriteDest: bad destination"); - break; } return NULL; diff --git a/world.c b/world.c index cad831b3..da7c6713 100644 --- a/world.c +++ b/world.c @@ -270,7 +270,10 @@ void SV_LinkEdict_AreaGrid(prvm_edict_t *ent) int igrid[3], igridmins[3], igridmaxs[3], gridnum, entitynumber = PRVM_NUM_FOR_EDICT(ent); if (entitynumber <= 0 || entitynumber >= prog->max_edicts || PRVM_EDICT_NUM(entitynumber) != ent) - Host_Error("SV_LinkEdict_AreaGrid: invalid edict %p (edicts is %p, edict compared to prog->edicts is %i)\n", ent, prog->edicts, entitynumber); + { + Con_Printf ("SV_LinkEdict_AreaGrid: invalid edict %p (edicts is %p, edict compared to prog->edicts is %i)\n", ent, prog->edicts, entitynumber); + return; + } igridmins[0] = (int) ((ent->fields.server->absmin[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]); igridmins[1] = (int) ((ent->fields.server->absmin[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]); -- 2.39.2