planner: insert point at correct position

Instead of inserting the point at the calculated
position, the DivePlannerPointsModel would append it
at the end and then resort the vector. That's just
silly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-23 13:51:39 +01:00 committed by Dirk Hohndel
parent 1e525244e6
commit 35c5ec09b7

View file

@ -826,8 +826,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
point.entered = entered;
point.divemode = divemode;
point.next = NULL;
divepoints.append(point);
std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
divepoints.insert(divepoints.begin() + row, point);
endInsertRows();
return row;
}