The four instructions of a starter can be set in the line-up

The read lineup states the instructions of every starter (board bytes
+2..+5) and lineup.setOrder sets one through set_player_order_source.
Anweis. in the line-up shows them for the chosen starter with the
original's four arrows; each is moved in steps of 1 or 5.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-16 15:01:21 +01:00
1 parent 3330dfb69c
commit a2790751a6
8 files changed
+101 -8

No files matched your search

+25
View File
@@ -9240,8 +9240,11 @@ cli::Json ModernSession::ui_read(const cli::Json& request, uint64_t revision) co
const size_t at = size_t(manager) * 0x840 + row * 0x58;
if (row < 11 && at + 0x43 <= g_.tactics.size()) {
const int partner = partner_of(row);
// "orders": the four instructions of a starter (board bytes +2..+5, each 2-40), which
// the original's ORDER view sets with its four arrows
positions.push_back(O{{"playerId", id}, {"depth", int(int8_t(g_.tactics[at + 0x41]))},
{"lane", int(int8_t(g_.tactics[at + 0x42]))},
{"orders", A{int(g_.tactics[at + 2]), int(g_.tactics[at + 3]), int(g_.tactics[at + 4]), int(g_.tactics[at + 5])}},
{"partnerId", partner >= 0 ? cli::Json(row_ids[size_t(partner)]) : cli::Json(nullptr)}});
}
}
@@ -11032,6 +11035,28 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
if (!ok) { restore(); return refuse(error == "unknown_player" ? "unknown_player" : "lineup_refused", error); }
revision = previous + 1;
answer = modern::ui_command_result(request_id, previous, revision, {"lineup", "squad"}, "Aufstellung übernommen.");
} else if (kind == "lineup.setOrder") {
// payload {playerId, aspect 0-3, value 2-40}: one instruction of a starter (set_player_order_source)
const int team = g_.manager_teams[size_t(manager)];
const SquadRange range = squad_range(team);
const std::string id = ui_text(*payload, "playerId");
const cli::Json* aspect = ui_field(*payload, "aspect");
const cli::Json* value = ui_field(*payload, "value");
if (id.empty() || !aspect || !aspect->integer() || *aspect->integer() < 0 || *aspect->integer() > 3 || !value || !value->integer() ||
*value->integer() < kOrderMin || *value->integer() > kOrderMax)
return refuse("invalid_payload", "playerId, aspect 0-3 und value 2-40 nötig.");
size_t at = range.count;
for (size_t row = 0; row < range.count; ++row) {
const int p = g_.squad_slots[range.first + row] & 0x0fff;
if (p != 0x0fff && modern::ui_player_id(g_, p) == id) at = row;
}
if (at == range.count) return refuse("unknown_player", "Dieser Spieler gehört nicht zum Kader.");
if (!set_player_order_source(g_, manager, team, int(at), g_.squad_slots[range.first + at] & 0x0fff, int(*aspect->integer()), int(*value->integer()))) {
restore();
return refuse("lineup_refused", "Anweisungen bekommt nur, wer aufgestellt ist.");
}
revision = previous + 1;
answer = modern::ui_command_result(request_id, previous, revision, {"lineup"}, "Anweisung übernommen.");
} else if (kind == "lineup.setPiece") {
// payload {piece: "freeKick" | "penalty" | "corner", playerId} names one taker;
// {auto: true} hands all three back to the assistant (the original's AUTO)