Modern UI contract: camps read and the first command, camp.book
ModernSession::ui_command checks careerId, expectedRevision and owner, runs the engine action and answers command_result or error. A refused command restores the state and both generators; a repeated requestId gets the stored answer, a different command under the same id duplicate_request. The camps read lists maps and camps with a binding, draw-free quote per camp, focus and the season's stays. Tests cover stale revision, foreign owner, unknown camp, booking, repeat, conflict and a refused second booking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fec4c6c7e7
commit
99a48a463d
7 files changed
+252
-2
No files matched your search
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cli/json.hpp"
|
||||
#include "modern/game/modern_state.hpp"
|
||||
@@ -46,4 +47,12 @@ cli::Json ui_money(int64_t euros);
|
||||
|
||||
cli::Json ui_read(const ModernState& g, const UiContext& context, const cli::Json& request);
|
||||
|
||||
// The parts of a command answer the session puts together (ModernSession::ui_command).
|
||||
cli::Json ui_command_result(const std::string& request_id, uint64_t previous, uint64_t next,
|
||||
const std::vector<std::string>& changed_reads, const std::string& feedback);
|
||||
cli::Json ui_error(const std::string& request_id, const std::string& code, const std::string& message,
|
||||
uint64_t revision, bool retryable);
|
||||
// The contract id of a manager slot ("manager:<n>").
|
||||
std::string ui_manager_id(const ModernState& g, int manager);
|
||||
|
||||
} // namespace bmh::modern
|
||||
Reference in new issue
Block a user