[gamecode] Replace lost parameter auto-reset

rcallN messes with the progs parameter pointers and not resetting them
can cause incorrect data to be copied into the called function.
This commit is contained in:
Bill Currie 2020-03-11 19:38:50 +09:00
parent afd31ed292
commit 023a920a51

View file

@ -199,6 +199,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
if (pr->pr_params[i] != pr->pr_real_params[i]) { if (pr->pr_params[i] != pr->pr_real_params[i]) {
copy_param (pr->pr_real_params[i], pr->pr_params[i], copy_param (pr->pr_real_params[i], pr->pr_params[i],
f->parm_size[i].size); f->parm_size[i].size);
pr->pr_params[i] = pr->pr_real_params[i];
} }
} }
} else if (f->numparms < 0) { } else if (f->numparms < 0) {
@ -210,6 +211,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
if (pr->pr_params[i] != pr->pr_real_params[i]) { if (pr->pr_params[i] != pr->pr_real_params[i]) {
copy_param (pr->pr_real_params[i], pr->pr_params[i], copy_param (pr->pr_real_params[i], pr->pr_params[i],
f->parm_size[i].size); f->parm_size[i].size);
pr->pr_params[i] = pr->pr_real_params[i];
} }
} }
dparmsize_t parmsize = { pr->pr_param_size, pr->pr_param_alignment }; dparmsize_t parmsize = { pr->pr_param_size, pr->pr_param_alignment };
@ -221,6 +223,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
if (pr->pr_params[i] != pr->pr_real_params[i]) { if (pr->pr_params[i] != pr->pr_real_params[i]) {
copy_param (pr->pr_real_params[i], pr->pr_params[i], copy_param (pr->pr_real_params[i], pr->pr_params[i],
parmsize.size); parmsize.size);
pr->pr_params[i] = pr->pr_real_params[i];
} }
} }
} }