From: cloudwalk Date: Tue, 26 May 2020 13:59:03 +0000 (+0000) Subject: Fix pure data entities being linked into the area grid, causing performance hit X-Git-Tag: xonotic-v0.8.5~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dd4ca2a5d4848141aefcca6987e71e1734a50856;p=xonotic%2Fdarkplaces.git Fix pure data entities being linked into the area grid, causing performance hit From Mario (Xonotic). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12586 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=b1d6f1dfb96bedba50fbe394ca3f0c710f99381b --- diff --git a/clvm_cmds.c b/clvm_cmds.c index 54848d8e..7d2ccfd4 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1872,6 +1872,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); } diff --git a/csprogs.c b/csprogs.c index 8d54fc0f..1a7c57de 100644 --- a/csprogs.c +++ b/csprogs.c @@ -882,7 +882,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); } diff --git a/host_cmd.c b/host_cmd.c index a62b0832..582a58f9 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -964,7 +964,7 @@ static void Host_Loadgame_f (void) 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); } diff --git a/sv_main.c b/sv_main.c index d724aa1f..12632eb3 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3595,7 +3595,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); } diff --git a/svvm_cmds.c b/svvm_cmds.c index e4969440..fc1449f3 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1772,6 +1772,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); }