Modern UI contract: envelope, career and manager ids, session and desktop reads

First engine delivery for the Modern interface handoff (docs/new_ui/integration,
issue #15): ModernSession::ui_read answers in the draft envelope with careerId,
worldId, stateRevision, date, season, scope and Money in minor units. Careers and
human managers get persistent ids (saved in state/modern.json, older saves get
them on load). Reads: session and desktop. Engine decisions on the P0 points in
docs/new_engine/ui-anbindung.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 08:17:18 +01:00
1 parent 9061123c7e
commit 3336d01004
9 files changed
+342 -2

No files matched your search

+3
View File
@@ -774,6 +774,7 @@ ModernSession::ModernSession(const std::filesystem::path &data, uint32_t watcom_
throw FormatError(saved_turn_error_);
if (!native)
capture_source_desk_callargs();
modern::ensure_ui_identities(g_); // saves from before the interface contract get their ids now
}
int ModernSession::runtime_club(int master) const { return runtime_club(g_, master); }
@@ -947,6 +948,7 @@ bool ModernSession::commit_manager_join(ui::CareerInitializationResult& result,
next.desktop = desktop_projection(next_revision); next.managers = managers_;
next.preparation = preparation_projection(next_revision);
ui::validate_preparation_context(next.preparation);
modern::ensure_ui_identities(g_); // the new manager's contract id
result = std::move(next); revision = next_revision; manager_join_.reset();
return true;
} catch (const std::exception& e) {
@@ -4317,6 +4319,7 @@ bool ModernSession::finish(ui::CareerInitializationResult& result, std::string&
capture_source_desk_callargs();
// Both UI projections must reflect the freshly initialized driver cursor.
// Reuse its prepared groups; these projections do not prepare an event or draw RNG.
modern::ensure_ui_identities(g_); // career and manager ids of the interface contract
result.desktop = desktop_projection(1);
result.preparation = preparation_projection(1);
for (size_t m = 0; m < managers_.size(); ++m)