qmlfrontend/hwengine.cpp
changeset 15891 d52f5d8e75e6
parent 14373 4409344db447
--- a/qmlfrontend/hwengine.cpp	Sat Nov 12 15:40:20 2022 +0100
+++ b/qmlfrontend/hwengine.cpp	Sat Nov 12 21:12:14 2022 +0100
@@ -9,7 +9,7 @@
 #include "game_view.h"
 #include "preview_acceptor.h"
 
-HWEngine::HWEngine(QObject* parent) : QObject(parent) {}
+HWEngine::HWEngine(QObject* parent) : QObject(parent), m_dataPath{QStringLiteral("Data")} {}
 
 HWEngine::~HWEngine() {}
 
@@ -19,7 +19,7 @@
   m_gameConfig = GameConfig();
   m_gameConfig.cmdSeed(QUuid::createUuid().toByteArray());
 
-  EngineInstance engine(m_engineLibrary);
+  EngineInstance engine(m_engineLibrary, m_dataPath);
   if (!engine.isValid())  // TODO: error notification
     return;
 
@@ -43,7 +43,8 @@
   m_gameConfig.cmdTeam(team1);
   m_gameConfig.cmdTeam(team2);
 
-  EngineInstance* engine = new EngineInstance(m_engineLibrary, this);
+  EngineInstance* engine = new EngineInstance(m_engineLibrary, m_dataPath, this);
+  engine->sendConfig(m_gameConfig);
 
   return engine;
   // m_runQueue->queue(m_gameConfig);
@@ -68,3 +69,16 @@
   m_engineLibrary = engineLibrary;
   emit engineLibraryChanged(m_engineLibrary);
 }
+
+const QString &HWEngine::dataPath() const
+{
+  return m_dataPath;
+}
+
+void HWEngine::setDataPath(const QString &newDataPath)
+{
+  if (m_dataPath == newDataPath)
+    return;
+  m_dataPath = newDataPath;
+  emit dataPathChanged();
+}