From cf04b5ed01d7f90329c36b87d8b2bf7d170ad7b3 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sat, 11 Aug 2012 17:35:55 +0200 Subject: [PATCH] Need to keep prog->entities up to date when spawning entities --- exec.c | 2 ++ execloop.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 363fb44..835217c 100644 --- a/exec.c +++ b/exec.c @@ -130,6 +130,7 @@ qc_program* prog_load(const char *filename) goto error; } } + prog->entities = 1; return prog; @@ -226,6 +227,7 @@ qcint prog_spawn_entity(qc_program *prog) printf("Failed to allocate entity\n"); return 0; } + prog->entities++; for (i = 0; i < prog->entityfields; ++i) { if (!qc_program_entitydata_add(prog, 0)) { printf("Failed to allocate entity\n"); diff --git a/execloop.h b/execloop.h index 45494af..2929c2d 100644 --- a/execloop.h +++ b/execloop.h @@ -232,7 +232,7 @@ case INSTR_ADDRESS: if (OPA->edict < 0 || OPA->edict >= prog->entities) { - PRVM_ERROR ("%s Progs attempted to address an out of bounds edict number", PRVM_NAME); + PRVM_ERROR ("%s Progs attempted to address an out of bounds edict number %i", PRVM_NAME, OPA->edict); goto cleanup; } if ((unsigned int)(OPB->_int) >= (unsigned int)(prog->entityfields)) -- 2.39.2