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
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:
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user