QTfrontend/ui/widget/selectWeapon.cpp
changeset 12689 5b135c26f320
parent 12665 5664ec82aed7
child 12763 ad67a3804981
--- a/QTfrontend/ui/widget/selectWeapon.cpp	Wed Oct 11 01:23:38 2017 +0200
+++ b/QTfrontend/ui/widget/selectWeapon.cpp	Wed Oct 11 18:39:19 2017 +0200
@@ -226,12 +226,15 @@
 
     for(int i = 0; i < cDefaultAmmos.size(); i++)
     {
-        if (cDefaultAmmos[i].first.compare(m_name->text()) == 0)
+        // Don't allow same name as default weapon set, even case-insensitively.
+        // This prevents some problems with saving/loading.
+        if (cDefaultAmmos[i].first.toLower().compare(m_name->text().toLower()) == 0)
         {
             // don't show warning if no change
             if (cDefaultAmmos[i].second.compare(stateFull) == 0)
                 return;
 
+            m_name->setText(curWeaponsName);
             QMessageBox deniedMsg(this);
             deniedMsg.setIcon(QMessageBox::Warning);
             deniedMsg.setWindowTitle(QMessageBox::tr("Weapons - Warning"));