QTfrontend/team.cpp
changeset 245 4f6b53b7a567
parent 239 f9adf3c73bed
child 247 07605d2a2024
--- a/QTfrontend/team.cpp	Wed Nov 15 21:53:50 2006 +0000
+++ b/QTfrontend/team.cpp	Thu Nov 16 22:01:51 2006 +0000
@@ -30,6 +30,7 @@
   difficulty(0)
 {
 	TeamName = teamname;
+	OldTeamName = TeamName;
 	for (int i = 0; i < 8; i++) HHName[i].sprintf("hedgehog %d", i);
 	Grave = "Simple";
 	Fort = "Barrelhouse";
@@ -76,11 +77,11 @@
 	{
 		str = stream.readLine();
 		if (str.startsWith(";")) continue;
-		if (str.startsWith("name team "))
+		/*if (str.startsWith("name team "))
 		{
 			str.remove(0, 10);
 			TeamName = str;
-		} else
+		} else*/
 		if (str.startsWith("name hh"))
 		{
 			str.remove(0, 7);
@@ -125,6 +126,12 @@
 
 bool HWTeam::SaveToFile()
 {
+	if (OldTeamName != TeamName)
+	{
+		QFile cfgfile(cfgdir->absolutePath() + "/" + OldTeamName + ".cfg");
+		cfgfile.remove();
+		OldTeamName = TeamName;
+	}
 	QFile cfgfile(cfgdir->absolutePath() + "/" + TeamName + ".cfg");
 	if (!cfgfile.open(QIODevice::WriteOnly)) return false;
 	QTextStream stream(&cfgfile);