Add the ability to regenerate cultures

- Added a button to the tools menu for regeneration.
- Regeneration button will handle initial generation of cultures and expansion afterwards.
- Pressing regenerate will warn the user.
- Small cleanup of trailing whitespace.
This commit is contained in:
Michael DiRienzo 2020-07-06 17:52:42 -04:00
parent edb8469216
commit 9dd4d47ad8
2 changed files with 13 additions and 5 deletions

View file

@ -1861,6 +1861,7 @@
<button id="regenerateStates" data-tip="Click to select new capitals and regenerate states. Military forces will be regenerated as well, burgs will remain as they are">States</button>
<button id="regenerateProvinces" data-tip="Click to regenerate provinces. States will remain as they are">Provinces</button>
<button id="regenerateReligions" data-tip="Click to regenerate religions">Religions</button>
<button id="regenerateCultures" data-tip="Click to regenerate cultures">Cultures</button>
<button id="regenerateMilitary" data-tip="Click to recalculate military forces based on current military options">Military</button>
<button id="regenerateIce" data-tip="Click to icebergs and glaciers">Ice</button>
<button id="regenerateMarkers" data-tip="Click to regenerate markers. Hold Ctrl and click to set markers number multiplier">Markers</button>

View file

@ -64,6 +64,7 @@ function processFeatureRegeneration(event, button) {
if (button === "regenerateStates") regenerateStates(); else
if (button === "regenerateProvinces") regenerateProvinces(); else
if (button === "regenerateReligions") regenerateReligions(); else
if (button === "regenerateCultures") regenerateCultures(); else
if (button === "regenerateMilitary") regenerateMilitary(); else
if (button === "regenerateIce") regenerateIce(); else
if (button === "regenerateMarkers") regenerateMarkers(event); else
@ -244,6 +245,12 @@ function regenerateReligions() {
if (!layerIsOn("toggleReligions")) toggleReligions(); else drawReligions();
}
function regenerateCultures() {
Cultures.generate();
Cultures.expand();
if (!layerIsOn("toggleCultures")) toggleCultures(); else drawCultures();
}
function regenerateMilitary() {
Military.generate();
if (!layerIsOn("toggleMilitary")) toggleMilitary();