]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_edict.c
use "realtime", not the float time global, for entity allocation and freeing to prote...
[xonotic/darkplaces.git] / prvm_edict.c
index be8af7c9daf2c94e3e56f0429fdc42adc1b4ccc4..24eeb734a84ba692b86d8cf98026310103042e9b 100644 (file)
@@ -262,7 +262,7 @@ prvm_edict_t *PRVM_ED_Alloc (void)
                e = PRVM_EDICT_NUM(i);
                // the first couple seconds of server time can involve a lot of
                // freeing and allocating, so relax the replacement policy
-               if (e->priv.required->free && ( e->priv.required->freetime < 2 || prog->globaloffsets.time < 0 || (PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float - e->priv.required->freetime) > 0.5 ) )
+               if (e->priv.required->free && ( e->priv.required->freetime < prog->starttime + 2 || (realtime - e->priv.required->freetime) > 1 ) )
                {
                        PRVM_ED_ClearEdict (e);
                        e->priv.required->allocation_origin = PRVM_AllocationOrigin();
@@ -302,7 +302,7 @@ void PRVM_ED_Free (prvm_edict_t *ed)
        PRVM_GCALL(free_edict)(ed);
 
        ed->priv.required->free = true;
-       ed->priv.required->freetime = prog->globaloffsets.time >= 0 ? PRVM_GLOBALFIELDVALUE(prog->globaloffsets.time)->_float : 0;
+       ed->priv.required->freetime = realtime;
        if(ed->priv.required->allocation_origin)
        {
                PRVM_Free((char *)ed->priv.required->allocation_origin);