diff options
Diffstat (limited to 'code/botlib/be_ai_weight.c')
-rw-r--r-- | code/botlib/be_ai_weight.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/code/botlib/be_ai_weight.c b/code/botlib/be_ai_weight.c index 72ef812..17216ab 100644 --- a/code/botlib/be_ai_weight.c +++ b/code/botlib/be_ai_weight.c @@ -64,13 +64,20 @@ int ReadValue(source_t *source, float *value) if (!strcmp(token.string, "-")) { SourceWarning(source, "negative value set to zero\n"); - if (!PC_ExpectTokenType(source, TT_NUMBER, 0, &token)) return qfalse; - } //end if + + if(!PC_ExpectAnyToken(source, &token)) + { + SourceError(source, "Missing return value\n"); + return qfalse; + } + } + if (token.type != TT_NUMBER) { SourceError(source, "invalid return value %s\n", token.string); return qfalse; - } //end if + } + *value = token.floatvalue; return qtrue; } //end of the function ReadValue |