]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix pure data entities being linked into the area grid, causing performance hit
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 13:59:03 +0000 (13:59 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 13:59:03 +0000 (13:59 +0000)
From Mario (Xonotic).

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12586 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
csprogs.c
host_cmd.c
sv_main.c
svvm_cmds.c

index e6f754f40a0abb19016f88690738401dc014af5b..56e4517fbfb65641f07feb45a96dd66cef5aff49 100644 (file)
@@ -1860,6 +1860,9 @@ static void VM_CL_copyentity (prvm_prog_t *prog)
                return;
        }
        memcpy(out->fields.fp, in->fields.fp, prog->entityfields * sizeof(prvm_vec_t));
+
+       if (VectorCompare(PRVM_clientedictvector(out, absmin), PRVM_clientedictvector(out, absmax)))
+               return;
        CL_LinkEdict(out);
 }
 
index 189c6bb1b7882f1cf58bbb60a6956eb4ba8ed2f5..4f47741b586ecc27cd2efac6ab5916893067718b 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -884,7 +884,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)
+               if (!ent->priv.server->free && !VectorCompare(PRVM_clientedictvector(ent, absmin), PRVM_clientedictvector(ent, absmax)))
                        CL_LinkEdict(ent);
 }
 
index 9df142ef4d102fc820f228b615e2a33054f57ee2..ab42967319f237f8c740b8f2fc51c70c50a83266 100644 (file)
@@ -953,7 +953,7 @@ static void Host_Loadgame_f(cmd_state_t *cmd)
                        PRVM_ED_ParseEdict (prog, start, ent);
 
                        // link it into the bsp tree
-                       if (!ent->priv.server->free)
+                       if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                                SV_LinkEdict(ent);
                }
 
index 19d267505397cf825b218ef83904bd1841de49bb..3496bc2c98882227006170ced7a891a9721d9a2c 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -3599,7 +3599,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)
+               if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                        SV_LinkEdict(ent);
 }
 
index 0e1a8720f61f1ab652fd2d81f1317c6a1eb4a988..8e8b00ad5e166a257b3aefa4fd75993452f3bb73 100644 (file)
@@ -1780,6 +1780,8 @@ static void VM_SV_copyentity(prvm_prog_t *prog)
                return;
        }
        memcpy(out->fields.fp, in->fields.fp, prog->entityfields * sizeof(prvm_vec_t));
+       if (VectorCompare(PRVM_serveredictvector(out, absmin), PRVM_serveredictvector(out, absmax)))
+               return;
        SV_LinkEdict(out);
 }