Format M11 cellular code with clang-format 19
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / checks (network) (push) Failing after 3m2s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m47s
Foundation / checks (postgres) (push) Canceled after 1m24s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / checks (network) (push) Failing after 3m2s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m47s
Foundation / checks (postgres) (push) Canceled after 1m24s
This commit is contained in:
@@ -20,8 +20,7 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
std::ranges::sort(prepared.intents.lives, {}, &CellularLifeIntent::life_id);
|
||||
for (std::size_t i = 0; i < state.lives().size(); ++i)
|
||||
if (prepared.intents.lives[i].life_id != state.lives()[i].identity.life ||
|
||||
(i != 0 && prepared.intents.lives[i - 1].life_id ==
|
||||
prepared.intents.lives[i].life_id))
|
||||
(i != 0 && prepared.intents.lives[i - 1].life_id == prepared.intents.lives[i].life_id))
|
||||
return std::unexpected{CellularSessionBatchError::intents};
|
||||
|
||||
prepared.actions.reserve(actions.size());
|
||||
@@ -33,16 +32,16 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
if (!input || input->tick != tick)
|
||||
return std::unexpected{CellularSessionBatchError::action};
|
||||
|
||||
const auto life = std::ranges::find(state.lives(), action.account.bytes,
|
||||
&CellularOwnedLife::account);
|
||||
const auto life =
|
||||
std::ranges::find(state.lives(), action.account.bytes, &CellularOwnedLife::account);
|
||||
if (life == state.lives().end())
|
||||
return std::unexpected{CellularSessionBatchError::life};
|
||||
if (input->has_intake_target) {
|
||||
const auto view = state.perceive(life->identity.life);
|
||||
const biology::CellularPatchAddress target{input->intake_x_um, input->intake_y_um};
|
||||
if (!view || std::ranges::find(*view, target,
|
||||
&biology::CellularPatchPerception::address) ==
|
||||
view->end())
|
||||
if (!view ||
|
||||
std::ranges::find(*view, target, &biology::CellularPatchPerception::address) ==
|
||||
view->end())
|
||||
return std::unexpected{CellularSessionBatchError::unperceived_target};
|
||||
}
|
||||
const auto owned_intent = std::ranges::lower_bound(
|
||||
@@ -67,12 +66,12 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
record.input = *action.cellular_input;
|
||||
prepared.actions.push_back(record);
|
||||
}
|
||||
std::ranges::sort(prepared.actions, [](const CellularActionRecord& left,
|
||||
const CellularActionRecord& right) {
|
||||
if (left.account != right.account)
|
||||
return left.account < right.account;
|
||||
return left.action_id < right.action_id;
|
||||
});
|
||||
std::ranges::sort(prepared.actions,
|
||||
[](const CellularActionRecord& left, const CellularActionRecord& right) {
|
||||
if (left.account != right.account)
|
||||
return left.account < right.account;
|
||||
return left.action_id < right.action_id;
|
||||
});
|
||||
return prepared;
|
||||
}
|
||||
|
||||
@@ -93,7 +92,7 @@ CellularSessionBatchBuilder::create(const CellularLives& committed_state,
|
||||
CellularSessionBatchBuilder builder{std::move(*working)};
|
||||
builder.batch_.header = {committed_state.world(), committed_state.region(),
|
||||
committed_state.frame(), committed_head.commit,
|
||||
committed_head.digest, committed_state.tick(),
|
||||
committed_head.digest, committed_state.tick(),
|
||||
committed_state.tick()};
|
||||
return builder;
|
||||
}
|
||||
@@ -112,8 +111,7 @@ CellularSessionBatchBuilder::append(std::uint64_t tick,
|
||||
return std::unexpected{prepared.error()};
|
||||
for (const auto& action : prepared->actions)
|
||||
if (std::ranges::find_if(actions_, [&](const CellularActionRecord& previous) {
|
||||
return previous.account == action.account &&
|
||||
previous.action_id == action.action_id;
|
||||
return previous.account == action.account && previous.action_id == action.action_id;
|
||||
}) != actions_.end())
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_action};
|
||||
if (births.size() > biology::max_cellular_tick_lives)
|
||||
@@ -133,21 +131,20 @@ CellularSessionBatchBuilder::append(std::uint64_t tick,
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_birth};
|
||||
for (const auto& previous_tick : batch_.ticks)
|
||||
if (std::ranges::any_of(previous_tick.births, [&](const auto& previous) {
|
||||
return previous.account == birth.account ||
|
||||
previous.identity == birth.identity;
|
||||
return previous.account == birth.account || previous.identity == birth.identity;
|
||||
}))
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_birth};
|
||||
}
|
||||
|
||||
auto next = CellularLives::restore(working_->snapshot(), working_->world(),
|
||||
working_->region(), working_->frame(), working_->tick());
|
||||
auto next = CellularLives::restore(working_->snapshot(), working_->world(), working_->region(),
|
||||
working_->frame(), working_->tick());
|
||||
if (!next || !(*next)->advance_tick(prepared->intents.lives))
|
||||
return std::unexpected{CellularSessionBatchError::biology};
|
||||
|
||||
for (const auto& birth : prepared->intents.births) {
|
||||
const LifeRequest request{birth.account, birth.request};
|
||||
const LifeAllocation allocation{birth.identity, birth.identity, birth.identity,
|
||||
birth.identity, {tick}};
|
||||
const LifeAllocation allocation{
|
||||
birth.identity, birth.identity, birth.identity, birth.identity, {tick}};
|
||||
auto created = (*next)->birth_candidate(request, allocation);
|
||||
if (!created)
|
||||
return std::unexpected{CellularSessionBatchError::invalid_birth};
|
||||
|
||||
Reference in New Issue
Block a user