edict: Move free and freetime into prvm_edict_t itself
authorCloudwalk <cloudwalk009@gmail.com>
Wed, 21 Jul 2021 19:57:40 +0000 (15:57 -0400)
committerCloudwalk <cloudwalk009@gmail.com>
Wed, 21 Jul 2021 19:57:40 +0000 (15:57 -0400)
17 files changed:
cl_collision.c
clvm_cmds.c
csprogs.c
gl_rmain.c
menu.c
progs.h
progsvm.h
prvm_cmds.c
prvm_edict.c
sv_ccmds.c
sv_main.c
sv_phys.c
sv_save.c
sv_send.c
sv_user.c
svvm_cmds.c
world.c

index 2cd3a619a2bf56588225cf492eeeaeea7c7becdc..97303e7a92a9775678e2b5b5c7eefaaeba384cb2 100644 (file)
@@ -104,7 +104,7 @@ model_t *CL_GetModelByIndex(int modelindex)
 model_t *CL_GetModelFromEdict(prvm_edict_t *ed)
 {
        prvm_prog_t *prog = CLVM_prog;
-       if (!ed || ed->priv.server->free)
+       if (!ed || ed->free)
                return NULL;
        return CL_GetModelByIndex((int)PRVM_clientedictfloat(ed, modelindex));
 }
@@ -117,7 +117,7 @@ void CL_LinkEdict(prvm_edict_t *ent)
        if (ent == prog->edicts)
                return;         // don't add the world
 
-       if (ent->priv.server->free)
+       if (ent->free)
                return;
 
        // set the abs box
index 23c438f6250f1139cbcba1373de3a408eeaa8428..cbb31b42eccf63961cf031b02573968b71cda183 100644 (file)
@@ -50,7 +50,7 @@ static void VM_CL_setorigin (prvm_prog_t *prog)
                VM_Warning(prog, "setorigin: can not modify world entity\n");
                return;
        }
