Copypasta to hopefully hook up net sync correctly.
authornemo
Sun, 09 Nov 2014 16:38:26 -0500
changeset 10480 43c6b9cfb569
parent 10479 31afb7cdff69
child 10481 caf7a8f20b0b
Copypasta to hopefully hook up net sync correctly.
QTfrontend/ui/widget/gamecfgwidget.cpp
QTfrontend/ui/widget/gamecfgwidget.h
QTfrontend/ui/widget/mapContainer.cpp
QTfrontend/ui/widget/mapContainer.h
gameServer/CoreTypes.hs
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Sun Nov 09 15:52:09 2014 -0500
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Sun Nov 09 16:38:26 2014 -0500
@@ -163,6 +163,7 @@
     connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &)));
     connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator)));
     connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int)));
+    connect(pMapContainer, SIGNAL(mapFeatureSizeChanged(int)), this, SLOT(slMapFeatureSizeChanged(int)));
     connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &)));
     connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int)));
     connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap()));
@@ -403,6 +404,7 @@
 
     mapgenChanged(pMapContainer->get_mapgen());
     maze_sizeChanged(pMapContainer->getMazeSize());
+    slMapFeatureSizeChanged(pMapContainer->getFeatureSize());
 
     if(pMapContainer->get_mapgen() == 2)
         onDrawnMapChanged(pMapContainer->getDrawnMapData());
@@ -443,6 +445,11 @@
             pMapContainer->setMapgen((MapGenerator)value.toUInt());
             return;
         }
+        if (param == "FEATURE_SIZE")
+        {
+            pMapContainer->setFeatureSize(value.toUInt());
+            return;
+        }
         if (param == "MAZE_SIZE")
         {
             pMapContainer->setMazeSize(value.toUInt());
@@ -481,7 +488,8 @@
                 (MapGenerator)slValue[1].toUInt(),
                 slValue[2].toUInt(),
                 seed,
-                slValue[4].toUInt()
+                slValue[4].toUInt(),
+                slValue[5].toUInt()
             );
             return;
         }
@@ -672,6 +680,11 @@
     emit paramChanged("MAZE_SIZE", QStringList(QString::number(s)));
 }
 
+void GameCFGWidget::slMapFeatureSizeChanged(int s)
+{
+    emit paramChanged("FEATURE_SIZE", QStringList(QString::number(s)));
+}
+
 void GameCFGWidget::resendSchemeData()
 {
     schemeChanged(GameSchemes->currentIndex());
--- a/QTfrontend/ui/widget/gamecfgwidget.h	Sun Nov 09 15:52:09 2014 -0500
+++ b/QTfrontend/ui/widget/gamecfgwidget.h	Sun Nov 09 16:38:26 2014 -0500
@@ -76,6 +76,7 @@
         void jumpToWeapons();
         void mapgenChanged(MapGenerator m);
         void maze_sizeChanged(int s);
+        void slMapFeatureSizeChanged(int s);
         void onDrawnMapChanged(const QByteArray & data);
         void updateModelViews();
 
--- a/QTfrontend/ui/widget/mapContainer.cpp	Sun Nov 09 15:52:09 2014 -0500
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Sun Nov 09 16:38:26 2014 -0500
@@ -232,7 +232,7 @@
     mapFeatureSize->setValue(m_mapFeatureSize);
     mapFeatureSize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
     bottomLeftLayout->addWidget(mapFeatureSize, 0);
-    connect(mapFeatureSize, SIGNAL(valueChanged(int)), this, SLOT(mapFeatureSizeChanged(int)));
+    connect(mapFeatureSize, SIGNAL(valueChanged(int)), this, SLOT(setFeatureSize(int)));
 
     /* Mission description */
 
@@ -693,7 +693,7 @@
     }
 }
 
-void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl)
+void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl, int featureSize)
 {
     intSetMapgen(m);
     intSetMazeSize(mazesize);
@@ -701,6 +701,8 @@
     intSetTemplateFilter(tmpl);
     // this one last because it will refresh the preview
     intSetMap(map);
+    intSetMazeSize(mazesize);
+    intSetFeatureSize(featureSize);
 }
 
 void HWMapContainer::updateModelViews()
@@ -774,6 +776,7 @@
             mapgen = MAPGEN_DRAWN;
             setMapInfo(MapModel::MapInfoDrawn);
             btnLoadMap->show();
