--- a/qmlfrontend/gameconfig.cpp Sun Dec 24 00:44:16 2017 +0100
+++ b/qmlfrontend/gameconfig.cpp Sun Dec 24 16:56:22 2017 +0100
@@ -1,6 +1,46 @@
#include "gameconfig.h"
-GameConfig::GameConfig(QObject *parent) : QObject(parent)
+GameConfig::GameConfig()
+{
+ m_arguments
+ << ""
+ << "--internal"
+ << "--landpreview";
+}
+
+const char** GameConfig::argv() const
+{
+ m_argv.resize(m_arguments.size());
+
+ for (int i = 0; i < m_arguments.size(); ++i)
+ m_argv[i] = m_arguments[i].data();
+
+ return m_argv.data();
+}
+
+int GameConfig::argc() const
{
+ return m_arguments.size();
+}
+void GameConfig::clear()
+{
+ m_arguments.clear();
+ m_cfg.clear();
}
+
+void GameConfig::cmdSeed(const QByteArray& seed)
+{
+ cfgAppend("eseed " + seed);
+}
+
+void GameConfig::cmdMapgen(int mapgen)
+{
+ cfgAppend("e$mapgen " + QByteArray::number(mapgen));
+}
+
+void GameConfig::cfgAppend(const QByteArray& cmd)
+{
+ quint8 len = cmd.size();
+ m_cfg.append(QByteArray::fromRawData(reinterpret_cast<const char*>(&len), 1) + cmd);
+}