Fix optional guards in mutation owner
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m55s
Foundation / checks (checks) (push) Failing after 2m10s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 3m19s
Foundation / checks (client) (push) Canceled after 5m33s
Foundation / checks (network) (push) Canceled after 3m29s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m55s
Foundation / checks (checks) (push) Failing after 2m10s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 3m19s
Foundation / checks (client) (push) Canceled after 5m33s
Foundation / checks (network) (push) Canceled after 3m29s
This commit is contained in:
@@ -523,10 +523,10 @@ std::vector<std::uint8_t> CellularLives::snapshot() const {
|
|||||||
out.put(0, 4);
|
out.put(0, 4);
|
||||||
out.inventory(mutation.offer ? mutation.offer->context.environment.available
|
out.inventory(mutation.offer ? mutation.offer->context.environment.available
|
||||||
: accounting::Inventory{});
|
: accounting::Inventory{});
|
||||||
const auto count = mutation.offer ? mutation.offer->candidates.size() : 0;
|
|
||||||
for (std::size_t index = 0; index < biology::max_candidates; ++index) {
|
for (std::size_t index = 0; index < biology::max_candidates; ++index) {
|
||||||
if (index < count) {
|
if (mutation.offer && index < mutation.offer->candidates.size()) {
|
||||||
const auto& candidate = mutation.offer->candidates[index];
|
const auto& candidates = mutation.offer.value().candidates;
|
||||||
|
const auto& candidate = candidates[index];
|
||||||
out.put(candidate.operator_id, 2);
|
out.put(candidate.operator_id, 2);
|
||||||
out.put(static_cast<std::uint8_t>(candidate.target), 1);
|
out.put(static_cast<std::uint8_t>(candidate.target), 1);
|
||||||
out.put(static_cast<std::uint8_t>(candidate.effect), 1);
|
out.put(static_cast<std::uint8_t>(candidate.effect), 1);
|
||||||
@@ -986,11 +986,15 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
|||||||
state_->lives, selection.life_id, {},
|
state_->lives, selection.life_id, {},
|
||||||
[](const CellularOwnedLife& value) { return value.identity.life; });
|
[](const CellularOwnedLife& value) { return value.identity.life; });
|
||||||
if (life == state_->lives.end() || life->identity.life != selection.life_id ||
|
if (life == state_->lives.end() || life->identity.life != selection.life_id ||
|
||||||
!life->mutation.offer || life->mutation.event_index != selection.event_index ||
|
life->mutation.event_index != selection.event_index ||
|
||||||
life->mutation.offer_tick != selection.offer_tick ||
|
life->mutation.offer_tick != selection.offer_tick)
|
||||||
life->mutation.offer->parent != life->identity.genome ||
|
return std::unexpected{CellularLivesError::mutation};
|
||||||
life->mutation.offer->context.event_index != selection.event_index ||
|
if (!life->mutation.offer.has_value())
|
||||||
!std::ranges::any_of(life->mutation.offer->candidates,
|
return std::unexpected{CellularLivesError::mutation};
|
||||||
|
const auto& offer = *life->mutation.offer;
|
||||||
|
if (offer.parent != life->identity.genome ||
|
||||||
|
offer.context.event_index != selection.event_index ||
|
||||||
|
!std::ranges::any_of(offer.candidates,
|
||||||
[&](const auto& candidate) {
|
[&](const auto& candidate) {
|
||||||
return candidate.operator_id == selection.operator_id;
|
return candidate.operator_id == selection.operator_id;
|
||||||
}) ||
|
}) ||
|
||||||
@@ -1109,10 +1113,11 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const auto parent = next_archive.find(found->identity.genome);
|
const auto parent = next_archive.find(found->identity.genome);
|
||||||
if (!parent || !found->mutation.offer)
|
if (!parent || !found->mutation.offer.has_value())
|
||||||
return std::unexpected{CellularLivesError::mutation};
|
return std::unexpected{CellularLivesError::mutation};
|
||||||
auto transition = biology::fund_mutation(
|
const auto& offer = *found->mutation.offer;
|
||||||
*parent, found->mutation.offer->context, *found->mutation.offer, selection.operator_id,
|
auto transition =
|
||||||
|
biology::fund_mutation(*parent, offer.context, offer, selection.operator_id,
|
||||||
selection.successor_id, selection.successor_id, found->reserve);
|
selection.successor_id, selection.successor_id, found->reserve);
|
||||||
if (!transition) {
|
if (!transition) {
|
||||||
if (transition.error() == biology::MutationError::insufficient_funding) {
|
if (transition.error() == biology::MutationError::insufficient_funding) {
|
||||||
|
|||||||
Reference in New Issue
Block a user