1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Add seed option to rmg

This commit is contained in:
nordsoft 2022-09-19 02:42:38 +04:00
parent 0563828763
commit 3aa19f92a0
3 changed files with 56 additions and 12 deletions

View File

@ -235,7 +235,11 @@ void WindowNewMap::on_okButtong_clicked()
return;
}
CMapGenerator generator(mapGenOptions);
int seed = std::time(nullptr);
if(ui->checkSeed->isChecked() && !ui->lineSeed->text().isEmpty())
seed = ui->lineSeed->text().toInt();
CMapGenerator generator(mapGenOptions, seed);
auto progressBarWnd = new GeneratorProgress(generator, this);
progressBarWnd->show();
@ -403,3 +407,9 @@ void WindowNewMap::updateTemplateList()
ui->templateCombo->setCurrentIndex(0);
}
void WindowNewMap::on_checkSeed_toggled(bool checked)
{
ui->lineSeed->setEnabled(checked);
}

View File

@ -78,6 +78,8 @@ private slots:
void on_heightTxt_textChanged(const QString &arg1);
void on_checkSeed_toggled(bool checked);
private:
void updateTemplateList();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>448</width>
<height>379</height>
<width>444</width>
<height>445</height>
</rect>
</property>
<property name="sizePolicy">
@ -24,8 +24,8 @@
</property>
<property name="maximumSize">
<size>
<width>448</width>
<height>379</height>
<width>999</width>
<height>999</height>
</size>
</property>
<property name="windowTitle">
@ -40,7 +40,7 @@
<x>10</x>
<y>20</y>
<width>291</width>
<height>81</height>
<height>91</height>
</rect>
</property>
<property name="title">
@ -178,9 +178,9 @@
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<y>140</y>
<width>431</width>
<height>251</height>
<height>301</height>
</rect>
</property>
<property name="sizePolicy">
@ -415,7 +415,7 @@
<x>10</x>
<y>170</y>
<width>411</width>
<height>41</height>
<height>51</height>
</rect>
</property>
<property name="title">
@ -544,7 +544,7 @@
<x>10</x>
<y>120</y>
<width>411</width>
<height>41</height>
<height>51</height>
</rect>
</property>
<property name="sizePolicy">
@ -671,7 +671,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<y>230</y>
<width>411</width>
<height>32</height>
</rect>
@ -708,12 +708,44 @@
</item>
</layout>
</widget>
<widget class="QLineEdit" name="lineSeed">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>280</x>
<y>270</y>
<width>131</width>
<height>21</height>
</rect>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
<widget class="QCheckBox" name="checkSeed">
<property name="geometry">
<rect>
<x>110</x>
<y>270</y>
<width>161</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Custom seed</string>
</property>
</widget>
</widget>
<widget class="QCheckBox" name="randomMapCheck">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<y>120</y>
<width>291</width>
<height>20</height>
</rect>