Modern live ticker: crowd and weather before the kickoff
The recording's ticker matches and the paused live kickoff's matches carry attendance and weather (temperature, the original's weather picture; none indoors), as the interface asked in issue 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98e6982d07
commit
d3ea650c07
4 files changed
+17
-1
No files matched your search
@@ -61,6 +61,7 @@ Die UI ruft diese über `DataSource::read_almanac` und `read_statistics` direkt
|
||||
`ModernSession::read_live` (für `DataSource::read_live`, Abfragen wie die Demo: `{kind: "fixture"}`, `{kind: "frame", sequence}`, optional `revision`, `fixture_id`). Die Engine rechnet einen Spieltag beim Anstoß im Ganzen; der Ticker spielt die **Aufzeichnung** der Spiele des letzten `session.advance` ab (`source: "engine-recording"`, Format `openbmh-live-fixture@1` der Demo):
|
||||
|
||||
- `matches`: die Spiele mit menschlichem Manager (höchstens vier), `owners`: die Manager mit Team und `match_id` (`view` ist `null`; die Aufstellung kommt aus dem `lineup`-Read).
|
||||
- `matches` (die Spiele des Tickers) mit `attendance` (Zuschauer) und `weather` (`temperature` in °C, `rain` das Wetterbild 0–7 des Originals; Hallenturnier `null`), schon vor dem Anpfiff; ebenso jede Partie des angehaltenen Live-Anstoßs (aus der Spielgruppe).
|
||||
- `frames` in Minutenfolge: Anpfiff, jedes Ereignis (Tor, Chance, Karten, Verletzung, Wechsel, Elfmeter), Halbzeit, Wiederanpfiff, Abpfiff; je Spiel Stand, Chancen, Gelb, Rot, Elfmeter, Spieler auf dem Feld. `events` (fortlaufend) mit Überschrift und Satz, Spieler, Seite, Stand.
|
||||
- `conference`: die übrigen Spiele des Tages im Almanach-Format.
|
||||
- `standings` (Live-Tabelle) je Frame: pro Liga eines Ticker-Spiels die Tabelle vor dem Spieltag plus alle Spiele dieser Runde im Anstoß mit dem Stand der Minute (beim Abpfiff das gewertete Ergebnis); Zeilen mit `rank`, `previousRank`, `team`, `played`, `won`, `drawn`, `lost`, `goalsFor`, `goalsAgainst`, `points`. In der Aufzeichnung trägt ein Frame nur die Tabellen, die sich in ihm geändert haben (der erste alle); `kind: frame` liefert den vollständigen Stand bis dahin. Der angehaltene Live-Anstoß liefert `standings` ebenso: je Ligagruppe mit einem Live-Spiel die Tabelle mit den Ständen der laufenden Spiele. Fehler: `live_unavailable` (noch kein Anstoß), `live_no_human_match`, `stale_live_revision`, `stale_live_fixture`, `invalid_live_sequence`.
|
||||
|
||||
@@ -8820,6 +8820,12 @@ cli::Json ModernSession::read_live(const cli::Json& request) const {
|
||||
{"away", O{{"id", modern::ui_team_id(g_, away)}, {"name", ui::original_to_utf8(g_.club_name(away))}}},
|
||||
{"homeManagerId", hm >= 0 ? cli::Json(modern::ui_manager_id(g_, hm)) : cli::Json(nullptr)},
|
||||
{"awayManagerId", am >= 0 ? cli::Json(modern::ui_manager_id(g_, am)) : cli::Json(nullptr)},
|
||||
// the crowd and the weather the kickoff set (descriptor +0x30 temperature,
|
||||
// +0x50 the weather picture 0-7)
|
||||
{"attendance", size_t(m) < grp.spectators.size() ? cli::Json(int64_t(grp.spectators[size_t(m)])) : cli::Json(nullptr)},
|
||||
{"weather", grp.desc.size() > 0x50 + size_t(m)
|
||||
? cli::Json(cli::Json::Object{{"temperature", int(int8_t(grp.desc[0x30 + size_t(m)]))}, {"rain", int(grp.desc[0x50 + size_t(m)])}})
|
||||
: cli::Json(nullptr)},
|
||||
{"score", cli::Json::Array{cli::Json(h), cli::Json(a)}}});
|
||||
}
|
||||
// the live tables: each league group with a live match, its matches at their score so far
|
||||
|
||||
@@ -852,7 +852,11 @@ cli::Json live_fixture(const ModernState& g, uint32_t after_date, uint32_t until
|
||||
const Competition c = competition_of(g, s, m);
|
||||
matches.push_back(O{{"id", id}, {"home", O{{"id", s.clubs[m.home].id}, {"name", s.clubs[m.home].name}}},
|
||||
{"away", O{{"id", s.clubs[m.away].id}, {"name", s.clubs[m.away].name}}},
|
||||
{"owners", std::move(match_owners)}, {"competition", c.name}});
|
||||
{"owners", std::move(match_owners)}, {"competition", c.name},
|
||||
// known before the kickoff (frame 0 on): the crowd and the weather (rain is the
|
||||
// original's weather picture 0-7); the indoor tournament has no weather
|
||||
{"attendance", int64_t(m.attendance)},
|
||||
{"weather", m.type - 1 == 0xb ? J(nullptr) : J(O{{"temperature", int(m.temperature)}, {"rain", int(m.rain)}})}});
|
||||
}
|
||||
for (const Ref& r : others) conference.push_back(almanac_match(g, *r.season, r.index));
|
||||
|
||||
|
||||
@@ -546,6 +546,9 @@ int main(int argc, char** argv) {
|
||||
check(truth(at(fixture, "ok")) && s(at(fixture, "source")) == "engine-recording" && frames && frames->size() >= 4 &&
|
||||
matches && !matches->empty() && at(fixture, "owners").array() && !at(fixture, "owners").array()->empty(),
|
||||
"live fixture of the last kickoff");
|
||||
if (matches && !matches->empty())
|
||||
check(at((*matches)[0], "attendance").integer() && at(at((*matches)[0], "weather"), "rain").integer(),
|
||||
"crowd and weather of the ticker match before the kickoff");
|
||||
if (frames && frames->size() >= 4) {
|
||||
const J& last = frames->back();
|
||||
const J one = session.read_live(O{{"kind", "frame"}, {"sequence", int64_t(frames->size() - 1)}});
|
||||
@@ -601,6 +604,8 @@ int main(int argc, char** argv) {
|
||||
*at(state, "minute").integer() >= 30, "thirty minutes on");
|
||||
std::printf("(live state: %s)\n", cli::dump_json(state).substr(0, 400).c_str());
|
||||
check(at(state, "standings").array() != nullptr, "the paused kickoff names its live tables");
|
||||
if (const auto* live = at(state, "matches").array(); live && !live->empty())
|
||||
check(at(at((*live)[0], "weather"), "temperature").integer() != nullptr, "the paused match's weather");
|
||||
std::printf("(paused live tables: %zu)\n", at(state, "standings").array() ? at(state, "standings").array()->size() : 0);
|
||||
if (const auto* live = at(state, "matches").array(); live && !live->empty()) {
|
||||
int goals = 0;
|
||||
|
||||
Reference in new issue
Block a user