Fixed several GIB bugs, optimized Cbuf_Execute_Stack a bit, changed QW

clients to use a separate buffer for stufftext commands.
This commit is contained in:
Brian Koropoff 2002-12-01 07:22:42 +00:00
parent 05bee9dc59
commit 714f2ced4c
5 changed files with 15 additions and 11 deletions

View file

@ -236,9 +236,10 @@ GIB_Return_f (void)
if (GIB_Argc () == 1) if (GIB_Argc () == 1)
return; return;
if (!sp->up || // Nothing above us on the stack if (!sp->up || // Nothing above us on the stack
GIB_DATA(sp->up)->type != GIB_BUFFER_PROXY || // No proxy buffer created sp->up->interpreter != &gib_interp || // Not a GIB buffer
GIB_DATA(sp->up)->type != GIB_BUFFER_PROXY || // Not a proxy buffer
!sp->up->up || // Nothing above proxy buffer on the stack !sp->up->up || // Nothing above proxy buffer on the stack
sp->up->up->interpreter != &gib_interp || // Not a GIB buffer sp->up->up->interpreter != &gib_interp || // Not a GIB buffer to return to
!GIB_DATA(sp->up->up)->ret.waiting) // Buffer doesn't want a return value !GIB_DATA(sp->up->up)->ret.waiting) // Buffer doesn't want a return value
Sys_Printf("Warning: unwanted return value discarded.\n"); // Not a serious error Sys_Printf("Warning: unwanted return value discarded.\n"); // Not a serious error
else { else {
@ -395,9 +396,7 @@ GIB_For_f (void)
ifs = " \n\r\t"; ifs = " \n\r\t";
dstring_append (GIB_DATA(sub)->loop_data, ifs, strlen(ifs)+1); dstring_append (GIB_DATA(sub)->loop_data, ifs, strlen(ifs)+1);
// Store pointers to data // Store pointers to data
ll = GIB_DATA(sub)->loop_data->str; for (ll = GIB_DATA(sub)->loop_data->str; *ll && strchr (ifs, *ll); ll++);
while (isspace ((byte) *ll))
ll++;
GIB_DATA(sub)->loop_list_p = ll; // List to iterate through GIB_DATA(sub)->loop_list_p = ll; // List to iterate through
GIB_DATA(sub)->loop_var_p = GIB_DATA(sub)->loop_data->str + strlen(GIB_Argv(3))+1; // Var to use GIB_DATA(sub)->loop_var_p = GIB_DATA(sub)->loop_data->str + strlen(GIB_Argv(3))+1; // Var to use
GIB_DATA(sub)->loop_ifs_p = GIB_DATA(sub)->loop_var_p + strlen(GIB_Argv(1))+1; // Internal field separator GIB_DATA(sub)->loop_ifs_p = GIB_DATA(sub)->loop_var_p + strlen(GIB_Argv(1))+1; // Internal field separator
@ -599,7 +598,7 @@ GIB_Thread_Kill_f (void)
unsigned long int id = strtoul (GIB_Argv(1), 0, 10); unsigned long int id = strtoul (GIB_Argv(1), 0, 10);
thread = GIB_Thread_Find (id); thread = GIB_Thread_Find (id);
if (!thread) { if (!thread) {
Cbuf_Error ("thread", "thread.kill: thread %ul does not exist.", id); Cbuf_Error ("thread", "thread.kill: thread %lu does not exist.", id);
return; return;
} }
for (cur = thread->cbuf; cur; cur = cur->down) { for (cur = thread->cbuf; cur; cur = cur->down) {

View file

@ -184,12 +184,14 @@ Cbuf_Execute_Stack (cbuf_t *cbuf)
sp = sp->down; sp = sp->down;
continue; continue;
} else if (sp->state == CBUF_STATE_ERROR) } else if (sp->state == CBUF_STATE_ERROR)
break; goto ERROR;
else else
return; return;
} }
sp = sp->up; sp = sp->up;
} }
return;
ERROR:
dstring_clearstr (cbuf->buf); dstring_clearstr (cbuf->buf);
dstring_clearstr (cbuf->line); dstring_clearstr (cbuf->line);
if (cbuf->down) { if (cbuf->down) {

View file

@ -348,7 +348,7 @@ extern char *server_version; // version of server we connected to
extern double realtime; extern double realtime;
extern struct cbuf_s *cl_cbuf; extern struct cbuf_s *cl_cbuf;
extern struct cbuf_s *cl_stbuf;
void Cvar_Info (struct cvar_s *var); void Cvar_Info (struct cvar_s *var);

View file

@ -119,6 +119,7 @@ static plugin_list_t client_plugin_list[] = {
qboolean noclip_anglehack; // remnant from old quake qboolean noclip_anglehack; // remnant from old quake
cbuf_t *cl_cbuf; cbuf_t *cl_cbuf;
cbuf_t *cl_stbuf;
cvar_t *fs_globalcfg; cvar_t *fs_globalcfg;
cvar_t *fs_usercfg; cvar_t *fs_usercfg;
@ -1515,6 +1516,7 @@ Host_Frame (float time)
// process console commands // process console commands
Cbuf_Execute_Stack (cl_cbuf); Cbuf_Execute_Stack (cl_cbuf);
Cbuf_Execute_Stack (cl_stbuf);
// fetch results from server // fetch results from server
CL_ReadPackets (); CL_ReadPackets ();
@ -1657,6 +1659,7 @@ void
Host_Init (void) Host_Init (void)
{ {
cl_cbuf = Cbuf_New (&id_interp); cl_cbuf = Cbuf_New (&id_interp);
cl_stbuf = Cbuf_New (&id_interp);
Cvar_Init_Hash (); Cvar_Init_Hash ();
Cmd_Init_Hash (); Cmd_Init_Hash ();

View file

@ -1305,12 +1305,12 @@ CL_ParseServerMessage (void)
if (s[strlen (s) - 1] == '\n') { if (s[strlen (s) - 1] == '\n') {
if (stuffbuf && stuffbuf->str[0]) { if (stuffbuf && stuffbuf->str[0]) {
Con_DPrintf ("stufftext: %s%s\n", stuffbuf->str, s); Con_DPrintf ("stufftext: %s%s\n", stuffbuf->str, s);
Cbuf_AddText (cl_cbuf, stuffbuf->str); Cbuf_AddText (cl_stbuf, stuffbuf->str);
dstring_clearstr (stuffbuf); dstring_clearstr (stuffbuf);
} else { } else {
Con_DPrintf ("stufftext: %s\n", s); Con_DPrintf ("stufftext: %s\n", s);
} }
Cbuf_AddText (cl_cbuf, s); Cbuf_AddText (cl_stbuf, s);
} else { } else {
Con_DPrintf ("partial stufftext: %s\n", s); Con_DPrintf ("partial stufftext: %s\n", s);
if (!stuffbuf) if (!stuffbuf)
@ -1325,7 +1325,7 @@ CL_ParseServerMessage (void)
case svc_serverdata: case svc_serverdata:
// make sure any stuffed commands are done // make sure any stuffed commands are done
Cbuf_Execute (cl_cbuf); Cbuf_Execute_Stack (cl_stbuf);
CL_ParseServerData (); CL_ParseServerData ();
vid.recalc_refdef = true; // leave full screen intermission vid.recalc_refdef = true; // leave full screen intermission
break; break;