@@ -321,7 +321,7 @@ void LoadoutDialog::addShipButtonClicked()
321321 SCP_vector<SCP_string> list;
322322
323323 for (const auto & item : ui->listShipsNotUsed ->selectedItems ()){
324- list.push_back (item->text ().toStdString ());
324+ list.emplace_back (item->text ().toStdString ());
325325 }
326326
327327 if (_mode == TABLE_MODE ) {
@@ -338,7 +338,7 @@ void LoadoutDialog::addWeaponButtonClicked()
338338 SCP_vector<SCP_string> list;
339339
340340 for (const auto & item: ui->listWeaponsNotUsed ->selectedItems ()){
341- list.push_back (item->text ().toStdString ());
341+ list.emplace_back (item->text ().toStdString ());
342342 }
343343
344344 if (_mode == TABLE_MODE ) {
@@ -355,7 +355,7 @@ void LoadoutDialog::removeShipButtonClicked()
355355 SCP_vector<SCP_string> list;
356356
357357 for (const auto & item : ui->usedShipsList ->selectedItems ()){
358- list.push_back (item->text ().toStdString ());
358+ list.emplace_back (item->text ().toStdString ());
359359 }
360360
361361 if (_mode == TABLE_MODE ) {
@@ -372,7 +372,7 @@ void LoadoutDialog::removeWeaponButtonClicked()
372372 SCP_vector<SCP_string> list;
373373
374374 for (const auto & item : ui->usedWeaponsList ->selectedItems ()){
375- list.push_back (item->text ().toStdString ());
375+ list.emplace_back (item->text ().toStdString ());
376376 }
377377
378378 if (_mode == TABLE_MODE ) {
@@ -578,7 +578,7 @@ void LoadoutDialog::updateUI()
578578 bool found = false ;
579579
580580 for (int x = 0 ; x < ui->usedShipsList ->rowCount (); ++x){
581- if (ui->usedShipsList ->item (x,0 ) && ! stricmp (ui->usedShipsList ->item (x, 0 )->text ().toStdString (). c_str () , shipName. c_str () )) {
581+ if (ui->usedShipsList ->item (x,0 ) && lcase_equal (ui->usedShipsList ->item (x, 0 )->text ().toStdString (), shipName)) {
582582 found = true ;
583583 // update the quantities here, and make sure it's visible
584584 ui->usedShipsList ->item (x, 1 )->setText (newShip.first .substr (divider + 1 ).c_str ());
@@ -600,7 +600,7 @@ void LoadoutDialog::updateUI()
600600
601601 // remove from the unused list
602602 for (int x = 0 ; x < ui->listShipsNotUsed ->count (); ++x) {
603- if (! stricmp (ui->listShipsNotUsed ->item (x)->text ().toStdString (). c_str () , shipName. c_str () )) {
603+ if (lcase_equal (ui->listShipsNotUsed ->item (x)->text ().toStdString (), shipName)) {
604604 ui->listShipsNotUsed ->setRowHidden (x, true );
605605 break ;
606606 }
@@ -610,7 +610,7 @@ void LoadoutDialog::updateUI()
610610 bool found = false ;
611611
612612 for (int x = 0 ; x < ui->listShipsNotUsed ->count (); ++x){
613- if (! stricmp (ui->listShipsNotUsed ->item (x)->text ().toStdString (). c_str () , shipName. c_str () )) {
613+ if (lcase_equal (ui->listShipsNotUsed ->item (x)->text ().toStdString (), shipName)) {
614614 found = true ;
615615 ui->listShipsNotUsed ->setRowHidden (x, false );
616616 break ;
@@ -624,7 +624,7 @@ void LoadoutDialog::updateUI()
624624 // remove from the used list
625625 for (int x = 0 ; x < ui->usedShipsList ->rowCount (); ++x) {
626626 if (ui->usedShipsList ->item (x, 0 ) &&
627- ! stricmp (ui->usedShipsList ->item (x, 0 )->text ().toStdString (). c_str () , shipName. c_str () )) {
627+ lcase_equal (ui->usedShipsList ->item (x, 0 )->text ().toStdString (), shipName)) {
628628 ui->usedShipsList ->setRowHidden (x, true );
629629 break ;
630630 }
@@ -641,7 +641,7 @@ void LoadoutDialog::updateUI()
641641
642642 // Add or update in the used list
643643 for (int x = 0 ; x < ui->usedWeaponsList ->rowCount (); ++x) {
644- if (ui->usedWeaponsList ->item (x,0 ) && ! stricmp (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (). c_str () , weaponName. c_str () )) {
644+ if (ui->usedWeaponsList ->item (x,0 ) && lcase_equal (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (), weaponName)) {
645645 found = true ;
646646 // only need to update the quantities here.
647647 ui->usedWeaponsList ->item (x, 1 )->setText (newWeapon.first .substr (divider + 1 ).c_str ());
@@ -664,7 +664,7 @@ void LoadoutDialog::updateUI()
664664
665665 // remove from the unused list
666666 for (int x = 0 ; x < ui->listWeaponsNotUsed ->count (); ++x) {
667- if (! stricmp (ui->listWeaponsNotUsed ->item (x)->text ().toStdString (). c_str () , weaponName. c_str () )) {
667+ if (lcase_equal (ui->listWeaponsNotUsed ->item (x)->text ().toStdString (), weaponName)) {
668668 ui->listWeaponsNotUsed ->setRowHidden (x, true );
669669 break ;
670670 }
@@ -674,7 +674,7 @@ void LoadoutDialog::updateUI()
674674 bool found = false ;
675675
676676 for (int x = 0 ; x < ui->listWeaponsNotUsed ->count (); ++x){
677- if (ui->listWeaponsNotUsed ->item (x) && ! stricmp (ui->listWeaponsNotUsed ->item (x)->text ().toStdString (). c_str () , weaponName. c_str () )) {
677+ if (ui->listWeaponsNotUsed ->item (x) && lcase_equal (ui->listWeaponsNotUsed ->item (x)->text ().toStdString (), weaponName)) {
678678 found = true ;
679679 ui->listWeaponsNotUsed ->setRowHidden (x, false );
680680 break ;
@@ -688,7 +688,7 @@ void LoadoutDialog::updateUI()
688688 // remove from the used list
689689 for (int x = 0 ; x < ui->usedWeaponsList ->rowCount (); ++x) {
690690 if (ui->usedWeaponsList ->item (x, 0 ) &&
691- ! stricmp (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (). c_str () , weaponName. c_str () )) {
691+ lcase_equal (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (), weaponName)) {
692692 ui->usedWeaponsList ->setRowHidden (x, true );
693693 break ;
694694 }
@@ -699,9 +699,9 @@ void LoadoutDialog::updateUI()
699699
700700 // Go through the lists and make sure that we don't have random empty entries
701701 for (int x = 0 ; x < ui->listShipsNotUsed ->count (); ++x) {
702- if (ui->listShipsNotUsed ->item (x) && ! strlen ( ui->listShipsNotUsed ->item (x)->text ().toStdString (). c_str () )) {
702+ if (ui->listShipsNotUsed ->item (x) && ui->listShipsNotUsed ->item (x)->text ().isEmpty ( )) {
703703 for (int y = x + 1 ; y < ui->listShipsNotUsed ->count (); ++y) {
704- if (ui->listShipsNotUsed ->item (y) && strlen ( ui->listShipsNotUsed ->item (y)->text ().toStdString (). c_str () )) {
704+ if (ui->listShipsNotUsed ->item (y) && ! ui->listShipsNotUsed ->item (y)->text ().isEmpty ( )) {
705705 ui->listShipsNotUsed ->item (x)->setText (ui->listShipsNotUsed ->item (y)->text ());
706706 ui->listShipsNotUsed ->item (y)->setText (" " );
707707 break ;
@@ -712,9 +712,9 @@ void LoadoutDialog::updateUI()
712712
713713
714714 for (int x = 0 ; x < ui->listWeaponsNotUsed ->count (); ++x) {
715- if (ui->listWeaponsNotUsed ->item (x) && ! strlen ( ui->listWeaponsNotUsed ->item (x)->text ().toStdString (). c_str () )) {
715+ if (ui->listWeaponsNotUsed ->item (x) && ui->listWeaponsNotUsed ->item (x)->text ().isEmpty ( )) {
716716 for (int y = x + 1 ; y < ui->listWeaponsNotUsed ->count (); ++y) {
717- if (ui->listWeaponsNotUsed ->item (y) && strlen ( ui->listWeaponsNotUsed ->item (y)->text ().toStdString (). c_str () )) {
717+ if (ui->listWeaponsNotUsed ->item (y) && ! ui->listWeaponsNotUsed ->item (y)->text ().isEmpty ( )) {
718718 ui->listWeaponsNotUsed ->item (x)->setText (ui->listWeaponsNotUsed ->item (y)->text ());
719719 ui->listWeaponsNotUsed ->item (y)->setText (" " );
720720 break ;
@@ -724,10 +724,10 @@ void LoadoutDialog::updateUI()
724724 }
725725
726726 for (int x = 0 ; x < ui->usedShipsList ->rowCount (); ++x) {
727- if (ui->usedShipsList ->item (x, 0 ) && ! strlen ( ui->usedShipsList ->item (x, 0 )->text ().toStdString (). c_str () ) && ui->usedShipsList ->item (x, 1 )) {
727+ if (ui->usedShipsList ->item (x, 0 ) && ui->usedShipsList ->item (x, 0 )->text ().isEmpty ( ) && ui->usedShipsList ->item (x, 1 )) {
728728 for (int y = x + 1 ; y < ui->usedShipsList ->rowCount (); ++y) {
729- if (ui->usedShipsList ->item (y, 0 ) && strlen ( ui->usedShipsList ->item (y, 0 )->text ().toStdString (). c_str () )
730- && ui->usedShipsList ->item (y, 1 ) && strlen ( ui->usedShipsList ->item (y, 1 )->text ().toStdString (). c_str () )) {
729+ if (ui->usedShipsList ->item (y, 0 ) && ! ui->usedShipsList ->item (y, 0 )->text ().isEmpty ( )
730+ && ui->usedShipsList ->item (y, 1 ) && ! ui->usedShipsList ->item (y, 1 )->text ().isEmpty ( )) {
731731
732732 ui->usedShipsList ->item (x, 0 )->setText (ui->usedShipsList ->item (y, 0 )->text ());
733733 ui->usedShipsList ->item (y, 0 )->setText (" " );
@@ -741,11 +741,11 @@ void LoadoutDialog::updateUI()
741741 }
742742
743743 for (int x = 0 ; x < ui->usedWeaponsList ->rowCount (); ++x) {
744- if (ui->usedWeaponsList ->item (x, 0 ) && ! strlen ( ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (). c_str () ) &&
744+ if (ui->usedWeaponsList ->item (x, 0 ) && ui->usedWeaponsList ->item (x, 0 )->text ().isEmpty ( ) &&
745745 ui->usedWeaponsList ->item (x, 1 )) {
746746 for (int y = x + 1 ; y < ui->usedWeaponsList ->rowCount (); ++y) {
747- if (ui->usedWeaponsList ->item (y, 0 ) && strlen ( ui->usedWeaponsList ->item (y, 0 )->text ().toStdString (). c_str ())
748- && ui->usedWeaponsList ->item (y, 1 ) && strlen ( ui->usedWeaponsList ->item (y, 1 )->text ().toStdString (). c_str () )) {
747+ if (ui->usedWeaponsList ->item (y, 0 ) && ! ui->usedWeaponsList ->item (y, 0 )->text ().isEmpty ()
748+ && ui->usedWeaponsList ->item (y, 1 ) && ! ui->usedWeaponsList ->item (y, 1 )->text ().isEmpty ( )) {
749749
750750 ui->usedWeaponsList ->item (x, 0 )->setText (ui->usedWeaponsList ->item (y, 0 )->text ());
751751 ui->usedWeaponsList ->item (y, 0 )->setText (" " );
@@ -832,8 +832,8 @@ void LoadoutDialog::updateUI()
832832 ui->extraItemsViaVariableCombo ->setCurrentIndex (0 );
833833 } else {
834834 for (int x = 0 ; x < ui->extraItemsViaVariableCombo ->count (); ++x) {
835- if (! stricmp (ui->extraItemsViaVariableCombo ->itemText (x).toStdString (). c_str (),
836- currentVariable. c_str () )) {
835+ if (lcase_equal (ui->extraItemsViaVariableCombo ->itemText (x).toStdString (),
836+ currentVariable)) {
837837 ui->extraItemsViaVariableCombo ->setCurrentIndex (x);
838838 break ;
839839 }
@@ -850,7 +850,7 @@ void LoadoutDialog::updateUI()
850850 bool found = false ;
851851
852852 for (const auto & weapon : requiredWeapons) {
853- if (ui->usedWeaponsList ->item (x, 0 ) && ui->usedWeaponsList ->item (x,2 ) && ! stricmp (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (). c_str () , weapon. c_str () )) {
853+ if (ui->usedWeaponsList ->item (x, 0 ) && ui->usedWeaponsList ->item (x,2 ) && lcase_equal (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (), weapon)) {
854854 found = true ;
855855 ui->usedWeaponsList ->item (x, 2 )->setText (" Yes" );
856856 break ;
@@ -870,7 +870,7 @@ SCP_vector<SCP_string> LoadoutDialog::getSelectedShips()
870870
871871 for (int x = 0 ; x < ui->usedShipsList ->rowCount (); ++x) {
872872 if (ui->usedShipsList ->item (x, 0 ) && ui->usedShipsList ->item (x,0 )->isSelected ()) {
873- namesOut.emplace_back (ui->usedShipsList ->item (x, 0 )->text ().toStdString (). c_str () );
873+ namesOut.emplace_back (ui->usedShipsList ->item (x, 0 )->text ().toStdString ());
874874 }
875875 }
876876
@@ -883,7 +883,7 @@ SCP_vector<SCP_string> LoadoutDialog::getSelectedWeapons()
883883
884884 for (int x = 0 ; x < ui->usedWeaponsList ->rowCount (); ++x) {
885885 if (ui->usedWeaponsList ->item (x, 0 ) && ui->usedWeaponsList ->item (x, 0 )->isSelected ()) {
886- namesOut.emplace_back (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString (). c_str () );
886+ namesOut.emplace_back (ui->usedWeaponsList ->item (x, 0 )->text ().toStdString ());
887887 }
888888 }
889889
0 commit comments