]> git.sesse.net Git - pkanalytics/blobdiff - main.cpp
Show formation name in the status bar.
[pkanalytics] / main.cpp
index 42d42cc0899300aefd254b5f3682e3856f308388..01b158373c1bc9cf620744055134dbe8a5a3ddf9 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -301,15 +301,23 @@ void MainWindow::update_status(uint64_t t)
 {
        EventsModel::Status s = events->get_status_at(t);
        char buf[256];
-       const char *offense = "not started";
+       std::string formation = "Not started";
        if (s.attack_state == EventsModel::Status::OFFENSE) {
-               offense = "offense";
+               if (s.offensive_formation != 0) {
+                       formation = offensive_formations->get_formation_name_by_id(s.offensive_formation);
+               } else {
+                       formation = "Offense";
+               }
        } else if (s.attack_state == EventsModel::Status::DEFENSE) {
-               offense = "defense";
+               if (s.defensive_formation != 0) {
+                       formation = defensive_formations->get_formation_name_by_id(s.defensive_formation);
+               } else {
+                       formation = "Defense";
+               }
        }
 
        snprintf(buf, sizeof(buf), "%d–%d | %s | %d passes, %d sec possession",
-               s.our_score, s.their_score, offense, s.num_passes, s.possession_sec);
+               s.our_score, s.their_score, formation.c_str(), s.num_passes, s.possession_sec);
        if (s.stoppage_sec > 0) {
                char buf2[256];
                snprintf(buf2, sizeof(buf2), "%s (plus %d sec stoppage)", buf, s.stoppage_sec);