File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -315,6 +315,11 @@ namespace sgpmode {
315315 }
316316 // Kill host with chosen probability
317317 if (random_ptr->P (death_chance)) {
318+ for (emp::Ptr<Organism> i : endosymbionts) {
319+ // This symbiont will die but we want to keep it in the graveyard
320+ SendToGraveyard (i);
321+ }
322+ host.ClearSyms ();
318323 host.SetDead ();
319324 }
320325 }
@@ -358,7 +363,12 @@ namespace sgpmode {
358363 endosym_ptr->GetHardware ().GetCPUState ().GetLocation ()
359364 );
360365 }
366+ // This symbiont will die but we want to keep it in the graveyard
367+ SendToGraveyard (endosym_ptr);
361368 }
369+ // We have a reference to this host's symbionts in the graveyard,
370+ // now clear the syms so the host doesnot destroy them on host.Delete()
371+ host.ClearSyms ();
362372 // ------
363373 // Mark host as dead
364374 host.SetDead ();
@@ -442,7 +452,10 @@ namespace sgpmode {
442452 endosym_ptr->GetHardware ().GetCPUState ().GetLocation ()
443453 );
444454 }
455+ // This symbiont will die but we want to keep it in the graveyard
456+ SendToGraveyard (endosym_ptr);
445457 }
458+ host.ClearSyms ();
446459 host.SetDead ();
447460 }
448461 }
You can’t perform that action at this time.
0 commit comments