Selecting map works in net game
authorunc0rr
Sun, 14 Jan 2007 18:32:44 +0000
changeset 331 6bfc326e4976
parent 330 09cfe028a629
child 332 10080f681118
Selecting map works in net game
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
--- a/QTfrontend/mapContainer.cpp	Sun Jan 14 15:58:18 2007 +0000
+++ b/QTfrontend/mapContainer.cpp	Sun Jan 14 18:32:44 2007 +0000
@@ -81,6 +81,13 @@
     return;
   }
 
+  loadMap(index);
+
+  emit mapChanged(chooseMap->currentText());
+}
+
+void HWMapContainer::loadMap(int index)
+{
   QPixmap mapImage;
   if(!mapImage.load(datadir->absolutePath() + "/Maps/" + chooseMap->currentText() + "/map.png")) {
     changeImage();
@@ -94,7 +101,6 @@
     input >> theme;
     mapCfgFile.close();
   }
-  emit mapChanged(chooseMap->currentText());
 }
 
 void HWMapContainer::changeImage()
@@ -134,7 +140,11 @@
 
 void HWMapContainer::setMap(const QString & map)
 {
-
+	int id = chooseMap->findText(map);
+	if(id >= 0) {
+		chooseMap->setCurrentIndex(id);
+		loadMap(id);
+	}
 }
 
 void HWMapContainer::setTheme(const QString & theme)
--- a/QTfrontend/mapContainer.h	Sun Jan 14 15:58:18 2007 +0000
+++ b/QTfrontend/mapContainer.h	Sun Jan 14 18:32:44 2007 +0000
@@ -68,6 +68,8 @@
   HWMap* pMap;
   QString m_seed;
   QString theme;
+
+  void loadMap(int index);
 };
 
 #endif // _HWMAP_CONTAINER_INCLUDED