Need to keep prog->entities up to date when spawning entities

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-11 17:35:55 +02:00
parent 919d73b0a0
commit cf04b5ed01
2 changed files with 3 additions and 1 deletions

2
exec.c
View file

@ -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");

View file

@ -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))