QTfrontend/gamecfgwidget.cpp
changeset 4936 d65d438acd23
parent 4720 a9f9c96db60c
child 4941 90572c338e60
equal deleted inserted replaced
4935:27fb500dd6b1 4936:d65d438acd23
    31 #include "hwconsts.h"
    31 #include "hwconsts.h"
    32 #include "ammoSchemeModel.h"
    32 #include "ammoSchemeModel.h"
    33 #include "proto.h"
    33 #include "proto.h"
    34 
    34 
    35 GameCFGWidget::GameCFGWidget(QWidget* parent) :
    35 GameCFGWidget::GameCFGWidget(QWidget* parent) :
    36   QGroupBox(parent), mainLayout(this)
    36   QGroupBox(parent)
       
    37   , mainLayout(this)
       
    38   , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}")
    37 {
    39 {
    38     mainLayout.setMargin(0);
    40     mainLayout.setMargin(0);
    39 //  mainLayout.setSizeConstraint(QLayout::SetMinimumSize);
    41 //  mainLayout.setSizeConstraint(QLayout::SetMinimumSize);
    40 
    42 
    41     pMapContainer = new HWMapContainer(this);
    43     pMapContainer = new HWMapContainer(this);
   330             pMapContainer->setMap(value);
   332             pMapContainer->setMap(value);
   331             return;
   333             return;
   332         }
   334         }
   333         if (param == "SEED") {
   335         if (param == "SEED") {
   334             pMapContainer->setSeed(value);
   336             pMapContainer->setSeed(value);
   335             if (!QRegExp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}").exactMatch(value)) {
   337             if (!seedRegexp.exactMatch(value)) {
   336                 pMapContainer->seedEdit->setVisible(true);
   338                 pMapContainer->seedEdit->setVisible(true);
   337                 }
   339                 }
   338             return;
   340             return;
   339         }
   341         }
   340         if (param == "THEME") {
   342         if (param == "THEME") {
   365 
   367 
   366     if (slValue.size() == 2)
   368     if (slValue.size() == 2)
   367     {
   369     {
   368         if (param == "AMMO") {
   370         if (param == "AMMO") {
   369             setNetAmmo(slValue[0], slValue[1]);
   371             setNetAmmo(slValue[0], slValue[1]);
       
   372             return;
       
   373         }
       
   374     }
       
   375 
       
   376     if (slValue.size() == 3)
       
   377     {
       
   378         if (param == "FULLGENCFG")
       
   379         {
       
   380             QString seed = slValue[2];
       
   381             if (!seedRegexp.exactMatch(seed))
       
   382                 pMapContainer->seedEdit->setVisible(true);
       
   383 
       
   384             pMapContainer->setMapMapgenSeed(slValue[0], (MapGenerator)slValue[1].toUInt(), seed);
   370             return;
   385             return;
   371         }
   386         }
   372     }
   387     }
   373 
   388 
   374     qWarning("Got bad config param from net");
   389     qWarning("Got bad config param from net");