mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
Speedup generating empty map
This commit is contained in:
parent
2aab315f9c
commit
355df51033
@ -57,10 +57,7 @@ std::unique_ptr<CMap> generateEmptyMap(CMapGenOptions & options)
|
|||||||
|
|
||||||
map->initTerrain();
|
map->initTerrain();
|
||||||
map->getEditManager()->clearTerrain(&CRandomGenerator::getDefault());
|
map->getEditManager()->clearTerrain(&CRandomGenerator::getDefault());
|
||||||
map->getEditManager()->getTerrainSelection().selectRange(MapRect(int3(0, 0, 0), options.getWidth(), options.getHeight()));
|
|
||||||
map->getEditManager()->drawTerrain(Terrain("grass"), &CRandomGenerator::getDefault());
|
|
||||||
|
|
||||||
//window->controller.setMap(std::move(map));
|
|
||||||
return std::move(map);
|
return std::move(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,12 +96,6 @@ void WindowNewMap::on_okButtong_clicked()
|
|||||||
auto progressBarWnd = new GeneratorProgress(generator, this);
|
auto progressBarWnd = new GeneratorProgress(generator, this);
|
||||||
progressBarWnd->show();
|
progressBarWnd->show();
|
||||||
|
|
||||||
|
|
||||||
//std::thread generate(&::generateRandomMap, std::ref(generator), static_cast<MainWindow*>(parent()));
|
|
||||||
//progressBarWnd->update();
|
|
||||||
//generate.join();
|
|
||||||
|
|
||||||
//generateRandomMap(generator, static_cast<MainWindow*>(parent()));
|
|
||||||
auto f = std::async(std::launch::async, &CMapGenerator::generate, &generator);
|
auto f = std::async(std::launch::async, &CMapGenerator::generate, &generator);
|
||||||
progressBarWnd->update();
|
progressBarWnd->update();
|
||||||
nmap = f.get();
|
nmap = f.get();
|
||||||
@ -113,7 +104,6 @@ void WindowNewMap::on_okButtong_clicked()
|
|||||||
{
|
{
|
||||||
auto f = std::async(std::launch::async, &::generateEmptyMap, std::ref(mapGenOptions));
|
auto f = std::async(std::launch::async, &::generateEmptyMap, std::ref(mapGenOptions));
|
||||||
nmap = f.get();
|
nmap = f.get();
|
||||||
//nmap = generateEmptyMap(mapGenOptions, static_cast<MainWindow*>(parent()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user