]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Need to keep prog->entities up to date when spawning entities
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 11 Aug 2012 15:35:55 +0000 (17:35 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 11 Aug 2012 15:35:55 +0000 (17:35 +0200)
exec.c
execloop.h

diff --git a/exec.c b/exec.c
index 363fb44049bb229279a0befb754bd00306f5ad52..835217cf2ef49c87b5f739ec8237a4a05f799625 100644 (file)
--- 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");
index 45494af9e2e5a175677d99cfcee132edccfec99e..2929c2d6a501d51d7a6f7246ee86540ab99cefd6 100644 (file)
                        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))