Require contact for cellular patch uptake
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
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 (checks) (push) Canceled after 49s
Foundation / checks (ecs) (push) Canceled after 42s
Foundation / checks (client) (push) Canceled after 49s

This commit is contained in:
dingo
2026-10-10 21:18:08 -04:00
parent 44732967e7
commit e781e929d8
5 changed files with 33 additions and 5 deletions
+9 -1
View File
@@ -152,12 +152,20 @@ CellularHabitat::perceive(CellularPosition position, std::uint32_t extent_um) co
}
std::expected<CellularPatchUptakeProposal, CellularHabitatError>
CellularHabitat::propose_uptake(CellularPatchAddress address, accounting::Inventory reserve,
CellularHabitat::propose_uptake(CellularPatchAddress address, CellularPosition position,
std::uint32_t extent_um, accounting::Inventory reserve,
const MetabolicBudget& budget) const noexcept {
if (extent_um == 0 || extent_um > config_.width_um || extent_um > config_.height_um ||
position.x_um > config_.width_um - extent_um ||
position.y_um > config_.height_um - extent_um)
return std::unexpected{CellularHabitatError::outside_area};
const auto index = find(address);
if (!index)
return std::unexpected{CellularHabitatError::missing_patch};
const auto& patch = config_.patches[*index];
if (!cellular_footprints_contact(position, extent_um, {patch.address.x_um, patch.address.y_um},
cellular_patch_pitch_um))
return std::unexpected{CellularHabitatError::not_in_contact};
const auto uptake = propose_cellular_uptake(patch.stock, reserve, budget);
if (!uptake)
return std::unexpected{CellularHabitatError::uptake};