mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
Randomize seed checkbox (#10782)
* randomize seed checkbox working * don't reseed when checking the box
This commit is contained in:
parent
3b7974942c
commit
f1bd13c80c
@ -66,7 +66,10 @@ class MapEditorGenerateTab(
|
||||
}
|
||||
|
||||
private fun generate(step: MapGeneratorSteps) {
|
||||
if (step <= MapGeneratorSteps.Landmass && step in seedUsedForStep) {
|
||||
if (step == MapGeneratorSteps.All && newTab.mapParametersTable.randomizeSeed) {
|
||||
newTab.mapParametersTable.reseed()
|
||||
}
|
||||
if (step == MapGeneratorSteps.Landmass && step in seedUsedForStep) {
|
||||
// reseed visibly when starting from scratch (new seed shows in advanced settings widget)
|
||||
newTab.mapParametersTable.reseed()
|
||||
seedUsedForStep -= step
|
||||
@ -92,7 +95,7 @@ class MapEditorGenerateTab(
|
||||
|
||||
if (step in seedUsedForStep) {
|
||||
mapParameters.reseed()
|
||||
} else {
|
||||
} else if (step != MapGeneratorSteps.All){
|
||||
seedUsedForStep += step
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,9 @@ class MapParametersTable(
|
||||
// overrides nor is a Widget a data class. Seems to work anyway.
|
||||
private val advancedSliders = HashMap<UncivSlider, ()->Float>()
|
||||
|
||||
// used only in map editor (forMapEditor == true)
|
||||
var randomizeSeed = true
|
||||
|
||||
init {
|
||||
update()
|
||||
}
|
||||
@ -386,6 +389,17 @@ class MapParametersTable(
|
||||
table.add(button).colspan(2).padTop(10f).row()
|
||||
}
|
||||
|
||||
fun addCheckBox(text: String, initialState: Boolean, action: ((Boolean) -> Unit)) {
|
||||
val checkbox = text.toCheckBox(initialState){
|
||||
action(it)
|
||||
}
|
||||
table.add(checkbox).colspan(2).row()
|
||||
}
|
||||
if (forMapEditor) {
|
||||
addCheckBox("Randomize seed", true) {
|
||||
randomizeSeed = it
|
||||
}
|
||||
}
|
||||
addSlider("Map Elevation", {mapParameters.elevationExponent}, 0.6f, 0.8f)
|
||||
{ mapParameters.elevationExponent = it }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user