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)
return;
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->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
Sys_Printf("Warning: unwanted return value discarded.\n"); // Not a serious error
else {
@ -395,9 +396,7 @@ GIB_For_f (void)
ifs = " \n\r\t";
dstring_append (GIB_DATA(sub)->loop_data, ifs, strlen(ifs)+1);
// Store pointers to data
ll = GIB_DATA(sub)->loop_data->str;
while (isspace ((byte) *ll))
ll++;
for (ll = GIB_DATA(sub)->loop_data->str; *ll && strchr (ifs, *ll); ll++);
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_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);
thread = GIB_Thread_Find (id);
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;
}
for (cur = thread->cbuf; cur; cur = cur->down) {

View file

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

View file

@ -348,7 +348,7 @@ extern char *server_version; // version of server we connected to
extern double realtime;
extern struct cbuf_s *cl_cbuf;
extern struct cbuf_s *cl_stbuf;
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
cbuf_t *cl_cbuf;
cbuf_t *cl_stbuf;
cvar_t *fs_globalcfg;
cvar_t *fs_usercfg;
@ -1515,6 +1516,7 @@ Host_Frame (float time)
// process console commands
Cbuf_Execute_Stack (cl_cbuf);
Cbuf_Execute_Stack (cl_stbuf);
// fetch results from server
CL_ReadPackets ();
@ -1657,6 +1659,7 @@ void
Host_Init (void)
{
cl_cbuf = Cbuf_New (&id_interp);
cl_stbuf = Cbuf_New (&id_interp);
Cvar_Init_Hash ();
Cmd_Init_Hash ();

View file

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