X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=events.h;h=545437b16d9f181c998cf707e99307b7c849b87f;hb=67da94217a271b0b76d42c75d1a78ee5ba942825;hp=caf832ac26ca0180364d8e899dba453beb909c00;hpb=415442b56355392b207551b2cc84e663d8d7f914;p=pkanalytics diff --git a/events.h b/events.h index caf832a..545437b 100644 --- a/events.h +++ b/events.h @@ -25,7 +25,7 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QVariant data(const QModelIndex &index, int role) const override; - unsigned insert_event(uint64_t t, std::optional player_id, const std::string &type = "unknown"); // Returns the row. + unsigned insert_event(uint64_t t, std::optional player_id, std::optional formation_id, const std::string &type = "unknown"); // Returns the row. void delete_event(unsigned row); void set_event_type(unsigned row, const std::string &type); uint64_t get_time(unsigned row) { return events[row].t; } @@ -48,6 +48,7 @@ public: std::set get_team_at(uint64_t t); void set_team_at(uint64_t, const std::set &new_team); std::vector sort_team(const std::set &team) const; // Ordered first by gender, then by number. + void set_formation_at(uint64_t t, bool offense, unsigned formation); private: struct Player { @@ -58,10 +59,17 @@ private: std::map players; std::map player_ordering; // From id to position. + struct Formation { + int formation_id; + std::string name; + }; + std::map formations; + struct Event { int event_id; uint64_t t; std::optional player_id; + std::optional formation_id; std::string type; }; std::vector events;