The takers of free kicks, penalties and corners can be named in the line-up

The read lineup states the three takers (setPieces; null is the assistant's
choice) and the new command lineup.setPiece names one or hands all three
back, through the game's own set_pitch_set_piece_taker_source and
auto_pitch_set_piece_takers_source. In the line-up, Schütze opens the three
cards; a card is chosen and the next click on a player names him.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-16 14:25:04 +01:00
1 parent 11264ccdb5
commit 92555b9ba0
9 files changed
+116 -3

No files matched your search

+19 -1
View File
@@ -127,6 +127,21 @@ std::string App::render_lineup_page() {
}
out += "</div>";
}
const bool takers = lineup_side_ == "takers" && projection.at("set_pieces").is_object();
if (takers) {
// who takes the set pieces: one of the three is chosen, the next click on a player names him
out += "<div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:6px;padding:10px 14px;") + "\"><div class=\"pg-row\" style=\"justify-content:space-between;\"><strong class=\"pg-h\">Standardschützen</strong>" +
pg_button("lineup-piece-auto", "Alle dem Co-Trainer", "", "id=\"lineup-piece-auto\"") + "</div><div class=\"pg-row\" style=\"align-items:stretch;" + pg_css("gap:8px;") + "\">";
for (const auto &[key, label] : std::array<std::pair<const char *, const char *>, 3>{{{"freeKick", "Freistoß"}, {"penalty", "Elfmeter"}, {"corner", "Eckball"}}}) {
const auto &taker = projection.at("set_pieces").at(key);
std::string name = "Co-Trainer";
if (taker.is_string()) for (const auto &row : rows) if (row.at("id") == taker) name = last_name(row.at("name").get<std::string>());
const bool chosen = lineup_piece_ == key;
out += btn("lineup-piece", "<span class=\"pg-k\">" + pg_upper(label) + "</span><strong class=\"pg-nowrap\">" + esc(name) + "</strong>", std::string("pg-card lp-piece") + (chosen ? " sel" : ""),
attr("id", std::string("lineup-piece-") + key) + attr("data-id", key) + attr("aria-pressed", chosen ? "true" : "false"));
}
out += "</div><span class=\"pg-mut\" style=\"display:block;font-size:" + pg(12.5) + ";\">Eine der drei Karten wählen, dann den Schützen in der Liste oder auf dem Feld anklicken. Möglich ist, wer aufgestellt ist oder auf der Bank sitzt.</span></div></div></div>";
} else {
out += "<div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:4px;padding:10px 14px;") + "\"><div class=\"pg-row\" style=\"justify-content:space-between;\"><strong class=\"pg-h\">Aufstellung</strong><span class=\"pg-legend\">"
"<span class=\"pg-legend-item\"><span class=\"pg-legend-mark lp-dot a\"></span><span>ab 85</span></span><span class=\"pg-legend-item\"><span class=\"pg-legend-mark lp-dot b\"></span><span>ab 70</span></span>"
"<span class=\"pg-legend-item\"><span class=\"pg-legend-mark lp-dot c\"></span><span>darunter</span></span></span></div><span style=\"display:block;\">Zwei Spieler zum Tauschen anklicken.</span>"
@@ -143,6 +158,7 @@ std::string App::render_lineup_page() {
out += "</div>";
}
out += "</div></div></div>";
}
// --- the foot ---
const auto pair_of = [&](const char *action, const char *id, const std::string &first, const std::string &second, bool second_on) {
@@ -156,10 +172,12 @@ std::string App::render_lineup_page() {
std::string status = engine_busy_ ? engine_operation_ : engine_notice_;
if (!lineup_selected_.empty())
for (const auto &row : rows) if (row.at("id") == lineup_selected_) status = row.at("name").get<std::string>() + " markiert · zweiten Spieler wählen.";
if (lineup_side_ == "takers" && projection.at("set_pieces").is_object() && !engine_busy_) status = "Schützen: Karte wählen, dann Spieler anklicken.";
if (status.empty()) status = "Kein Spieler markiert.";
out += "<nav class=\"pg-foot\">" + pair_of("lineup-data", "lineup-data", "Daten A", "Daten B", lineup_data_ == 1) + pair_of("lineup-view", "lineup-view", "Spielfeld", "Team", !lineup_pitch_) + "<div class=\"pg-seg\">";
for (const auto &[side, label] : std::array<std::pair<const char *, const char *>, 3>{{{"formations", "Aufst."}, {"orders", "Anweis."}, {"takers", "Schütze"}}})
out += btn("lineup-side", "<span>" + std::string(label) + "</span>", std::string(side) == "formations" ? "first" : "", attr("id", "lineup-side-" + std::string(side)) + attr("data-id", side) + " disabled title=\"Im Spiel nicht verfügbar\"");
out += btn("lineup-side", "<span>" + std::string(label) + "</span>", std::string(std::string(side) == "formations" ? "first" : "") + (std::string(side) == "takers" && takers ? " on" : ""),
attr("id", "lineup-side-" + std::string(side)) + attr("data-id", side) + (std::string(side) == "takers" && projection.at("set_pieces").is_object() ? attr("aria-pressed", takers ? "true" : "false") : std::string(" disabled title=\"Im Spiel nicht verfügbar\"")));
out += "</div><span class=\"pg-tag sage\">" + std::string(indoor ? "Halle · 40 Min." : "Rasen · 90 Min.") + "</span><span class=\"pg-sp\"></span>" + pg_status(status) + "</nav></div>";
return out + engine_player_profile(projection);
}