Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/object/waypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void waypoint_stuff_name(SCP_string &dest, const char *waypoint_list_name, int w
return;
}

dest.assign(waypoint_list_name, name_max_len);
dest.assign(waypoint_list_name, std::min(strlen(waypoint_list_name), name_max_len));
dest += ":";
dest.append(std::to_string(waypoint_num));
}
Expand Down
2 changes: 1 addition & 1 deletion qtfred/src/mission/dialogs/SelectionDialogModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void SelectionDialogModel::initializeData() {
entry.id = i;
entry.selected = false;

_wing_list.push_back(entry);
_waypoint_list.push_back(entry);
}
}
void SelectionDialogModel::updateObjectList() {
Expand Down
17 changes: 7 additions & 10 deletions qtfred/src/ui/dialogs/SelectionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,13 @@ void SelectionDialog::objectSelectionChanged() {
auto current = _model->getObjectList(); // Copy the vector so we can change the selection

for (auto& entry : current) {
auto items =
ui->shipSelectionList->model()->match(ui->shipSelectionList->model()->index(0, 0), Qt::UserRole, entry.id);

Assertion(items.size() > 0, "No items for object index found!");
Assertion(items.size() <= 1, "Found multiple items for one object index!");

auto item = ui->shipSelectionList->item(items[0].row());

Assertion(item != nullptr, "Couldn't find item for index!");
entry.selected = item->isSelected();
for (int row = 0; row < ui->shipSelectionList->count(); ++row) {
auto* item = ui->shipSelectionList->item(row);
if (item->data(Qt::UserRole).value<int>() == entry.id) {
entry.selected = item->isSelected();
break;
}
}
}

_model->updateObjectSelection(current);
Expand Down
Loading