]> git.sesse.net Git - pkanalytics/blobdiff - main.cpp
Make a more sensible ordering of the player buttons.
[pkanalytics] / main.cpp
index d9e605894ddee0f5d3a91934ff6df5a308b2cfce..a89e4785acd17404f8c0825a640c50759248d5dd 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -185,11 +185,11 @@ void MainWindow::seek(int64_t delta_ms)
 void MainWindow::insert_event(int button_id)
 {
        uint64_t t = video->position();
-       set<int> team = events->get_team_at(t);
+       vector<int> team = events->sort_team(events->get_team_at(t));
        if (button_id > team.size()) {
                return;
        }
-       int player_id = *next(team.begin(), button_id - 1);
+       int player_id = team[button_id - 1];
 
        EventsModel::Status s = events->get_status_at(t);
 
@@ -281,7 +281,6 @@ void MainWindow::update_status(uint64_t t)
 
 void MainWindow::update_player_buttons(uint64_t t)
 {
-       // FIXME: sort by number, instead of by internal ID
        QPushButton *buttons[] = {
                ui->player_1,
                ui->player_2,
@@ -293,7 +292,7 @@ void MainWindow::update_player_buttons(uint64_t t)
        };
        const char shortcuts[] = "qweasdf";
        int num_players = 0;
-       for (int player_id : events->get_team_at(t)) {
+       for (int player_id : events->sort_team(events->get_team_at(t))) {
                QPushButton *btn = buttons[num_players];
                string label = players->get_player_name_by_id(player_id) + " (&" + shortcuts[num_players] + ")";
                char shortcut[2] = "";