From 31215e5b06dd8323ec67472497e0e79f85b93e87 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 18 Sep 2006 22:58:42 +0000 Subject: [PATCH] Raised the runaway loop limit. perhaps a little too high now, but nexuiz's menus require it. Improved debugging and stuff, so you can assign functions to variables in the debugger. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2393 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/pr_exec.c | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/engine/qclib/pr_exec.c b/engine/qclib/pr_exec.c index 999dfa536..b46ed2a00 100644 --- a/engine/qclib/pr_exec.c +++ b/engine/qclib/pr_exec.c @@ -487,26 +487,39 @@ char *EvaluateDebugString(progfuncs_t *progfuncs, char *key) } *(int *)val = G_INT(fdef->ofs); break; -/* + case ev_function: - if (s[1]==':'&&s[2]=='\0') { - *(func_t *)val = 0; - return true; + dfunction_t *func; + int i; + int progsnum = -1; + char *s = assignment; + if (s[0] && s[1] == ':') + { + progsnum = atoi(s); + s+=2; + } + else if (s[0] && s[1] && s[2] == ':') + { + progsnum = atoi(s); + s+=3; + } + + func = ED_FindFunction (progfuncs, s, &i, progsnum); + if (!func) + { + assignment[-1] = '='; + return va("Can't find function %s\n", s); + } + *(func_t *)val = (func - pr_progstate[i].functions) | (i<<24); } - func = ED_FindFunction (assignment, &i, -1); - if (!func) - { - printf ("Can't find function %s\n", assignment); - return false; - } - *(func_t *)val = (func - pr_progstate[i].functions) | (i<<24); break; -*/ + default: break; } + assignment[-1] = '='; } strcpy(buf, PR_ValueString(progfuncs, def->type, val)); @@ -749,8 +762,9 @@ static char *lastfile = 0; } else if (f) //annoying. { - if (externs->useeditor) - externs->useeditor(progfuncs, f->s_file+progfuncs->stringtable, -1, 0, NULL); + if (*(f->s_file+progfuncs->stringtable)) //if we can't get the filename, then it was stripped, and debugging it like this is useless + if (externs->useeditor) + externs->useeditor(progfuncs, f->s_file+progfuncs->stringtable, -1, 0, NULL); return statement; } @@ -782,7 +796,7 @@ void PR_ExecuteCode (progfuncs_t *progfuncs, int s) int fnum = pr_xfunction - pr_functions; - runaway = 1000000; + runaway = 100000000; prinst->continuestatement = -1;