Server: Handle savegames restoring with entityDef awareness

This commit is contained in:
Marco Cawthorne 2023-07-07 23:43:12 -07:00
parent 9e6a203a02
commit a8c4075ff9
Signed by: eukara
GPG key ID: CE2032F0A2882A22

View file

@ -692,12 +692,17 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
__fullspawndata = fgets(fh); __fullspawndata = fgets(fh);
/* call the constructor if one is present, init the default fields */ eold = self;
if (isfunction(strcat("spawnfunc_", cname))) { self = e;
e.classname = cname;
eold = self; /* check for entityDef first */
self = e; 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)); callfunction(strcat("spawnfunc_", cname));
e.classname = cname; e.classname = cname;
loadent = (NSEntity)e; loadent = (NSEntity)e;
@ -705,6 +710,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
} else { } else {
print(sprintf("Could not spawn %s\n", cname)); print(sprintf("Could not spawn %s\n", cname));
remove(e); remove(e);
self = eold;
continue; continue;
} }
} else if (argv(0) == "{") { } else if (argv(0) == "{") {