]> git.sesse.net Git - pkanalytics/commitdiff
Make the default action on offense a catch.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 1 May 2023 17:51:46 +0000 (19:51 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 1 May 2023 17:51:46 +0000 (19:51 +0200)
main.cpp

index 552b75ad4114290b456fbec38de0313e9078cd7d..4cdbfcc2974d5d6e48f060d15910ce1f9025da93 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -150,8 +150,15 @@ void MainWindow::insert_event(int button_id)
        }
        int player_id = *next(team.begin(), button_id - 1);
 
+       EventsModel::Status s = events->get_status_at(t);
+
        ui->event_view->selectionModel()->blockSignals(true);
-       ui->event_view->selectRow(events->insert_event(t, player_id));
+       if (s.offense) {
+               // TODO: Perhaps not if that player already did the last catch?
+               ui->event_view->selectRow(events->insert_event(t, player_id, "catch"));
+       } else {
+               ui->event_view->selectRow(events->insert_event(t, player_id));
+       }
        ui->event_view->selectionModel()->blockSignals(false);
 }