retval bugfix

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1538 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-12-30 14:10:37 +00:00
parent f3bc7a5367
commit 3f32ce711f
+6 -2
View File
@@ -153,7 +153,11 @@ char *parseexp(const char *&p, int right) // parse any nested set of
else if(!c) { p--; conoutf("missing \"%c\"", right); return NULL; }
}
char *s = newstring(word, p-word-1);
if(left=='(') s = exchangestr(s, executeret(s)); // evaluate () exps directly, and substitute result
if(left=='(')
{
char *ret = executeret(s);
s = exchangestr(s, ret ? ret : newstring("")); // evaluate () exps directly, and substitute result
}
return s;
}
@@ -226,7 +230,7 @@ char *executeret(const char *p) // all evaluation hap
const int MAXWORDS = 25; // limit, remove
char *w[MAXWORDS];
char *retval = NULL;
#define setretval(v) { char *rv = v; if(rv) retval = rv; else retval = newstring(""); commandret = NULL; }
#define setretval(v) { char *rv = v; if(rv) retval = rv; commandret = NULL; }
for(bool cont = true; cont;) // for each ; seperated statement
{
int numargs = MAXWORDS;