12858
|
1 |
#include "gameconfig.h"
|
|
2 |
|
12859
|
3 |
GameConfig::GameConfig()
|
|
4 |
{
|
|
5 |
m_arguments
|
|
6 |
<< ""
|
|
7 |
<< "--internal"
|
|
8 |
<< "--landpreview";
|
|
9 |
}
|
|
10 |
|
|
11 |
const char** GameConfig::argv() const
|
|
12 |
{
|
|
13 |
m_argv.resize(m_arguments.size());
|
|
14 |
|
|
15 |
for (int i = 0; i < m_arguments.size(); ++i)
|
|
16 |
m_argv[i] = m_arguments[i].data();
|
|
17 |
|
|
18 |
return m_argv.data();
|
|
19 |
}
|
|
20 |
|
|
21 |
int GameConfig::argc() const
|
12858
|
22 |
{
|
12859
|
23 |
return m_arguments.size();
|
|
24 |
}
|
12858
|
25 |
|
12860
|
26 |
const QList<QByteArray> GameConfig::config() const
|
|
27 |
{
|
|
28 |
QList<QByteArray> cfg = m_cfg;
|
|
29 |
cfg.append("\x01!");
|
|
30 |
return cfg;
|
|
31 |
}
|
|
32 |
|
12859
|
33 |
void GameConfig::clear()
|
|
34 |
{
|
|
35 |
m_arguments.clear();
|
|
36 |
m_cfg.clear();
|
12858
|
37 |
}
|
12859
|
38 |
|
|
39 |
void GameConfig::cmdSeed(const QByteArray& seed)
|
|
40 |
{
|
|
41 |
cfgAppend("eseed " + seed);
|
|
42 |
}
|
|
43 |
|
|
44 |
void GameConfig::cmdMapgen(int mapgen)
|
|
45 |
{
|
|
46 |
cfgAppend("e$mapgen " + QByteArray::number(mapgen));
|
|
47 |
}
|
|
48 |
|
|
49 |
void GameConfig::cfgAppend(const QByteArray& cmd)
|
|
50 |
{
|
|
51 |
quint8 len = cmd.size();
|
|
52 |
m_cfg.append(QByteArray::fromRawData(reinterpret_cast<const char*>(&len), 1) + cmd);
|
|
53 |
}
|