+            mapFeatureSize->hide();
             btnEditMap->show();
             break;
         case MapModel::MissionMap:
@@ -783,7 +786,7 @@
             lblMapList->setText(tr("Mission:"));
             lblMapList->show();
             missionMapList->show();
-	    mapFeatureSize->hide();
+            mapFeatureSize->hide();
             lblDesc->setText(m_mapInfo.desc);
             lblDesc->show();
             emit mapChanged(m_curMap);
@@ -794,6 +797,7 @@
             staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex());
             lblMapList->setText(tr("Map:"));
             lblMapList->show();
+            mapFeatureSize->hide();
             staticMapList->show();
             emit mapChanged(m_curMap);
             break;
@@ -819,10 +823,15 @@
     emit mapgenChanged(mapgen);
 }
 
-void HWMapContainer::mapFeatureSizeChanged(int val)
+void HWMapContainer::intSetFeatureSize(int val)
+{
+    mapFeatureSize->setValue(val);    
+    emit mapFeatureSizeChanged(val);
+}
+void HWMapContainer::setFeatureSize(int val)
 {
     m_mapFeatureSize = val;
-    // needs to be per map type, scales will be different
+    intSetFeatureSize(val);
     //m_mapFeatureSize = val>>2<<2;
     //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4)
     {
@@ -834,7 +843,7 @@
 // unused because I needed the space for the slider
 void HWMapContainer::updateThemeButtonSize()
 {
-    if (m_mapInfo.type != MapModel::StaticMap)
+    if (m_mapInfo.type != MapModel::StaticMap && m_mapInfo.type != MapModel::HandDrawnMap)
     {
         btnTheme->setIconSize(QSize(30, 30));
         btnTheme->setFixedHeight(30);
--- a/QTfrontend/ui/widget/mapContainer.h	Sun Nov 09 15:52:09 2014 -0500
+++ b/QTfrontend/ui/widget/mapContainer.h	Sun Nov 09 16:38:26 2014 -0500
@@ -79,8 +79,9 @@
         void setTemplateFilter(int);
         void setMapgen(MapGenerator m);
         void setMazeSize(int size);
+        void setFeatureSize(int size);
         void setDrawnMapData(const QByteArray & ar);
-        void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl);
+        void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl, int featureSize);
         void updateModelViews();
         void onPreviewMapDestroyed(QObject * map);
         void setMaster(bool master);
@@ -92,6 +93,7 @@
         void newTemplateFilter(int filter);
         void mapgenChanged(MapGenerator m);
         void mazeSizeChanged(int s);
+        void mapFeatureSizeChanged(int s);
         void drawMapRequested();
         void drawnMapChanged(const QByteArray & data);
 
@@ -104,7 +106,6 @@
         void addInfoToPreview(const QPixmap & image);
         void setNewSeed(const QString & newSeed);
         void mapTypeChanged(int);
-        void mapFeatureSizeChanged(int);
         void showThemePrompt();
         void updateTheme(const QModelIndex & current);
         void staticMapChanged(const QModelIndex & map, const QModelIndex & old = QModelIndex());
@@ -165,6 +166,7 @@
         void intSetMapgen(MapGenerator m);
         void intSetTemplateFilter(int);
         void intSetMazeSize(int size);
+        void intSetFeatureSize(int size);
         void intSetIconlessTheme(const QString & name);
         void mapChanged(const QModelIndex & map, int type, const QModelIndex & old = QModelIndex());
         void setMapInfo(MapModel::MapInfo mapInfo);
--- a/gameServer/CoreTypes.hs	Sun Nov 09 15:52:09 2014 -0500
+++ b/gameServer/CoreTypes.hs	Sun Nov 09 16:38:26 2014 -0500
@@ -250,8 +250,8 @@
         []
         (
             Map.fromList $ Prelude.zip
-                ["MAP", "MAPGEN", "MAZE_SIZE", "SEED", "TEMPLATE"]
-                ["+rnd+", "0", "0", "seed", "0"]
+                ["MAP", "MAPGEN", "MAZE_SIZE", "SEED", "TEMPLATE", "FEATURE_SIZE"]
+                ["+rnd+", "0", "0", "seed", "0", "12"]
         )
         (
             Map.fromList $ Prelude.zip