Players wear shirt numbers the manager can change
Every player keeps a number from 1 to 99, unique within his squad. The line-up shows it and changes it by a click; the tactics sketch and the match sheet wear it too. Engine: shirt_numbers.hpp, squad read player.shirtNumber, command lineup.setNumber; saved in state/modern.json. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b3f52d809
commit
72e06aabdb
20 files changed
+304
-8
No files matched your search
@@ -255,3 +255,18 @@ void App::engine_assembly_choose(const std::string &team) {
|
||||
popup_title_ = "Vereinswechsel";
|
||||
popup_accept_ = "Wechseln";
|
||||
}
|
||||
// Shirt numbers: what the squad read says a player wears.
|
||||
std::string App::engine_shirt(const std::string &player, size_t fallback) const {
|
||||
if (engine_mode_) try {
|
||||
for (const auto &row : engine_data_.at("squad").at("data").at("players"))
|
||||
if (row.at("player").at("id") == player && row.at("player").at("shirtNumber").is_number_integer()) return std::to_string(row.at("player").at("shirtNumber").get<int>());
|
||||
} catch (const std::exception &) {}
|
||||
return std::to_string(fallback);
|
||||
}
|
||||
std::string App::engine_shirt_at(size_t place) const {
|
||||
if (engine_mode_) try {
|
||||
const auto &rows = engine_data_.at("squad").at("data").at("players");
|
||||
if (place < rows.size() && rows[place].at("player").at("shirtNumber").is_number_integer()) return std::to_string(rows[place].at("player").at("shirtNumber").get<int>());
|
||||
} catch (const std::exception &) {}
|
||||
return std::to_string(place + 1);
|
||||
}
|
||||
Reference in new issue
Block a user