Skip to content

Commit 7edb3b2

Browse files
committed
Placed symbionts directly in graveyard for stress
1 parent 2f20a26 commit 7edb3b2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

source/sgp_mode/SGPW_InteractionMechanismSetup.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)