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 |
|
12859
|
26 |
void GameConfig::clear()
|
|
27 |
{
|
|
28 |
m_arguments.clear();
|
|
29 |
m_cfg.clear();
|
12858
|
30 |
}
|
12859
|
31 |
|
|
32 |
void GameConfig::cmdSeed(const QByteArray& seed)
|
|
33 |
{
|
|
34 |
cfgAppend("eseed " + seed);
|
|
35 |
}
|
|
36 |
|
|
37 |
void GameConfig::cmdMapgen(int mapgen)
|
|
38 |
{
|
|
39 |
cfgAppend("e$mapgen " + QByteArray::number(mapgen));
|
|
40 |
}
|
|
41 |
|
|
42 |
void GameConfig::cfgAppend(const QByteArray& cmd)
|
|
43 |
{
|
|
44 |
quint8 len = cmd.size();
|
|
45 |
m_cfg.append(QByteArray::fromRawData(reinterpret_cast<const char*>(&len), 1) + cmd);
|
|
46 |
}
|