QTfrontend/hwform.cpp
changeset 12667 2e0a38566178
parent 12665 5664ec82aed7
child 12674 8d266b2d0f9c
--- a/QTfrontend/hwform.cpp	Sat Oct 07 18:43:31 2017 +0200
+++ b/QTfrontend/hwform.cpp	Sat Oct 07 19:11:25 2017 +0200
@@ -1036,7 +1036,16 @@
 
 void HWForm::NewTeam()
 {
-    ui.pageEditTeam->createTeam(QLineEdit::tr("unnamed"), playerHash);
+    QString teamName = QLineEdit::tr("unnamed");
+    QStringList teamslist = config->GetTeamsList();
+    if(teamslist.contains(teamName))
+    {
+        //name already used -> look for an appropriate name:
+        int i=2;
+        while(teamslist.contains(teamName = QLineEdit::tr("unnamed (%1)").arg(i++)));
+    }
+
+    ui.pageEditTeam->createTeam(teamName, playerHash);
     UpdateTeamsLists();
     GoToPage(ID_PAGE_SETUP_TEAM);
 }