From a8c4075ff9258d87bac428808c61fdfc03a10fdc Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 7 Jul 2023 23:43:12 -0700 Subject: [PATCH] Server: Handle savegames restoring with entityDef awareness --- src/server/entry.qc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/server/entry.qc b/src/server/entry.qc index ced3b267..0c941a47 100644 --- a/src/server/entry.qc +++ b/src/server/entry.qc @@ -692,12 +692,17 @@ SV_PerformLoad(float fh, float entcount, float playerslots) __fullspawndata = fgets(fh); - /* call the constructor if one is present, init the default fields */ - if (isfunction(strcat("spawnfunc_", cname))) { - e.classname = cname; + eold = self; + self = e; - eold = self; - self = e; + /* check for entityDef first */ + if (EntityDef_SpawnClassname(cname)) { + e.classname = cname; + loadent = (NSEntity)e; + self = eold; + } else if (isfunction(strcat("spawnfunc_", cname))) { + /* call the constructor if one is present, init the default fields */ + e.classname = cname; callfunction(strcat("spawnfunc_", cname)); e.classname = cname; loadent = (NSEntity)e; @@ -705,6 +710,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots) } else { print(sprintf("Could not spawn %s\n", cname)); remove(e); + self = eold; continue; } } else if (argv(0) == "{") {