Scale the bottom controls and confirm editable construction plans

This commit is contained in:
Codex committed 2026-11-29 19:30:05 +03:00
1 parent 73a91a066d
commit 2a71ed6242
10 files changed
+438 -133

No files matched your search

+13 -9
View File
@@ -192,13 +192,13 @@ struct LanSession::Impl {
bool connecting = false;
bool authenticated = false;
bool reject_pending = false;
bool waiting_reply = false;
std::optional<Action> awaiting_receipt;
std::uint16_t network_port = 0;
std::uint64_t key = 0;
std::string host_address;
std::string notice;
std::deque<Action> actions;
std::optional<CommandStatus> rejected_command;
std::optional<LanRejection> rejected_command;
std::uint64_t guest_sequence = 0;
Clock::time_point last_ping{};
Clock::time_point last_snapshot{};
@@ -218,7 +218,8 @@ struct LanSession::Impl {
void drop_peer() noexcept {
peer = Channel{};
connecting = authenticated = reject_pending = waiting_reply = false;
connecting = authenticated = reject_pending = false;
awaiting_receipt.reset();
guest_sequence = 0;
actions.clear();
rejected_command.reset();
@@ -298,14 +299,17 @@ struct LanSession::Impl {
notice.clear();
return;
}
if (message != Message::Receipt || payload.size() != 9 || !waiting_reply) {
if (message != Message::Receipt || payload.size() != 9 || !awaiting_receipt) {
throw std::runtime_error("Invalid message from the host.");
}
const auto status = static_cast<CommandStatus>(static_cast<unsigned char>(payload[0]));
if (status > CommandStatus::Busy) throw std::runtime_error("Invalid command result.");
if (status != CommandStatus::Accepted) rejected_command = status;
if (status != CommandStatus::Accepted) {
rejected_command = LanRejection{status, awaiting_receipt->kind, awaiting_receipt->cell,
awaiting_receipt->value};
}
guest_sequence = number(payload.substr(1));
waiting_reply = false;
awaiting_receipt.reset();
}
void send_snapshot(const World& world, Clock::time_point now) {
@@ -326,7 +330,7 @@ struct LanSession::Impl {
}
void send_action() {
if (waiting_reply || actions.empty() || guest_sequence == 0 || peer.pending()) return;
if (awaiting_receipt || actions.empty() || guest_sequence == 0 || peer.pending()) return;
const Action action = actions.front();
std::string payload;
append_number(payload, guest_sequence, 8);
@@ -339,7 +343,7 @@ struct LanSession::Impl {
append_number(payload, action.resident, 8);
peer.queue(Message::Command, payload);
actions.pop_front();
waiting_reply = true;
awaiting_receipt = action;
}
};
@@ -438,7 +442,7 @@ bool LanSession::submit(CommandKind kind, GridPosition cell, std::uint8_t value,
return true;
}
std::optional<CommandStatus> LanSession::take_rejection() noexcept {
std::optional<LanRejection> LanSession::take_rejection() noexcept {
return std::exchange(impl_->rejected_command, std::nullopt);
}