qmlfrontend/game_config.cpp
changeset 14278 645e4591361f
parent 14159 8354b390f1a2
child 14279 0ae9885e1535
equal deleted inserted replaced
14277:3152d9fdb499 14278:645e4591361f
     1 #include "game_config.h"
     1 #include "game_config.h"
     2 
     2 
     3 GameConfig::GameConfig() : m_isPreview(true) { setPreview(m_isPreview); }
     3 GameConfig::GameConfig() {}
     4 
     4 
     5 const char** GameConfig::argv() const {
     5 const char** GameConfig::argv() const {
     6   m_argv.resize(m_arguments.size());
     6   m_argv.resize(m_arguments.size());
     7 
     7 
     8   for (int i = 0; i < m_arguments.size(); ++i)
     8   for (int i = 0; i < m_arguments.size(); ++i)
    51   cfgAppend(
    51   cfgAppend(
    52       "eammreinf 1311110312111111123114111111111111111211111111111111111111");
    52       "eammreinf 1311110312111111123114111111111111111211111111111111111111");
    53   cfgAppend("eammstore");
    53   cfgAppend("eammstore");
    54 }
    54 }
    55 
    55 
    56 bool GameConfig::isPreview() const { return m_isPreview; }
       
    57 
       
    58 void GameConfig::setPreview(bool isPreview) {
       
    59   m_isPreview = isPreview;
       
    60 
       
    61   m_arguments.clear();
       
    62 
       
    63   if (m_isPreview) {
       
    64     m_arguments << ""
       
    65                 << "--internal"
       
    66                 << "--landpreview";
       
    67 
       
    68   } else {
       
    69     m_arguments << ""
       
    70                 << "--internal"
       
    71                 << "--nomusic";
       
    72   }
       
    73 }
       
    74 
       
    75 void GameConfig::cfgAppend(const QByteArray& cmd) {
    56 void GameConfig::cfgAppend(const QByteArray& cmd) {
    76   Q_ASSERT(cmd.size() < 256);
    57   Q_ASSERT(cmd.size() < 256);
    77 
    58 
    78   quint8 len = cmd.size();
    59   quint8 len = cmd.size();
    79   m_cfg.append(QByteArray::fromRawData(reinterpret_cast<const char*>(&len), 1) +
    60   m_cfg.append(QByteArray::fromRawData(reinterpret_cast<const char*>(&len), 1) +