--- a/QTfrontend/game.cpp Fri Sep 15 15:45:30 2006 +0000
+++ b/QTfrontend/game.cpp Fri Sep 15 20:38:25 2006 +0000
@@ -73,7 +73,7 @@
void HWGame::ClientDisconnect()
{
- SaveDemo("demo.hwd_1");
+ SaveDemo(cfgdir->absolutePath() + "/Demos/demo.hwd_1");
IPCSocket->deleteLater();
IPCSocket = 0;
deleteLater();
@@ -97,7 +97,7 @@
LocalCFG(teams[i]);
SendIPC(QString("ecolor %1").arg(65535 << i * 8));
for (int t = 0; t < hdNum[teams[i]]; t++)
- SendIPC(QString("eadd hh%1 0").arg(t));
+ SendIPC(QString("eadd hh%1 1").arg(t));
}
}
--- a/QTfrontend/main.cpp Fri Sep 15 15:45:30 2006 +0000
+++ b/QTfrontend/main.cpp Fri Sep 15 20:38:25 2006 +0000
@@ -44,6 +44,21 @@
QDir * cfgdir;
QDir * datadir;
+bool checkForDir(const QString & dir)
+{
+ QDir tmpdir;
+ if (!tmpdir.exists(dir))
+ if (!tmpdir.mkdir(dir))
+ {
+ QMessageBox::critical(0,
+ QObject::tr("Error"),
+ QObject::tr("Cannot create directory %1").arg(dir),
+ QObject::tr("OK"));
+ return false;
+ }
+ return true;
+}
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
@@ -65,15 +80,9 @@
cfgdir = new QDir();
cfgdir->setPath(cfgdir->homePath());
- if (!cfgdir->exists(".hedgewars"))
+ if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
{
- if (!cfgdir->mkdir(".hedgewars"))
- {
- QMessageBox::critical(0,
- QObject::tr("Error"),
- QObject::tr("Cannot create directory %1").arg("/.hedgewars"),
- QObject::tr("Quit"));
- }
+ checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
}
cfgdir->cd(".hedgewars");
--- a/QTfrontend/main.cpp.in Fri Sep 15 15:45:30 2006 +0000
+++ b/QTfrontend/main.cpp.in Fri Sep 15 20:38:25 2006 +0000
@@ -44,6 +44,21 @@
QDir * cfgdir;
QDir * datadir;
+bool checkForDir(const QString & dir)
+{
+ QDir tmpdir;
+ if (!tmpdir.exists(dir))
+ if (!tmpdir.mkdir(dir))
+ {
+ QMessageBox::critical(0,
+ QObject::tr("Error"),
+ QObject::tr("Cannot create directory %1").arg(dir),
+ QObject::tr("OK"));
+ return false;
+ }
+ return true;
+}
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
@@ -60,20 +75,14 @@
QDir mydir("${HEDGEWARS_BINDIR}");
mydir.cd("bin");
-
+
bindir = new QDir(mydir);
cfgdir = new QDir();
cfgdir->setPath(cfgdir->homePath());
- if (!cfgdir->exists(".hedgewars"))
+ if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
{
- if (!cfgdir->mkdir(".hedgewars"))
- {
- QMessageBox::critical(0,
- QObject::tr("Error"),
- QObject::tr("Cannot create directory %1").arg("/.hedgewars"),
- QObject::tr("Quit"));
- }
+ checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
}
cfgdir->cd(".hedgewars");