fix multiplayer script loading
authorsheepluva
Fri, 21 Oct 2011 20:58:49 +0200
changeset 6174 2d5717595471
parent 6173 6cb88fec7a79
child 6175 a80833ddaef0
fix multiplayer script loading
QTfrontend/main.cpp
QTfrontend/ui/widget/gamecfgwidget.cpp
--- a/QTfrontend/main.cpp	Fri Oct 21 19:37:45 2011 +0200
+++ b/QTfrontend/main.cpp	Fri Oct 21 20:58:49 2011 +0200
@@ -447,7 +447,7 @@
  
     scriptList = new QStringList(HWDataManager::instance().entryList(
                                      QString("Scripts/Multiplayer"),
-                                     QDir::Dirs | QDir::NoDotAndDotDot,
+                                     QDir::Files,
                                      QStringList("*.lua")
                                      )
                                  );
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Fri Oct 21 19:37:45 2011 +0200
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Fri Oct 21 20:58:49 2011 +0200
@@ -28,6 +28,7 @@
 
 #include "gamecfgwidget.h"
 #include "igbox.h"
+#include "HWDataManager.h"
 #include "hwconsts.h"
 #include "ammoSchemeModel.h"
 #include "proto.h"
@@ -62,9 +63,8 @@
         QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive);
         QList<QVariant> scriptInfo;
         scriptInfo.push_back(script);
-        QFile scriptCfgFile;
-        scriptCfgFile.setFileName(QString("%1/Data/Scripts/Multiplayer/%2.cfg").arg(cfgdir->absolutePath()).arg(script));
-        if (!scriptCfgFile.exists()) scriptCfgFile.setFileName(QString("%1/Scripts/Multiplayer/%2.cfg").arg(datadir->absolutePath()).arg(script));
+        QFile scriptCfgFile(HWDataManager::instance().findFileForRead(
+            QString("Scripts/Multiplayer/%2.cfg").arg(script)));
         if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) {
             QString scheme;
             QString weapons;