From: Wolfgang (Blub) Bumiller Date: Sat, 11 Aug 2012 15:35:55 +0000 (+0200) Subject: Need to keep prog->entities up to date when spawning entities X-Git-Tag: 0.1-rc1~349^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cf04b5ed01d7f90329c36b87d8b2bf7d170ad7b3;p=xonotic%2Fgmqcc.git Need to keep prog->entities up to date when spawning entities --- 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))