Explorar o código

Fix RMG not getting callback when new map is created

Michał Zaremba hai 4 meses
pai
achega
af08091472
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      mapeditor/windownewmap.cpp

+ 5 - 3
mapeditor/windownewmap.cpp

@@ -275,6 +275,8 @@ void WindowNewMap::on_okButton_clicked()
 	saveUserSettings();
 
 	std::unique_ptr<CMap> nmap;
+	auto & mapController = static_cast<MainWindow *>(parent())->controller;
+
 	if(ui->randomMapCheck->isChecked())
 	{
 		//verify map template
@@ -290,7 +292,7 @@ void WindowNewMap::on_okButton_clicked()
 		if(ui->checkSeed->isChecked() && ui->lineSeed->value() != 0)
 			seed = ui->lineSeed->value();
 			
-		CMapGenerator generator(mapGenOptions, nullptr, seed);
+		CMapGenerator generator(mapGenOptions, mapController.getCallback(), seed);
 		auto progressBarWnd = new GeneratorProgress(generator, this);
 		progressBarWnd->show();
 	
@@ -312,8 +314,8 @@ void WindowNewMap::on_okButton_clicked()
 	}
 	
 	nmap->mods = MapController::modAssessmentMap(*nmap);
-	static_cast<MainWindow*>(parent())->controller.setMap(std::move(nmap));
-	static_cast<MainWindow*>(parent())->initializeMap(true);
+	mapController.setMap(std::move(nmap));
+	static_cast<MainWindow *>(parent())->initializeMap(true);
 	close();
 }