report all bad builtins rather than just the first

This commit is contained in:
Bill Currie 2004-01-05 08:52:20 +00:00
parent 595280decb
commit 0ddb5eb822

View file

@ -112,6 +112,7 @@ int
PR_RelocateBuiltins (progs_t *pr) PR_RelocateBuiltins (progs_t *pr)
{ {
int i, ind; int i, ind;
int bad = 0;
dfunction_t *func; dfunction_t *func;
builtin_t *bi; builtin_t *bi;
const char *bi_name; const char *bi_name;
@ -122,23 +123,26 @@ PR_RelocateBuiltins (progs_t *pr)
if (func->first_statement > 0) if (func->first_statement > 0)
continue; continue;
if (!func->first_statement) {
bi_name = PR_GetString (pr, func->s_name); bi_name = PR_GetString (pr, func->s_name);
if (!func->first_statement) {
bi = PR_FindBuiltin (pr, bi_name); bi = PR_FindBuiltin (pr, bi_name);
if (!bi) { if (!bi) {
Sys_Printf ("PR_RelocateBuiltins: %s: undefined builtin %s\n", Sys_Printf ("PR_RelocateBuiltins: %s: undefined builtin %s\n",
pr->progs_name, bi_name); pr->progs_name, bi_name);
return 0; bad = 1;
continue;
} }
func->first_statement = -bi->binum; func->first_statement = -bi->binum;
} }
ind = -func->first_statement; ind = -func->first_statement;
if (ind >= pr->numbuiltins || !(bi = pr->builtins[ind]) || !bi->proc) { if (ind >= pr->numbuiltins || !(bi = pr->builtins[ind]) || !bi->proc) {
Sys_Printf ("Bad builtin call number: %d\n", ind); Sys_Printf ("Bad builtin call number: %s = #%d\n", bi_name, ind);
return 0; bad = 1;
continue;
} }
((bfunction_t *) func)->func = bi->proc; ((bfunction_t *) func)->func = bi->proc;
} }
return 1; return !bad;
} }