Add canonical cellular action input codec
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 39s
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 (ecs) (push) Canceled after 1m39s
Foundation / checks (network) (push) Canceled after 1m8s
Foundation / checks (client) (push) Canceled after 1m49s

This commit is contained in:
dingo
2026-10-10 22:59:05 -04:00
parent 49f6fac3e7
commit a2e5cd5f68
6 changed files with 94 additions and 0 deletions
+14
View File
@@ -151,6 +151,16 @@ struct CellularIntention {
std::uint32_t intake_x_um{}, intake_y_um{};
friend bool operator==(const CellularIntention&, const CellularIntention&) = default;
};
// Canonical biological input saved with a durable cellular action. Transport session,
// epoch and action id are deliberately absent so the same retry survives reconnects.
struct CellularActionInput {
std::uint64_t tick{};
std::int16_t move_x{}, move_y{};
bool has_intake_target{};
std::uint32_t intake_x_um{}, intake_y_um{};
friend bool operator==(const CellularActionInput&, const CellularActionInput&) = default;
};
inline constexpr std::size_t cellular_action_input_bytes = 24;
// v7 reliable input: stable account-scoped action id makes retries safe across reconnects.
// The server resolves the optional intake address and all biological effects.
struct CellularAction {
@@ -285,4 +295,8 @@ using SessionMessage =
decode_session(std::span<const std::uint8_t> bytes);
[[nodiscard]] std::expected<SessionMessage, SessionCodecError>
decode_session(std::span<const std::uint8_t> bytes, std::uint16_t* version);
[[nodiscard]] std::array<std::uint8_t, cellular_action_input_bytes>
encode_cellular_action_input(const CellularActionInput& input);
[[nodiscard]] std::expected<CellularActionInput, SessionCodecError>
decode_cellular_action_input(std::span<const std::uint8_t> bytes);
} // namespace evo::network