Allow reconstructed builtins to be found by name.

Certain versions of qcc (fteqcc comes to mind :P) strip the names from
builtin functions. This breaks saved games that happen to have a builtin
function in a saved function variable. The earlier builtin name
reconstruction patch happened to fix the writing of save games for such
progs, and this one fixes the reading.
This commit is contained in:
Bill Currie 2012-07-20 16:17:26 +09:00
parent 1bc2080bd3
commit 106257d6e9
2 changed files with 5 additions and 2 deletions

View file

@ -208,8 +208,10 @@ PR_RelocateBuiltins (progs_t *pr)
bi_name, -desc->first_statement);
proc = bi_no_function;
}
if (!desc->s_name && bi)
if (!desc->s_name && bi) {
desc->s_name = PR_SetString (pr, bi->name);
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
}
func->first_statement = desc->first_statement;
func->func = proc;
}

View file

@ -252,7 +252,8 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size, int max_edicts, int zone)
pr->pr_functions[i].numparms =
LittleLong (pr->pr_functions[i].numparms);
pr->pr_functions[i].locals = LittleLong (pr->pr_functions[i].locals);
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
if (pr->pr_functions[i].s_name)
Hash_Add (pr->function_hash, &pr->pr_functions[i]);
}
for (i = 0; i < pr->progs->numglobaldefs; i++) {