added default team on loading
authordisplacer
Tue, 10 Jan 2006 21:57:41 +0000
changeset 44 1ef9546971ff
parent 43 e297fea1a2f3
child 45 1072e7fe85c8
added default team on loading
QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp	Tue Jan 10 19:53:18 2006 +0000
+++ b/QTfrontend/hwform.cpp	Tue Jan 10 21:57:41 2006 +0000
@@ -115,12 +115,19 @@
 	cfgdir.cd(".hedgewars");
 
 	list = cfgdir.entryList(QStringList("*.cfg"));
+
+	if(list.empty()) {
+	  HWTeam defaultTeam("DefaultTeam");
+	  defaultTeam.SetCfgDir(cfgdir.absolutePath());
+	  defaultTeam.SaveToFile();
+	  list.push_back("DefaultTeam");
+	}
+
 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
 	{
 		ui.CBTeamName->addItem((*it).replace(QRegExp("^(.*).cfg$"), "\\1"));
 	}
 
-
 	QFile settings(cfgdir.absolutePath() + "/options");
 	if (settings.open(QIODevice::ReadOnly))
 	{