]> git.sesse.net Git - pkanalytics/blobdiff - events.cpp
Show formation name in the status bar.
[pkanalytics] / events.cpp
index ad70407bdfae7754022551e53ca601fc8e4801c6..9826f0ecbbc487e8a23ec1932f4b4b52e0d66a39 100644 (file)
@@ -314,6 +314,8 @@ EventsModel::Status EventsModel::get_status_at(uint64_t t)
        s.our_score = 0;
        s.their_score = 0;
        s.attack_state = Status::NOT_STARTED;
+       s.offensive_formation = 0;
+       s.defensive_formation = 0;
        s.stoppage = false;
        s.pull_state = Status::SHOULD_PULL;
        uint64_t last_gained_possession = 0;
@@ -388,6 +390,20 @@ EventsModel::Status EventsModel::get_status_at(uint64_t t)
                                last_stoppage = 0;
                        }
                }
+               if (e.type == "formation_offense") {
+                       if (e.formation_id) {
+                               s.offensive_formation = *e.formation_id;
+                       } else {
+                               s.offensive_formation = 0;
+                       }
+               }
+               if (e.type == "formation_defense") {
+                       if (e.formation_id) {
+                               s.defensive_formation = *e.formation_id;
+                       } else {
+                               s.defensive_formation = 0;
+                       }
+               }
        }
        if (s.stoppage && last_stoppage != 0) {
                time_spent_in_stoppage += (t - last_stoppage);