From 2278f5e4948f49f6ac64068b72e0e5dd4588166f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 13 Jun 2021 22:13:47 +0900 Subject: [PATCH] [gamecode] Make def type when indexing size Fixes #12 However, this is a bit of a band-aid in that the code for global defs seems redundant (there is very similar code a little above that is always executed) and the code for field defs should probably be executed unconditionally: I suspect the problem fixed by d5454faeb76940253c78ed108e2e0647dfb04af7 still shows with game coded compiled with recent versions of the compiler, I just haven't tested any. --- libs/gamecode/pr_load.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/gamecode/pr_load.c b/libs/gamecode/pr_load.c index 2bca49575..93a69e17d 100644 --- a/libs/gamecode/pr_load.c +++ b/libs/gamecode/pr_load.c @@ -257,7 +257,7 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size) pr->pr_statements[i].c = LittleShort (pr->pr_statements[i].c); } - for (i = 0; i < (size_t) pr->progs->numfunctions; i++) { + for (i = 0; i < pr->progs->numfunctions; i++) { pr->pr_functions[i].first_statement = LittleLong (pr->pr_functions[i].first_statement); pr->pr_functions[i].parm_start = @@ -328,11 +328,11 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size) pr_def_t *def; for (def = pr->pr_globaldefs, i = 0; i < pr->progs->numglobaldefs; i++, def++) { - def->size = pr_type_size[def->type]; + def->size = pr_type_size[def->type & ~DEF_SAVEGLOBAL]; } for (def = pr->pr_fielddefs, i = 0; i < pr->progs->numfielddefs; i++, def++) { - def->size = pr_type_size[def->type]; + def->size = pr_type_size[def->type & ~DEF_SAVEGLOBAL]; } } pr->pr_trace = 0;