Modern UI contract: national line-up and tactics
The national coach's desk reads the national team's line-up and tactics (the original's desk has them) instead of no_club, and lineup.commit prepares the national board without the clubs' designated set-piece extension, whose records the national team has not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e88304019
commit
c361dccd34
3 files changed
+30
-4
No files matched your search
@@ -686,6 +686,28 @@ int main(int argc, char** argv) {
|
||||
const J again = session.ui_read(O{{"kind", "friendly"}, {"opponentId", "team:384"}}, rev);
|
||||
const auto* dates = at(at(nf, "data"), "dates").array();
|
||||
check(cli::dump_json(at(nf, "data")) == cli::dump_json(at(again, "data")) && dates, "national friendly read is pure");
|
||||
// the national team's line-up and tactics at the coach's desk
|
||||
{
|
||||
const J lineup = session.ui_read(O{{"kind", "lineup"}}, rev);
|
||||
const J tactics = session.ui_read(O{{"kind", "tactics"}}, rev);
|
||||
const auto* order = at(at(lineup, "data"), "order").array();
|
||||
std::printf("(national line-up: %s)\n", cli::dump_json(lineup).substr(0, 160).c_str());
|
||||
check(s(at(lineup, "messageType")) == "snapshot" && order && order->size() >= 11, "national line-up read");
|
||||
check(s(at(tactics, "messageType")) == "snapshot", "national tactics read");
|
||||
if (order && order->size() >= 11) {
|
||||
const uint64_t was = rev;
|
||||
const J kept = session.ui_command(cmd("request:nl" + std::to_string(k), "lineup.commit", O{{"order", J(*order)}}), rev);
|
||||
std::printf("(national line-up commit: %s)\n", cli::dump_json(kept).substr(0, 200).c_str());
|
||||
check(s(at(kept, "messageType")) == "command_result" && rev == was + 1, "national line-up commit");
|
||||
J::Array swapped = *order;
|
||||
std::swap(swapped[0], swapped[1]);
|
||||
const J moved = session.ui_command(cmd("request:nm" + std::to_string(k), "lineup.commit", O{{"order", J(swapped)}}), rev);
|
||||
const J after_swap = session.ui_read(O{{"kind", "lineup"}}, rev);
|
||||
const auto* now = at(at(after_swap, "data"), "order").array();
|
||||
check(s(at(moved, "messageType")) == "command_result" && now && s((*now)[0]) == s((*order)[1]),
|
||||
"national line-up: two players swapped");
|
||||
}
|
||||
}
|
||||
std::printf("(national friendly: %s)\n", cli::dump_json(at(nf, "data")).substr(0, 300).c_str());
|
||||
national_friendly = 0;
|
||||
if (dates && !dates->empty()) {
|
||||
|
||||
Reference in new issue
Block a user