1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix RMG not getting callback when new map is created

This commit is contained in:
Michał Zaremba
2025-06-17 19:15:18 +02:00
parent a7732db0fe
commit af08091472

View File

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