]> git.sesse.net Git - pkanalytics/blobdiff - events.h
Remove an obsolete TODO.
[pkanalytics] / events.h
index 545437b16d9f181c998cf707e99307b7c849b87f..f522734261e5334a675cade7c965dae806f1e4e8 100644 (file)
--- a/events.h
+++ b/events.h
@@ -9,6 +9,36 @@
 #include <optional>
 #include <set>
 
+enum class EventType {
+       CATCH,
+       DEFENSE,
+       DEFENSIVE_SOFT_MINUS,
+       DEFENSIVE_SOFT_PLUS,
+       FORMATION_DEFENSE,
+       FORMATION_OFFENSE,
+       DROP,
+       GOAL,
+       IN,
+       INTERCEPTION,
+       OFFENSIVE_SOFT_MINUS,
+       OFFENSIVE_SOFT_PLUS,
+       OUT,
+       PULL,
+       PULL_LANDED,
+       PULL_OOB,
+       RESTART,
+       SET_DEFENSE,
+       SET_OFFENSE,
+       STALLOUT,
+       STOPPAGE,
+       THEIR_GOAL,
+       THEIR_PULL,
+       THEIR_THROWAWAY,
+       THROWAWAY,
+       UNKNOWN,
+       WAS_D,
+};
+
 class EventsModel : public QAbstractTableModel
 {
 public:
@@ -27,7 +57,9 @@ public:
 
        unsigned insert_event(uint64_t t, std::optional<int> player_id, std::optional<int> formation_id, const std::string &type = "unknown");  // Returns the row.
        void delete_event(unsigned row);
+       EventType get_event_type(unsigned row) { return events[row].type; }
        void set_event_type(unsigned row, const std::string &type);
+       void set_event_formation(unsigned row, int formation_id);
        uint64_t get_time(unsigned row) { return events[row].t; }
        unsigned get_last_event_pos(uint64_t t) const;  // Last event that happened at or before t.
        QModelIndex get_last_event_qt(uint64_t t) const {
@@ -38,6 +70,7 @@ public:
        struct Status {
                unsigned our_score, their_score;
                enum { NOT_STARTED, OFFENSE, DEFENSE } attack_state;
+               unsigned offensive_formation, defensive_formation;
                bool stoppage;
                enum { NOT_PULLING, SHOULD_PULL, PULL_IN_AIR } pull_state;
                unsigned num_passes;
@@ -50,6 +83,11 @@ public:
        std::vector<int> sort_team(const std::set<int> &team) const;  // Ordered first by gender, then by number.
        void set_formation_at(uint64_t t, bool offense, unsigned formation);
 
+       // Used to notify when we've inserted a new one into the database.
+       void inserted_new_formation(int formation_id, const std::string &name) {
+               formations[formation_id] = Formation{ formation_id, name };
+       }
+
 private:
        struct Player {
                int player_id;
@@ -70,7 +108,7 @@ private:
                uint64_t t;
                std::optional<int> player_id;
                std::optional<int> formation_id;
-               std::string type;
+               EventType type;
        };
        std::vector<Event> events;