mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-19 17:01:46 +00:00
replace many Host_EndGame calls with Host_Error and make Host_Error not bail
out of the program in most cases
This commit is contained in:
parent
d168a3daee
commit
504b804b4c
5 changed files with 40 additions and 37 deletions
|
@ -274,8 +274,8 @@ CL_GetDemoMessage (void)
|
|||
(net_message->message->cursize);
|
||||
// Con_Printf("read: %ld bytes\n", net_message->message->cursize);
|
||||
if (net_message->message->cursize > MAX_MSGLEN + 8) //+8 for header
|
||||
Host_EndGame ("Demo message > MAX_MSGLEN + 8: %d/%d",
|
||||
net_message->message->cursize, MAX_MSGLEN + 8);
|
||||
Host_Error ("Demo message > MAX_MSGLEN + 8: %d/%d",
|
||||
net_message->message->cursize, MAX_MSGLEN + 8);
|
||||
r = Qread (cls.demofile, net_message->message->data,
|
||||
net_message->message->cursize);
|
||||
if (r != net_message->message->cursize) {
|
||||
|
|
|
@ -246,7 +246,7 @@ FlushEntityPacket (void)
|
|||
while (1) {
|
||||
word = (unsigned short) MSG_ReadShort (net_message);
|
||||
if (net_message->badread) { // something didn't parse right...
|
||||
Host_EndGame ("msg_badread in packetentities");
|
||||
Host_Error ("msg_badread in packetentities");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
while (1) {
|
||||
word = (unsigned short) MSG_ReadShort (net_message);
|
||||
if (net_message->badread) { // something didn't parse right...
|
||||
Host_EndGame ("msg_badread in packetentities");
|
||||
Host_Error ("msg_badread in packetentities");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,8 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
while (oldindex < oldp->num_entities) {
|
||||
// Con_Printf ("copy %i\n", oldp->entities[oldindex].number);
|
||||
if (newindex >= MAX_PACKET_ENTITIES)
|
||||
Host_EndGame ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_PACKET_ENTITIES");
|
||||
Host_Error ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_PACKET_ENTITIES");
|
||||
newp->entities[newindex] = oldp->entities[oldindex];
|
||||
newindex++;
|
||||
oldindex++;
|
||||
|
@ -337,8 +337,8 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
// Con_Printf ("copy %i\n", oldnum);
|
||||
// copy one of the old entities over to the new packet unchanged
|
||||
if (newindex >= MAX_PACKET_ENTITIES)
|
||||
Host_EndGame ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_PACKET_ENTITIES");
|
||||
Host_Error ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_PACKET_ENTITIES");
|
||||
newp->entities[newindex] = oldp->entities[oldindex];
|
||||
newindex++;
|
||||
oldindex++;
|
||||
|
@ -359,8 +359,8 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
}
|
||||
|
||||
if (newindex >= MAX_PACKET_ENTITIES)
|
||||
Host_EndGame ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_PACKET_ENTITIES");
|
||||
Host_Error ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_PACKET_ENTITIES");
|
||||
CL_ParseDelta (&cl_baselines[newnum], &newp->entities[newindex],
|
||||
word);
|
||||
newindex++;
|
||||
|
@ -626,7 +626,7 @@ CL_ParsePlayerinfo (void)
|
|||
num = MSG_ReadByte (net_message);
|
||||
if (num > MAX_CLIENTS)
|
||||
// Sys_Error ("CL_ParsePlayerinfo: bad num");
|
||||
Host_EndGame ("CL_ParsePlayerinfo: bad num");
|
||||
Host_Error ("CL_ParsePlayerinfo: bad num");
|
||||
|
||||
state = &cl.frames[parsecountmod].playerstate[num];
|
||||
|
||||
|
|
|
@ -1340,9 +1340,9 @@ Host_Error (const char *error, ...)
|
|||
inerror = true;
|
||||
|
||||
va_start (argptr, error);
|
||||
vsnprintf (string, sizeof (string), error, argptr);
|
||||
Con_Printf ("Host_Error: ");
|
||||
Con_Print (error, argptr);
|
||||
va_end (argptr);
|
||||
Con_Printf ("Host_Error: %s\n", string);
|
||||
|
||||
CL_Disconnect ();
|
||||
cls.demonum = -1;
|
||||
|
@ -1350,7 +1350,11 @@ Host_Error (const char *error, ...)
|
|||
inerror = false;
|
||||
|
||||
// FIXME
|
||||
Sys_Error ("Host_Error: %s\n", string);
|
||||
if (host_initialized) {
|
||||
longjmp (host_abort, 1);
|
||||
} else {
|
||||
Sys_Error ("Host_Error: %s\n", string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -623,9 +623,9 @@ CL_ParseServerData (void)
|
|||
if (protover != PROTOCOL_VERSION &&
|
||||
!(cls.demoplayback
|
||||
&& (protover <= 26 && protover >= 28)))
|
||||
Host_EndGame ("Server returned version %i, not %i\nYou probably "
|
||||
"need to upgrade.\nCheck http://www.quakeworld.net/",
|
||||
protover, PROTOCOL_VERSION);
|
||||
Host_Error ("Server returned version %i, not %i\nYou probably "
|
||||
"need to upgrade.\nCheck http://www.quakeworld.net/",
|
||||
protover, PROTOCOL_VERSION);
|
||||
|
||||
cl.servercount = MSG_ReadLong (net_message);
|
||||
|
||||
|
@ -732,7 +732,7 @@ CL_ParseSoundlist (void)
|
|||
break;
|
||||
numsounds++;
|
||||
if (numsounds == MAX_SOUNDS)
|
||||
Host_EndGame ("Server sent too many sound_precache");
|
||||
Host_Error ("Server sent too many sound_precache");
|
||||
strcpy (cl.sound_name[numsounds], str);
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ CL_ParseModellist (void)
|
|||
break;
|
||||
nummodels++;
|
||||
if (nummodels == MAX_MODELS)
|
||||
Host_EndGame ("Server sent too many model_precache");
|
||||
Host_Error ("Server sent too many model_precache");
|
||||
strcpy (cl.model_name[nummodels], str);
|
||||
|
||||
if (!strcmp (cl.model_name[nummodels], "progs/spike.mdl"))
|
||||
|
@ -836,7 +836,7 @@ CL_ParseStatic (void)
|
|||
CL_ParseBaseline (&es);
|
||||
|
||||
if (cl.num_statics >= MAX_STATIC_ENTITIES)
|
||||
Host_EndGame ("Too many static entities");
|
||||
Host_Error ("Too many static entities");
|
||||
ent = &cl_static_entities[cl.num_statics++];
|
||||
CL_Init_Entity (ent);
|
||||
|
||||
|
@ -896,7 +896,7 @@ CL_ParseStartSoundPacket (void)
|
|||
channel &= 7;
|
||||
|
||||
if (ent > MAX_EDICTS)
|
||||
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
|
||||
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos,
|
||||
volume / 255.0, attenuation);
|
||||
|
@ -982,7 +982,7 @@ CL_UpdateUserinfo (void)
|
|||
|
||||
slot = MSG_ReadByte (net_message);
|
||||
if (slot >= MAX_CLIENTS)
|
||||
Host_EndGame
|
||||
Host_Error
|
||||
("CL_ParseServerMessage: svc_updateuserinfo > MAX_SCOREBOARD");
|
||||
|
||||
player = &cl.players[slot];
|
||||
|
@ -1005,7 +1005,7 @@ CL_SetInfo (void)
|
|||
|
||||
slot = MSG_ReadByte (net_message);
|
||||
if (slot >= MAX_CLIENTS)
|
||||
Host_EndGame ("CL_ParseServerMessage: svc_setinfo > MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_setinfo > MAX_SCOREBOARD");
|
||||
|
||||
player = &cl.players[slot];
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ CL_SetStat (int stat, int value)
|
|||
|
||||
if (stat < 0 || stat >= MAX_CL_STATS)
|
||||
// Sys_Error ("CL_SetStat: %i is invalid", stat);
|
||||
Host_EndGame ("CL_SetStat: %i is invalid", stat);
|
||||
Host_Error ("CL_SetStat: %i is invalid", stat);
|
||||
|
||||
Sbar_Changed ();
|
||||
|
||||
|
@ -1136,7 +1136,7 @@ CL_ParseServerMessage (void)
|
|||
// parse the message
|
||||
while (1) {
|
||||
if (net_message->badread) {
|
||||
Host_EndGame ("CL_ParseServerMessage: Bad server message");
|
||||
Host_Error ("CL_ParseServerMessage: Bad server message");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1154,8 +1154,7 @@ CL_ParseServerMessage (void)
|
|||
// other commands
|
||||
switch (cmd) {
|
||||
default:
|
||||
Host_EndGame
|
||||
("CL_ParseServerMessage: Illegible server message");
|
||||
Host_Error ("CL_ParseServerMessage: Illegible server message");
|
||||
break;
|
||||
|
||||
case svc_nop:
|
||||
|
@ -1226,7 +1225,7 @@ CL_ParseServerMessage (void)
|
|||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_LIGHTSTYLES)
|
||||
// Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
Host_EndGame ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
strcpy (r_lightstyle[i].map, MSG_ReadString (net_message));
|
||||
r_lightstyle[i].length = strlen (r_lightstyle[i].map);
|
||||
break;
|
||||
|
@ -1244,24 +1243,24 @@ CL_ParseServerMessage (void)
|
|||
Sbar_Changed ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame ("CL_ParseServerMessage: svc_updatefrags > "
|
||||
"MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatefrags > "
|
||||
"MAX_SCOREBOARD");
|
||||
cl.players[i].frags = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
case svc_updateping:
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame ("CL_ParseServerMessage: svc_updateping > "
|
||||
"MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updateping > "
|
||||
"MAX_SCOREBOARD");
|
||||
cl.players[i].ping = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
case svc_updatepl:
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame ("CL_ParseServerMessage: svc_updatepl > "
|
||||
"MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatepl > "
|
||||
"MAX_SCOREBOARD");
|
||||
cl.players[i].pl = MSG_ReadByte (net_message);
|
||||
break;
|
||||
|
||||
|
@ -1269,8 +1268,8 @@ CL_ParseServerMessage (void)
|
|||
// time is sent over as seconds ago
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame ("CL_ParseServerMessage: svc_updateentertime "
|
||||
"> MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updateentertime "
|
||||
"> MAX_SCOREBOARD");
|
||||
cl.players[i].entertime = realtime - MSG_ReadFloat
|
||||
(net_message);
|
||||
break;
|
||||
|
|
|
@ -206,7 +206,7 @@ CL_NewTranslation (int slot, skin_t *skin)
|
|||
player_info_t *player;
|
||||
|
||||
if (slot > MAX_CLIENTS)
|
||||
Host_EndGame ("CL_NewTranslation: slot > MAX_CLIENTS");
|
||||
Host_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
|
||||
|
||||
player = &cl.players[slot];
|
||||
if (!player->name[0])
|
||||
|
|
Loading…
Reference in a new issue