-       if (e->priv.required->free)
+       if (e->free)
        {
                VM_Warning(prog, "setorigin: can not modify free entity\n");
                return;
@@ -151,7 +151,7 @@ static void VM_CL_setsize (prvm_prog_t *prog)
                VM_Warning(prog, "setsize: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setsize: can not modify free entity\n");
                return;
@@ -537,7 +537,7 @@ static void VM_CL_droptofloor (prvm_prog_t *prog)
                VM_Warning(prog, "droptofloor: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "droptofloor: can not modify free entity\n");
                return;
@@ -761,14 +761,14 @@ static void VM_CL_R_AddEntities (prvm_prog_t *prog)
                // so we can easily check if CSQC entity #edictnum is currently drawn
                cl.csqcrenderentities[i].entitynumber = 0;
                ed = &prog->edicts[i];
-               if(ed->priv.required->free)
+               if(ed->free)
                        continue;
                CSQC_Think(ed);
-               if(ed->priv.required->free)
+               if(ed->free)
                        continue;
                // note that for RF_USEAXIS entities, Predraw sets v_forward/v_right/v_up globals that are read by CSQC_AddRenderEdict
                CSQC_Predraw(ed);
-               if(ed->priv.required->free)
+               if(ed->free)
                        continue;
                if(!((int)PRVM_clientedictfloat(ed, drawmask) & drawmask))
                        continue;
@@ -2523,7 +2523,7 @@ static void VM_CL_makestatic (prvm_prog_t *prog)
                VM_Warning(prog, "makestatic: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "makestatic: can not modify free entity\n");
                return;
@@ -2619,7 +2619,7 @@ static void VM_CL_copyentity (prvm_prog_t *prog)
                VM_Warning(prog, "copyentity: can not read world entity\n");
                return;
        }
-       if (in->priv.server->free)
+       if (in->free)
        {
                VM_Warning(prog, "copyentity: can not read free entity\n");
                return;
@@ -2630,7 +2630,7 @@ static void VM_CL_copyentity (prvm_prog_t *prog)
                VM_Warning(prog, "copyentity: can not modify world entity\n");
                return;
        }
-       if (out->priv.server->free)
+       if (out->free)
        {
                VM_Warning(prog, "copyentity: can not modify free entity\n");
                return;
@@ -3089,7 +3089,7 @@ static void VM_CL_setattachment (prvm_prog_t *prog)
                VM_Warning(prog, "setattachment: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setattachment: can not modify free entity\n");
                return;
@@ -3229,7 +3229,7 @@ int CL_GetTagMatrix (prvm_prog_t *prog, matrix4x4_t *out, prvm_edict_t *ent, int
 
        if (ent == prog->edicts)
                return 1;
-       if (ent->priv.server->free)
+       if (ent->free)
                return 2;
 
        model = CL_GetModelFromEdict(ent);
@@ -3321,7 +3321,7 @@ static void VM_CL_gettagindex (prvm_prog_t *prog)
                VM_Warning(prog, "VM_CL_gettagindex(entity #%i): can't affect world entity\n", PRVM_NUM_FOR_EDICT(ent));
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "VM_CL_gettagindex(entity #%i): can't affect free entity\n", PRVM_NUM_FOR_EDICT(ent));
                return;
@@ -4416,7 +4416,7 @@ static void VM_CL_walkmove (prvm_prog_t *prog)
                VM_Warning(prog, "walkmove: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "walkmove: can not modify free entity\n");
                return;
@@ -4487,7 +4487,7 @@ static void VM_CL_checkpvs (prvm_prog_t *prog)
        VectorCopy(PRVM_G_VECTOR(OFS_PARM0), viewpos);
        viewee = PRVM_G_EDICT(OFS_PARM1);
 
-       if(viewee->priv.required->free)
+       if(viewee->free)
        {
                VM_Warning(prog, "checkpvs: can not check free entity\n");
                PRVM_G_FLOAT(OFS_RETURN) = 4;
index bd30f4667ad4c214082500ab87f833cb7a7d1997..f74a206b09e1df120e153d436d3049c8668cae82 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -883,7 +883,7 @@ static void CLVM_end_increase_edicts(prvm_prog_t *prog)
 
        // link every entity except world
        for (i = 1, ent = prog->edicts;i < prog->num_edicts;i++, ent++)
-               if (!ent->priv.server->free && !VectorCompare(PRVM_clientedictvector(ent, absmin), PRVM_clientedictvector(ent, absmax)))
+               if (!ent->free && !VectorCompare(PRVM_clientedictvector(ent, absmin), PRVM_clientedictvector(ent, absmax)))
                        CL_LinkEdict(ent);
 }
 
@@ -919,7 +919,7 @@ static void CLVM_count_edicts(prvm_prog_t *prog)
        for (i=0 ; i<prog->num_edicts ; i++)
        {
                ent = PRVM_EDICT_NUM(i);
-               if (ent->priv.server->free)
+               if (ent->free)
                        continue;
                active++;
                if (PRVM_clientedictfloat(ent, solid))
@@ -1191,7 +1191,7 @@ qbool CL_VM_GetEntitySoundOrigin(int entnum, vec3_t out)
 
        ed = PRVM_EDICT_NUM(entnum - MAX_EDICTS);
 
-       if(!ed->priv.required->free)
+       if(!ed->free)
        {
                mod = CL_GetModelFromEdict(ed);
                VectorCopy(PRVM_clientedictvector(ed, origin), out);
index 3efa46d2042499b24b106bef687b5505d42512fc..e5516ded985c28c7e3a5ed5728e96ffda776f921 100644 (file)
@@ -6123,7 +6123,7 @@ static void R_DrawEntityBBoxes(prvm_prog_t *prog)
        for (i = 0; i < prog->num_edicts; i++)
        {
                edict = PRVM_EDICT_NUM(i);
-               if (edict->priv.server->free)
+               if (edict->free)
                        continue;
                // exclude the following for now, as they don't live in world coordinate space and can't be solid:
                if (PRVM_gameedictedict(edict, tag_entity) != 0)
diff --git a/menu.c b/menu.c
index 2dc43ec921834070a93bf383c764274a09b0f2cc..ce154097118e91e32c8aef969f53f0c789caa89a 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -5269,7 +5269,7 @@ static void MVM_count_edicts(prvm_prog_t *prog)
        for (i=0 ; i<prog->num_edicts ; i++)
        {
                ent = PRVM_EDICT_NUM(i);
-               if (ent->priv.required->free)
+               if (ent->free)
                        continue;
                active++;
        }
diff --git a/progs.h b/progs.h
index fd8d109c3ee65fa1ddebba405e2c21e445f66264..0756c35b88b428ba26fc870323ad80c2df72cb85 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -67,15 +67,11 @@ typedef struct edict_odefunc_s
 
 typedef struct edict_engineprivate_s
 {
-       // true if this edict is unused
-       qbool free;
-       // sv.time when the object was freed (to prevent early reuse which could
-       // mess up client interpolation or obscure severe QuakeC bugs)
-       double freetime;
        // mark for the leak detector
        int mark;
        // place in the code where it was allocated (for the leak detector)
        const char *allocation_origin;
+
        // initially false to prevent projectiles from moving on their first frame
        // (even if they were spawned by an synchronous client think)
        qbool move;
index ea08900d2d1ae0d35d43a3db91471cb6d6e932be..92ead5dc772a8393f7a7470fee8cec35be11a78c 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -74,23 +74,27 @@ typedef struct prvm_required_field_s
        const char *name;
 } prvm_required_field_t;
 
-
+#define PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN -1
+#define PRVM_EDICT_MARK_SETORIGIN_CAUGHT -2
 // AK: I dont call it engine private cause it doesnt really belongs to the engine
 //     it belongs to prvm.
 typedef struct prvm_edict_private_s
 {
-       qbool free;
-       double freetime; // realtime of last change to "free" (i.e. also set on allocation)
-       int mark; // used during leaktest (0 = unref, >0 = referenced); special values during server physics:
-#define PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN -1
-#define PRVM_EDICT_MARK_SETORIGIN_CAUGHT -2
+       // mark for the leak detector
+       int mark;
+       // place in the code where it was allocated (for the leak detector)
        const char *allocation_origin;
 } prvm_edict_private_t;
 
 typedef struct prvm_edict_s
 {
+       // true if this edict is unused
+       qbool free;
+       // sv.time when the object was freed (to prevent early reuse which could
+       // mess up client interpolation or obscure severe QuakeC bugs)
+       double freetime;
+
        // engine-private fields (stored in dynamically resized array)
-       //edict_engineprivate_t *e;
        union
        {
                prvm_edict_private_t *required;
index 07adabf396246c2a6ec3b0e140ff3d389b1813c7..269aac0091813f7b30daece4aceb4e0630ff1b5c 100644 (file)
@@ -930,7 +930,7 @@ void VM_ftoe(prvm_prog_t *prog)
        VM_SAFEPARMCOUNT(1, VM_ftoe);
 
        ent = (prvm_int_t)PRVM_G_FLOAT(OFS_PARM0);
-       if (ent < 0 || ent >= prog->max_edicts || PRVM_PROG_TO_EDICT(ent)->priv.required->free)
+       if (ent < 0 || ent >= prog->max_edicts || PRVM_PROG_TO_EDICT(ent)->free)
                ent = 0; // return world instead of a free or invalid entity
 
        PRVM_G_INT(OFS_RETURN) = ent;
@@ -1033,7 +1033,7 @@ void VM_remove(prvm_prog_t *prog)
                if (developer.integer > 0)
                        VM_Warning(prog, "VM_remove: tried to remove the null entity or a reserved entity!\n" );
        }
-       else if( ed->priv.required->free )
+       else if( ed->free )
        {
                if (developer.integer > 0)
                        VM_Warning(prog, "VM_remove: tried to remove an already freed entity!\n" );
@@ -1071,7 +1071,7 @@ void VM_find(prvm_prog_t *prog)
        {
                prog->xfunction->builtinsprofile++;
                ed = PRVM_EDICT_NUM(e);
-               if (ed->priv.required->free)
+               if (ed->free)
                        continue;
                t = PRVM_E_STRING(ed,f);
                if (!t)
@@ -1112,7 +1112,7 @@ void VM_findfloat(prvm_prog_t *prog)
        {
                prog->xfunction->builtinsprofile++;
                ed = PRVM_EDICT_NUM(e);
-               if (ed->priv.required->free)
+               if (ed->free)
                        continue;
                if (PRVM_E_FLOAT(ed,f) == s)
                {
@@ -1163,7 +1163,7 @@ void VM_findchain(prvm_prog_t *prog)
        for (i = 1;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
        {
                prog->xfunction->builtinsprofile++;
-               if (ent->priv.required->free)
+               if (ent->free)
                        continue;
                t = PRVM_E_STRING(ent,f);
                if (!t)
@@ -1214,7 +1214,7 @@ void VM_findchainfloat(prvm_prog_t *prog)
        for (i = 1;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
        {
                prog->xfunction->builtinsprofile++;
-               if (ent->priv.required->free)
+               if (ent->free)
                        continue;
                if (PRVM_E_FLOAT(ent,f) != s)
                        continue;
@@ -1252,7 +1252,7 @@ void VM_findflags(prvm_prog_t *prog)
        {
                prog->xfunction->builtinsprofile++;
                ed = PRVM_EDICT_NUM(e);
-               if (ed->priv.required->free)
+               if (ed->free)
                        continue;
                if (!PRVM_E_FLOAT(ed,f))
                        continue;
@@ -1300,7 +1300,7 @@ void VM_findchainflags(prvm_prog_t *prog)
        for (i = 1;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
        {
                prog->xfunction->builtinsprofile++;
-               if (ent->priv.required->free)
+               if (ent->free)
                        continue;
                if (!PRVM_E_FLOAT(ent,f))
                        continue;
@@ -1514,7 +1514,7 @@ void VM_nextent(prvm_prog_t *prog)
                        return;
                }
                ent = PRVM_EDICT_NUM(i);
-               if (!ent->priv.required->free)
+               if (!ent->free)
                {
                        VM_RETURN_EDICT(ent);
                        return;
@@ -2037,7 +2037,7 @@ void VM_writetofile(prvm_prog_t *prog)
        }
 
        ent = PRVM_G_EDICT(OFS_PARM1);
-       if(ent->priv.required->free)
+       if(ent->free)
        {
                VM_Warning(prog, "VM_writetofile: %s: entity %i is free !\n", prog->name, PRVM_NUM_FOR_EDICT(ent));
                return;
@@ -2138,7 +2138,7 @@ void VM_getentityfieldstring(prvm_prog_t *prog)
        
        // get the entity
        ent = PRVM_G_EDICT(OFS_PARM1);
-       if(ent->priv.required->free)
+       if(ent->free)
        {
                PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, "");
                VM_Warning(prog, "VM_entityfielddata: %s: entity %i is free !\n", prog->name, PRVM_NUM_FOR_EDICT(ent));
@@ -2185,7 +2185,7 @@ void VM_putentityfieldstring(prvm_prog_t *prog)
 
        // get the entity
        ent = PRVM_G_EDICT(OFS_PARM1);
-       if(ent->priv.required->free)
+       if(ent->free)
        {
                VM_Warning(prog, "VM_entityfielddata: %s: entity %i is free !\n", prog->name, PRVM_NUM_FOR_EDICT(ent));
                PRVM_G_FLOAT(OFS_RETURN) = 0.0f;
@@ -2998,7 +2998,7 @@ void VM_parseentitydata(prvm_prog_t *prog)
 
        // get edict and test it
        ent = PRVM_G_EDICT(OFS_PARM0);
-       if (ent->priv.required->free)
+       if (ent->free)
                prog->error_cmd("VM_parseentitydata: %s: Can only set already spawned entities (entity %i is free)!", prog->name, PRVM_NUM_FOR_EDICT(ent));
 
        data = PRVM_G_STRING(OFS_PARM1);
@@ -4678,7 +4678,7 @@ void VM_changeyaw (prvm_prog_t *prog)
                VM_Warning(prog, "changeyaw: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "changeyaw: can not modify free entity\n");
                return;
@@ -4734,7 +4734,7 @@ void VM_changepitch (prvm_prog_t *prog)
                VM_Warning(prog, "changepitch: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "changepitch: can not modify free entity\n");
                return;
@@ -5136,7 +5136,7 @@ void VM_digest_hex(prvm_prog_t *prog)
 void VM_wasfreed (prvm_prog_t *prog)
 {
        VM_SAFEPARMCOUNT(1, VM_wasfreed);
-       PRVM_G_FLOAT(OFS_RETURN) = PRVM_G_EDICT(OFS_PARM0)->priv.required->free;
+       PRVM_G_FLOAT(OFS_RETURN) = PRVM_G_EDICT(OFS_PARM0)->free;
 }
 
 void VM_SetTraceGlobals(prvm_prog_t *prog, const trace_t *trace)
@@ -6315,7 +6315,7 @@ void VM_getsurfacenearpoint(prvm_prog_t *prog)
        ed = PRVM_G_EDICT(OFS_PARM0);
        VectorCopy(PRVM_G_VECTOR(OFS_PARM1), point);
 
-       if (!ed || ed->priv.server->free)
+       if (!ed || ed->free)
                return;
        model = getmodel(prog, ed);
        if (!model || !model->num_surfaces)
index 3c50397e70a4e324c5d4811758f4500418d6fdfe..78bcdabcc5dcbf3cfce9a7384136290ff8d74326 100644 (file)
@@ -204,8 +204,8 @@ freed and sets the allocation origin.
 void PRVM_ED_ClearEdict(prvm_prog_t *prog, prvm_edict_t *e)
 {
        memset(e->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
-       e->priv.required->free = false;
-       e->priv.required->freetime = host.realtime;
+       e->free = false;
+       e->freetime = host.realtime;
        if(e->priv.required->allocation_origin)
                Mem_Free((char *)e->priv.required->allocation_origin);
        e->priv.required->allocation_origin = PRVM_AllocationOrigin(prog);
@@ -235,15 +235,15 @@ Returns if this particular edict could get allocated by PRVM_ED_Alloc
 */
 qbool PRVM_ED_CanAlloc(prvm_prog_t *prog, prvm_edict_t *e)
 {
-       if(!e->priv.required->free)
+       if(!e->free)
                return false;
        if(prvm_reuseedicts_always_allow == host.realtime)
                return true;
-       if(host.realtime <= e->priv.required->freetime + 0.1 && prvm_reuseedicts_neverinsameframe.integer)
+       if(host.realtime <= e->freetime + 0.1 && prvm_reuseedicts_neverinsameframe.integer)
                return false; // never allow reuse in same frame (causes networking trouble)
-       if(e->priv.required->freetime < prog->starttime + prvm_reuseedicts_startuptime.value)
+       if(e->freetime < prog->starttime + prvm_reuseedicts_startuptime.value)
                return true;
-       if(host.realtime > e->priv.required->freetime + 1)
+       if(host.realtime > e->freetime + 1)
                return true;
        return false; // entity slot still blocked because the entity was freed less than one second ago
 }
@@ -308,8 +308,8 @@ void PRVM_ED_Free(prvm_prog_t *prog, prvm_edict_t *ed)
 
        prog->free_edict(prog, ed);
 
-       ed->priv.required->free = true;
-       ed->priv.required->freetime = host.realtime;
+       ed->free = true;
+       ed->freetime = host.realtime;
        if(ed->priv.required->allocation_origin)
        {
                Mem_Free((char *)ed->priv.required->allocation_origin);
@@ -654,7 +654,7 @@ void PRVM_ED_Print(prvm_prog_t *prog, prvm_edict_t *ed, const char *wildcard_fie
        char    tempstring[MAX_INPUTLINE], tempstring2[260]; // temporary string buffers
        char    valuebuf[MAX_INPUTLINE];
 
-       if (ed->priv.required->free)
+       if (ed->free)
        {
                Con_Printf("%s: FREE\n",prog->name);
                return;
@@ -737,7 +737,7 @@ void PRVM_ED_Write (prvm_prog_t *prog, qfile_t *f, prvm_edict_t *ed)
 
        FS_Print(f, "{\n");
 
-       if (ed->priv.required->free)
+       if (ed->free)
        {
                FS_Print(f, "}\n");
                return;
@@ -1351,8 +1351,8 @@ const char *PRVM_ED_ParseEdict (prvm_prog_t *prog, const char *data, prvm_edict_
        }
 
        if (!init) {
-               ent->priv.required->free = true;
-               ent->priv.required->freetime = host.realtime;
+               ent->free = true;
+               ent->freetime = host.realtime;
        }
 
        return data;
@@ -1379,7 +1379,7 @@ qbool PRVM_ED_CallSpawnFunction(prvm_prog_t *prog, prvm_edict_t *ent, const char
 //
 // immediately call spawn function, but only if there is a self global and a classname
 //
-       if (!ent->priv.required->free)
+       if (!ent->free)
        {
                if (!PRVM_alledictstring(ent, classname))
                {
@@ -1455,7 +1455,7 @@ qbool PRVM_ED_CallSpawnFunction(prvm_prog_t *prog, prvm_edict_t *ent, const char
 
 void PRVM_ED_CallPostspawnFunction (prvm_prog_t *prog, prvm_edict_t *ent)
 {
-       if(!ent->priv.required->free)
+       if(!ent->free)
        if (PRVM_serverfunction(SV_OnEntityPostSpawnFunction))
        {
                // self = ent
@@ -1530,7 +1530,7 @@ void PRVM_ED_LoadFromFile (prvm_prog_t *prog, const char *data)
 
                PRVM_ED_CallPrespawnFunction(prog, ent);
 
-               if(ent->priv.required->free)
+               if(ent->free)
                {
                        inhibited++;
                        continue;
@@ -1544,7 +1544,7 @@ void PRVM_ED_LoadFromFile (prvm_prog_t *prog, const char *data)
                PRVM_ED_CallPostspawnFunction(prog, ent);
 
                spawned++;
-               if (ent->priv.required->free)
+               if (ent->free)
                        died++;
        }
 
@@ -2746,7 +2746,7 @@ static void PRVM_Fields_f(cmd_state_t *cmd)
        for (ednum = 0;ednum < prog->max_edicts;ednum++)
        {
                ed = PRVM_EDICT_NUM(ednum);
-               if (ed->priv.required->free)
+               if (ed->free)
                        continue;
                for (i = 1;i < prog->numfielddefs;i++)
                {
@@ -3446,7 +3446,7 @@ static qbool PRVM_IsStringReferenced(prvm_prog_t *prog, string_t string)
        for(j = 0; j < prog->num_edicts; ++j)
        {
                prvm_edict_t *ed = PRVM_EDICT_NUM(j);
-               if (ed->priv.required->free)
+               if (ed->free)
                        continue;
                for (i=0; i<prog->numfielddefs; ++i)
                {
@@ -3467,7 +3467,7 @@ static qbool PRVM_IsEdictRelevant(prvm_prog_t *prog, prvm_edict_t *edict)
        char vabuf2[1024];
        if(PRVM_NUM_FOR_EDICT(edict) <= prog->reserved_edicts)
                return true; // world or clients
-       if (edict->priv.required->freetime <= prog->inittime)
+       if (edict->freetime <= prog->inittime)
                return true; // created during startup
        if (prog == SVVM_prog)
        {
@@ -3564,7 +3564,7 @@ static void PRVM_MarkReferencedEdicts(prvm_prog_t *prog)
        for(j = 0; j < prog->num_edicts; ++j)
        {
                prvm_edict_t *ed = PRVM_EDICT_NUM(j);
-               if(ed->priv.required->free)
+               if(ed->free)
                        continue;
                ed->priv.required->mark = PRVM_IsEdictRelevant(prog, ed) ? stage : 0;
        }
@@ -3590,7 +3590,7 @@ static void PRVM_MarkReferencedEdicts(prvm_prog_t *prog)
                for(j = 0; j < prog->num_edicts; ++j)
                {
                        prvm_edict_t *ed = PRVM_EDICT_NUM(j);
-                       if(ed->priv.required->free)
+                       if(ed->free)
                                continue;
                        if(ed->priv.required->mark)
                                continue;
@@ -3632,7 +3632,7 @@ void PRVM_LeakTest(prvm_prog_t *prog)
        for(j = 0; j < prog->num_edicts; ++j)
        {
                prvm_edict_t *ed = PRVM_EDICT_NUM(j);
-               if(ed->priv.required->free)
+               if(ed->free)
                        continue;
                if(!ed->priv.required->mark)
                if(ed->priv.required->allocation_origin)
index 659a2815c92c58f5a4e88cdcb0e52d8fb89b8c59..639a3253a42b62b6c580fe80a152b3e3d3b3e4ca 100644 (file)
@@ -1556,7 +1556,7 @@ static void SV_Ent_Remove_f(cmd_state_t *cmd)
                                return;
                }
 
-               if(!ed->priv.required->free)
+               if(!ed->free)
                {
                        print("Removed a \"%s\"\n", PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)));
                        PRVM_ED_ClearEdict(prog, ed);
@@ -1580,7 +1580,7 @@ static void SV_Ent_Remove_All_f(cmd_state_t *cmd)
 
        for (i = 0, rmcount = 0, ed = PRVM_EDICT_NUM(i); i < prog->num_edicts; i++, ed = PRVM_NEXT_EDICT(ed))
        {
-               if(!ed->priv.required->free && !strcmp(PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)), Cmd_Argv(cmd, 1)))
+               if(!ed->free && !strcmp(PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)), Cmd_Argv(cmd, 1)))
                {
                        if(!i)
                        {
index d1c9e71c99085e02cbdc7112d42ef66ffc2b62c7..d103ffe65c1fcba759f7a02d5f76053e2fd863ce 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1556,7 +1556,7 @@ model_t *SV_GetModelFromEdict(prvm_edict_t *ed)
 {
        prvm_prog_t *prog = SVVM_prog;
        int modelindex;
-       if (!ed || ed->priv.server->free)
+       if (!ed || ed->free)
                return NULL;
        modelindex = (int)PRVM_serveredictfloat(ed, modelindex);
        return (modelindex > 0 && modelindex < MAX_MODELS) ? sv.models[modelindex] : NULL;
@@ -1583,7 +1583,7 @@ static void SV_CreateBaseline (void)
                // LadyHavoc: always clear state values, whether the entity is in use or not
                svent->priv.server->baseline = defaultstate;
 
-               if (svent->priv.server->free)
+               if (svent->free)
                        continue;
                if (entnum > svs.maxclients && !PRVM_serveredictfloat(svent, modelindex))
                        continue;
@@ -1937,7 +1937,7 @@ void SV_SpawnServer (const char *map)
        // AK possible hack since num_edicts is still 0
        ent = PRVM_EDICT_NUM(0);
        memset (ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
-       ent->priv.server->free = false;
+       ent->free = false;
        PRVM_serveredictstring(ent, model) = PRVM_SetEngineString(prog, sv.worldname);
        PRVM_serveredictfloat(ent, modelindex) = 1;             // world model
        PRVM_serveredictfloat(ent, solid) = SOLID_BSP;
@@ -2113,7 +2113,7 @@ static void SVVM_end_increase_edicts(prvm_prog_t *prog)
 
        // link every entity except world
        for (i = 1, ent = prog->edicts;i < prog->num_edicts;i++, ent++)
-               if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
+               if (!ent->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                        SV_LinkEdict(ent);
 }
 
@@ -2209,7 +2209,7 @@ static void SVVM_count_edicts(prvm_prog_t *prog)
        for (i=0 ; i<prog->num_edicts ; i++)
        {
                ent = PRVM_EDICT_NUM(i);
-               if (ent->priv.server->free)
+               if (ent->free)
                        continue;
                active++;
                if (PRVM_serveredictfloat(ent, solid))
index a72a7ca6acf5b8a0142c5df48bc506834fb4635c..5633a1d33a5d9c160b964f3b544bd73ec08a83c3 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -689,7 +689,7 @@ int SV_EntitiesInBox(const vec3_t mins, const vec3_t maxs, int maxedicts, prvm_e
                for (edictindex = 1;edictindex < prog->num_edicts;edictindex++)
                {
                        ed = PRVM_EDICT_NUM(edictindex);
-                       if (!ed->priv.required->free && BoxesOverlap(PRVM_serveredictvector(ed, absmin), PRVM_serveredictvector(ed, absmax), paddedmins, paddedmaxs))
+                       if (!ed->free && BoxesOverlap(PRVM_serveredictvector(ed, absmin), PRVM_serveredictvector(ed, absmax), paddedmins, paddedmaxs))
                        {
                                resultedicts[numresultedicts++] = ed;
                                if (numresultedicts == maxedicts)
@@ -734,7 +734,7 @@ void SV_LinkEdict_TouchAreaGrid(prvm_edict_t *ent)
        if (ent == prog->edicts)
                return;         // don't add the world
 
-       if (ent->priv.server->free)
+       if (ent->free)
                return;
 
        if (PRVM_serveredictfloat(ent, solid) == SOLID_NOT)
@@ -811,7 +811,7 @@ void SV_LinkEdict (prvm_edict_t *ent)
        if (ent == prog->edicts)
                return;         // don't add the world
 
-       if (ent->priv.server->free)
+       if (ent->free)
                return;
 
        modelindex = (int)PRVM_serveredictfloat(ent, modelindex);
@@ -1089,7 +1089,7 @@ static qbool SV_RunThink (prvm_edict_t *ent)
        if (PRVM_serveredictfloat(ent, nextthink) <= 0 || PRVM_serveredictfloat(ent, nextthink) > sv.time + sv.frametime)
                return true;
 
-       for (iterations = 0;iterations < 128  && !ent->priv.server->free;iterations++)
+       for (iterations = 0;iterations < 128  && !ent->free;iterations++)
        {
                PRVM_serverglobalfloat(time) = max(sv.time, PRVM_serveredictfloat(ent, nextthink));
                PRVM_serveredictfloat(ent, nextthink) = 0;
@@ -1103,7 +1103,7 @@ static qbool SV_RunThink (prvm_edict_t *ent)
                if (PRVM_serveredictfloat(ent, nextthink) <= PRVM_serverglobalfloat(time) || PRVM_serveredictfloat(ent, nextthink) > sv.time + sv.frametime || !sv_gameplayfix_multiplethinksperframe.integer)
                        break;
        }
-       return !ent->priv.server->free;
+       return !ent->free;
 }
 
 /*
@@ -1126,7 +1126,7 @@ static void SV_Impact (prvm_edict_t *e1, trace_t *trace)
 
        VM_SetTraceGlobals(prog, trace);
 
-       if (!e1->priv.server->free && !e2->priv.server->free && PRVM_serveredictfunction(e1, touch) && PRVM_serveredictfloat(e1, solid) != SOLID_NOT)
+       if (!e1->free && !e2->free && PRVM_serveredictfunction(e1, touch) && PRVM_serveredictfloat(e1, solid) != SOLID_NOT)
        {
                PRVM_serverglobalfloat(time) = sv.time;
                PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(e1);
@@ -1134,7 +1134,7 @@ static void SV_Impact (prvm_edict_t *e1, trace_t *trace)
                prog->ExecuteProgram(prog, PRVM_serveredictfunction(e1, touch), "QC function self.touch is missing");
        }
 
-       if (!e1->priv.server->free && !e2->priv.server->free && PRVM_serveredictfunction(e2, touch) && PRVM_serveredictfloat(e2, solid) != SOLID_NOT)
+       if (!e1->free && !e2->free && PRVM_serveredictfunction(e2, touch) && PRVM_serveredictfloat(e2, solid) != SOLID_NOT)
        {
                PRVM_serverglobalfloat(time) = sv.time;
                PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(e2);
@@ -2626,7 +2626,7 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                        // we can trust FL_ONGROUND if groundentity is world because it never moves
                        return;
                }
-               else if (ent->priv.server->suspendedinairflag && groundentity->priv.server->free)
+               else if (ent->priv.server->suspendedinairflag && groundentity->free)
                {
                        // if ent was supported by a brush model on previous frame,
                        // and groundentity is now freed, set groundentity to 0 (world)
@@ -2659,7 +2659,7 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                VectorScale(PRVM_serveredictvector(ent, velocity), movetime, move);
                if(!SV_PushEntity(&trace, ent, move, true))
                        return; // teleported
-               if (ent->priv.server->free)
+               if (ent->free)
                        return;
                if (trace.bmodelstartsolid && sv_gameplayfix_unstickentities.integer)
                {
@@ -2667,7 +2667,7 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                        SV_UnstickEntity(ent);
                        if(!SV_PushEntity(&trace, ent, move, true))
                                return; // teleported
-                       if (ent->priv.server->free)
+                       if (ent->free)
                                return;
                }
                if (trace.fraction == 1)
@@ -3186,22 +3186,22 @@ void SV_Physics (void)
        // if force_retouch, relink all the entities
        if (PRVM_serverglobalfloat(force_retouch) > 0)
                for (i = 1, ent = PRVM_EDICT_NUM(i);i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
-                       if (!ent->priv.server->free)
+                       if (!ent->free)
                                SV_LinkEdict_TouchAreaGrid(ent); // force retouch even for stationary
 
        if (sv_gameplayfix_consistentplayerprethink.integer)
        {
                // run physics on the client entities in 3 stages
                for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
-                       if (!ent->priv.server->free)
+                       if (!ent->free)
                                SV_Physics_ClientEntity_PreThink(ent);
 
                for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
-                       if (!ent->priv.server->free)
+                       if (!ent->free)
                                SV_Physics_ClientEntity(ent);
 
                for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
-                       if (!ent->priv.server->free)
+                       if (!ent->free)
                                SV_Physics_ClientEntity_PostThink(ent);
        }
        else
@@ -3209,7 +3209,7 @@ void SV_Physics (void)
                // run physics on the client entities
                for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
                {
-                       if (!ent->priv.server->free)
+                       if (!ent->free)
                        {
                                SV_Physics_ClientEntity_PreThink(ent);
                                SV_Physics_ClientEntity(ent);
@@ -3222,13 +3222,13 @@ void SV_Physics (void)
        if (!sv_freezenonclients.integer)
        {
                for (;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
-                       if (!ent->priv.server->free)
+                       if (!ent->free)
                                SV_Physics_Entity(ent);
                // make a second pass to see if any ents spawned this frame and make
                // sure they run their move/think
                if (sv_gameplayfix_delayprojectiles.integer < 0)
                        for (i = svs.maxclients + 1, ent = PRVM_EDICT_NUM(i);i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
-                               if (!ent->priv.server->move && !ent->priv.server->free)
+                               if (!ent->priv.server->move && !ent->free)
                                        SV_Physics_Entity(ent);
        }
 
index 799a0d8a08b2aa450e729dd8fa081e89dff3c1fb..926c90c95da913cef885e920dea6f377c65c697d 100644 (file)
--- a/sv_save.c
+++ b/sv_save.c
@@ -434,7 +434,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                                PRVM_MEM_IncreaseEdicts(prog);
                        ent = PRVM_EDICT_NUM(entnum);
                        memset(ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
-                       ent->priv.server->free = false;
+                       ent->free = false;
 
                        if(developer_entityparsing.integer)
                                Con_Printf("SV_Loadgame_f: loading edict %d\n", entnum);
@@ -442,7 +442,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                        PRVM_ED_ParseEdict (prog, start, ent);
 
                        // link it into the bsp tree
-                       if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
+                       if (!ent->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                                SV_LinkEdict(ent);
                }
 
index 984f9635ac4494afe78410e2d937510be2cccde2..c42cbc69a237077ce396a62642ad40986891ab3b 100644 (file)
--- a/sv_send.c
+++ b/sv_send.c
@@ -709,7 +709,7 @@ static void SV_PrepareEntitiesForSending(void)
        memset(sv.sendentitiesindex, 0, prog->num_edicts * sizeof(*sv.sendentitiesindex));
        for (e = 1, ent = PRVM_NEXT_EDICT(prog->edicts);e < prog->num_edicts;e++, ent = PRVM_NEXT_EDICT(ent))
        {
-               if (!ent->priv.server->free && SV_PrepareEntityForSending(ent, sv.sendentities + sv.numsendentities, e))
+               if (!ent->free && SV_PrepareEntityForSending(ent, sv.sendentities + sv.numsendentities, e))
                {
                        sv.sendentitiesindex[e] = sv.sendentities + sv.numsendentities;
                        sv.numsendentities++;
@@ -1006,7 +1006,7 @@ void SV_AddCameraEyes(void)
        // check line of sight to portal entities and add them to PVS
        for (e = 1, ed = PRVM_NEXT_EDICT(prog->edicts);e < prog->num_edicts;e++, ed = PRVM_NEXT_EDICT(ed))
        {
-               if (!ed->priv.server->free)
+               if (!ed->free)
                {
                        if(PRVM_serveredictfunction(ed, camera_transform))
                        {
@@ -1651,7 +1651,7 @@ static void SV_UpdateToReliableMessages (void)
                if (clientcamera > 0)
                {
                        int oldclientcamera = host_client->clientcamera;
-                       if (clientcamera >= prog->max_edicts || PRVM_EDICT_NUM(clientcamera)->priv.required->free)
+                       if (clientcamera >= prog->max_edicts || PRVM_EDICT_NUM(clientcamera)->free)
                                clientcamera = PRVM_NUM_FOR_EDICT(host_client->edict);
                        host_client->clientcamera = clientcamera;
 
index 1cb5a3f057c305be869a94fdd163658e2098427b..ff1bdbc3b6ab0f8d742e3ffb321266b4a867759b 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -718,7 +718,7 @@ static void SV_ReadClientMove (void)
                }
                // as requested by FrikaC, cursor_trace_ent is reset to world if the
                // entity is free at time of receipt
-               if (PRVM_EDICT_NUM(move->cursor_entitynumber)->priv.server->free)
+               if (PRVM_EDICT_NUM(move->cursor_entitynumber)->free)
                        move->cursor_entitynumber = 0;
                if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
        }
index e17c24ea7feb7646d1f668204b3d61441d340358..249e186d294e2c82a17efeb7be5217311b2f2321 100644 (file)
@@ -254,7 +254,7 @@ static void VM_SV_setorigin(prvm_prog_t *prog)
                VM_Warning(prog, "setorigin: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setorigin: can not modify free entity\n");
                return;
@@ -305,7 +305,7 @@ static void VM_SV_setsize(prvm_prog_t *prog)
                VM_Warning(prog, "setsize: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setsize: can not modify free entity\n");
                return;
@@ -338,7 +338,7 @@ static void VM_SV_setmodel(prvm_prog_t *prog)
                VM_Warning(prog, "setmodel: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setmodel: can not modify free entity\n");
                return;
@@ -806,7 +806,7 @@ static int VM_SV_newcheckclient(prvm_prog_t *prog, int check)
                // look up the client's edict
                ent = PRVM_EDICT_NUM(i);
                // check if it is to be ignored, but never ignore the one we started on (prevent infinite loop)
-               if (i != check && (ent->priv.server->free || PRVM_serveredictfloat(ent, health) <= 0 || ((int)PRVM_serveredictfloat(ent, flags) & FL_NOTARGET)))
+               if (i != check && (ent->free || PRVM_serveredictfloat(ent, health) <= 0 || ((int)PRVM_serveredictfloat(ent, flags) & FL_NOTARGET)))
                        continue;
                // found a valid client (possibly the same one again)
                break;
@@ -853,7 +853,7 @@ static void VM_SV_checkclient(prvm_prog_t *prog)
 
        // return check if it might be visible
        ent = PRVM_EDICT_NUM(sv.lastcheck);
-       if (ent->priv.server->free || PRVM_serveredictfloat(ent, health) <= 0)
+       if (ent->free || PRVM_serveredictfloat(ent, health) <= 0)
        {
                VM_RETURN_EDICT(prog->edicts);
                return;
@@ -901,7 +901,7 @@ static void VM_SV_checkpvs(prvm_prog_t *prog)
        VectorCopy(PRVM_G_VECTOR(OFS_PARM0), viewpos);
        viewee = PRVM_G_EDICT(OFS_PARM1);
 
-       if(viewee->priv.server->free)
+       if(viewee->free)
        {
                VM_Warning(prog, "checkpvs: can not check free entity\n");
                PRVM_G_FLOAT(OFS_RETURN) = 4;
@@ -1096,7 +1096,7 @@ static void VM_SV_walkmove(prvm_prog_t *prog)
                VM_Warning(prog, "walkmove: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "walkmove: can not modify free entity\n");
                return;
@@ -1151,7 +1151,7 @@ static void VM_SV_droptofloor(prvm_prog_t *prog)
                VM_Warning(prog, "droptofloor: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "droptofloor: can not modify free entity\n");
                return;
@@ -1307,7 +1307,7 @@ static void VM_SV_aim(prvm_prog_t *prog)
                VM_Warning(prog, "aim: can not use world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "aim: can not use free entity\n");
                return;
@@ -1535,7 +1535,7 @@ static void VM_SV_makestatic(prvm_prog_t *prog)
                VM_Warning(prog, "makestatic: can not modify world entity\n");
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "makestatic: can not modify free entity\n");
                return;
@@ -1768,7 +1768,7 @@ static void VM_SV_copyentity(prvm_prog_t *prog)
                VM_Warning(prog, "copyentity: can not read world entity\n");
                return;
        }
-       if (in->priv.server->free)
+       if (in->free)
        {
                VM_Warning(prog, "copyentity: can not read free entity\n");
                return;
@@ -1779,7 +1779,7 @@ static void VM_SV_copyentity(prvm_prog_t *prog)
                VM_Warning(prog, "copyentity: can not modify world entity\n");
                return;
        }
-       if (out->priv.server->free)
+       if (out->free)
        {
                VM_Warning(prog, "copyentity: can not modify free entity\n");
                return;
@@ -2378,7 +2378,7 @@ static void VM_SV_setattachment(prvm_prog_t *prog)
                VM_Warning(prog, "setattachment: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setattachment: can not modify free entity\n");
                return;
@@ -2492,7 +2492,7 @@ static int SV_GetTagMatrix (prvm_prog_t *prog, matrix4x4_t *out, prvm_edict_t *e
 
        if (ent == prog->edicts)
                return 1;
-       if (ent->priv.server->free)
+       if (ent->free)
                return 2;
 
        modelindex = (int)PRVM_serveredictfloat(ent, modelindex);
@@ -2561,7 +2561,7 @@ static void VM_SV_gettagindex(prvm_prog_t *prog)
                VM_Warning(prog, "VM_SV_gettagindex(entity #%i): can't affect world entity\n", PRVM_NUM_FOR_EDICT(ent));
                return;
        }
-       if (ent->priv.server->free)
+       if (ent->free)
        {
                VM_Warning(prog, "VM_SV_gettagindex(entity #%i): can't affect free entity\n", PRVM_NUM_FOR_EDICT(ent));
                return;
@@ -2730,7 +2730,7 @@ static void VM_SV_setmodelindex(prvm_prog_t *prog)
                VM_Warning(prog, "setmodelindex: can not modify world entity\n");
                return;
        }
-       if (e->priv.server->free)
+       if (e->free)
        {
                VM_Warning(prog, "setmodelindex: can not modify free entity\n");
                return;
diff --git a/world.c b/world.c
index 5f703a5d8522f413236ba1535b56ea4abfb04e11..39e0102cf63943b243bd7d8ade49681acdb7eb33 100644 (file)
--- a/world.c
+++ b/world.c
@@ -221,7 +221,7 @@ int World_EntitiesInBox(world_t *world, const vec3_t requestmins, const vec3_t r
                        if (ent->priv.server->areagridmarknumber != world->areagrid_marknumber)
                        {
                                ent->priv.server->areagridmarknumber = world->areagrid_marknumber;
-                               if (!ent->priv.server->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
+                               if (!ent->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
                                {
                                        if (numlist < maxlist)
                                                list[numlist] = ent;
@@ -245,7 +245,7 @@ int World_EntitiesInBox(world_t *world, const vec3_t requestmins, const vec3_t r
                                        if (ent->priv.server->areagridmarknumber != world->areagrid_marknumber)
                                        {
                                                ent->priv.server->areagridmarknumber = world->areagrid_marknumber;
-                                               if (!ent->priv.server->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
+                                               if (!ent->free && BoxesOverlap(paddedmins, paddedmaxs, ent->priv.server->areamins, ent->priv.server->areamaxs))
                                                {
                                                        if (numlist < maxlist)
                                                                list[numlist] = ent;
@@ -313,7 +313,7 @@ void World_LinkEdict(world_t *world, prvm_edict_t *ent, const vec3_t mins, const
                return;
 
        // don't add free entities
-       if (ent->priv.server->free)
+       if (ent->free)
                return;
 
        VectorCopy(mins, ent->priv.server->areamins);
@@ -1862,7 +1862,7 @@ static void World_Physics_Frame_ForceFromEntity(world_t *world, prvm_edict_t *ed
        if (!forcetype)
                return;
        enemy = PRVM_gameedictedict(ed, enemy);
-       if (enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].priv.required->free || prog->edicts[enemy].priv.server->ode_body == 0)
+       if (enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].free || prog->edicts[enemy].priv.server->ode_body == 0)
                return;
        VectorCopy(PRVM_gameedictvector(ed, movedir), movedir);
        VectorCopy(PRVM_gameedictvector(ed, origin), origin);
@@ -1914,9 +1914,9 @@ static void World_Physics_Frame_JointFromEntity(world_t *world, prvm_edict_t *ed
        VectorCopy(PRVM_gameedictvector(ed, movedir), movedir);
        if(movetype == MOVETYPE_PHYSICS)
                jointtype = JOINTTYPE_NONE; // can't have both
-       if(enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].priv.required->free || prog->edicts[enemy].priv.server->ode_body == 0)
+       if(enemy <= 0 || enemy >= prog->num_edicts || prog->edicts[enemy].free || prog->edicts[enemy].priv.server->ode_body == 0)
                enemy = 0;
-       if(aiment <= 0 || aiment >= prog->num_edicts || prog->edicts[aiment].priv.required->free || prog->edicts[aiment].priv.server->ode_body == 0)
+       if(aiment <= 0 || aiment >= prog->num_edicts || prog->edicts[aiment].free || prog->edicts[aiment].priv.server->ode_body == 0)
                aiment = 0;
        // see http://www.ode.org/old_list_archives/2006-January/017614.html
        // we want to set ERP? make it fps independent and work like a spring constant
@@ -2925,7 +2925,7 @@ static void nearCallback (void *data, dGeomID o1, dGeomID o2)
                return;
 
        ed1 = (prvm_edict_t *) dGeomGetData(o1);
-       if(ed1 && ed1->priv.server->free)
+       if(ed1 && ed1->free)
                ed1 = NULL;
        if(ed1)
        {
@@ -2936,7 +2936,7 @@ static void nearCallback (void *data, dGeomID o1, dGeomID o2)
        }
 
        ed2 = (prvm_edict_t *) dGeomGetData(o2);
-       if(ed2 && ed2->priv.server->free)
+       if(ed2 && ed2->free)
                ed2 = NULL;
        if(ed2)
        {
@@ -3050,11 +3050,11 @@ void World_Physics_Frame(world_t *world, double frametime, double gravity)
                if (prog)
                {
                        for (i = 0, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
-                               if (!prog->edicts[i].priv.required->free)
+                               if (!prog->edicts[i].free)
                                        World_Physics_Frame_BodyFromEntity(world, ed);
                        // oh, and it must be called after all bodies were created
                        for (i = 0, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
-                               if (!prog->edicts[i].priv.required->free)
+                               if (!prog->edicts[i].free)
                                        World_Physics_Frame_JointFromEntity(world, ed);
                }
 
@@ -3075,7 +3075,7 @@ void World_Physics_Frame(world_t *world, double frametime, double gravity)
                        {
                                int j;
                                for (j = 0, ed = prog->edicts + j;j < prog->num_edicts;j++, ed++)
-                                       if (!prog->edicts[j].priv.required->free)
+                                       if (!prog->edicts[j].free)
                                                World_Physics_Frame_ForceFromEntity(world, ed);
                        }
                        // run physics (move objects, calculate new velocities)
@@ -3092,7 +3092,7 @@ void World_Physics_Frame(world_t *world, double frametime, double gravity)
                if (prog)
                {
                        for (i = 1, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
-                               if (!prog->edicts[i].priv.required->free)
+                               if (!prog->edicts[i].free)
                                        World_Physics_Frame_BodyToEntity(world, ed);
 
                        // print stats
@@ -3104,7 +3104,7 @@ void World_Physics_Frame(world_t *world, double frametime, double gravity)
                                world->physics.ode_activeovjects = 0;
                                for (i = 1, ed = prog->edicts + i;i < prog->num_edicts;i++, ed++)
                                {
-                                       if (prog->edicts[i].priv.required->free)
+                                       if (prog->edicts[i].free)
                                                continue;
                                        body = (dBodyID)prog->edicts[i].priv.server->ode_body;
                                        if (!body)