diff --git a/index.html b/index.html index 17288dc6..95ae5a63 100644 --- a/index.html +++ b/index.html @@ -1520,7 +1520,7 @@
Map settings (new map to apply):
| Canvas size |
@@ -2661,51 +2661,52 @@
Form name:
@@ -3302,7 +3303,7 @@
- Equirectangular projection is used
+ Equirectangular projection is used
diff --git a/main.js b/main.js
index 75fd8841..c9d25dca 100644
--- a/main.js
+++ b/main.js
@@ -115,9 +115,8 @@ let scale = 1, viewX = 0, viewY = 0;
const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", zoomed);
applyStoredOptions();
-let graphWidth = +mapWidthInput.value; // voronoi graph extention, should be stable for each map
-let graphHeight = +mapHeightInput.value;
-let svgWidth = graphWidth, svgHeight = graphHeight; // svg canvas resolution, can vary for each map
+let graphWidth = +mapWidthInput.value, graphHeight = +mapHeightInput.value; // voronoi graph extention, cannot be changed arter generation
+let svgWidth = graphWidth, svgHeight = graphHeight; // svg canvas resolution, can be changed
landmass.append("rect").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
oceanPattern.append("rect").attr("fill", "url(#oceanic)").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
oceanLayers.append("rect").attr("id", "oceanBase").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight);
diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js
index c8a175d8..019d00f1 100644
--- a/modules/burgs-and-states.js
+++ b/modules/burgs-and-states.js
@@ -758,6 +758,15 @@
for (const s of states) {
if (list && !list.includes(s.i)) continue;
+
+ // some nomadic states
+ if (s.type === "Nomadic" && P(.8)) {
+ s.form = "Horde";
+ s.formName = expTiers[s.i] > 2 ? "United Hordes" : "Horde";
+ s.fullName = getFullName(s);
+ continue;
+ }
+
const religion = pack.cells.religion[s.center];
const theocracy = religion && pack.religions[religion].expansion === "state" || (P(.1) && pack.religions[religion].type === "Organized");
s.form = theocracy ? "Theocracy" : s.type === "Naval" ? ra(navalArray) : ra(genericArray);
@@ -767,7 +776,6 @@
function selectForm(s) {
const base = pack.cultures[s.culture].base;
- if (s.type === "Nomadic" && P(.3)) return "Horde"; // some nomadic states
if (s.form === "Monarchy") {
const form = monarchy[expTiers[s.i]];
@@ -842,7 +850,8 @@
Republic:{Province:6, Department:2, Governorate:2, State:1, Canton:1, Prefecture:1},
Theocracy:{Parish:5, Deanery:3, Province:2, Council:1, District:1},
Union:{Province:2, State:1, Canton:1, Republic:1, County:1},
- Wild:{Territory:6, Land:3, Province:1, Region:1}
+ Wild:{Territory:10, Land:5, Province:2, Region:2, Tribe:1, Clan:1},
+ Horde:{Horde:1}
}
// generate provinces for a selected burgs
diff --git a/modules/ui/general.js b/modules/ui/general.js
index adb2771c..a970b0bf 100644
--- a/modules/ui/general.js
+++ b/modules/ui/general.js
@@ -3,6 +3,7 @@
// fit full-screen map if window is resized
$(window).resize(function(e) {
+ if (localStorage.getItem("mapWidth") && localStorage.getItem("mapHeight")) return;
mapWidthInput.value = window.innerWidth;
mapHeightInput.value = window.innerHeight;
changeMapSize();
diff --git a/modules/ui/options.js b/modules/ui/options.js
index 8e9e407e..eaaee940 100644
--- a/modules/ui/options.js
+++ b/modules/ui/options.js
@@ -134,8 +134,8 @@ function mapSizeInputChange() {
// change svg size on manual size change or window resize, do not change graph size
function changeMapSize() {
- const svgWidth = Math.min(+mapWidthInput.value, window.innerWidth);
- const svgHeight = Math.min(+mapHeightInput.value, window.innerHeight);
+ svgWidth = Math.min(+mapWidthInput.value, window.innerWidth);
+ svgHeight = Math.min(+mapHeightInput.value, window.innerHeight);
svg.attr("width", svgWidth).attr("height", svgHeight);
const maxWidth = Math.max(+mapWidthInput.value, graphWidth);
diff --git a/modules/ui/states-editor.js b/modules/ui/states-editor.js
index 40a5723b..9011e098 100644
--- a/modules/ui/states-editor.js
+++ b/modules/ui/states-editor.js
@@ -275,10 +275,24 @@ function editStates() {
}
function applyNameChange(s) {
- s.name = document.getElementById("stateNameEditorShort").value;
- s.formName = document.getElementById("stateNameEditorSelectForm").value;
- s.fullName = document.getElementById("stateNameEditorFull").value;
- if (stateNameEditorUpdateLabel.checked) BurgsAndStates.drawStateLabels([s.i]);
+ const nameInput = document.getElementById("stateNameEditorShort");
+ const formSelect = document.getElementById("stateNameEditorSelectForm");
+ const fullNameInput = document.getElementById("stateNameEditorFull");
+
+ const nameChanged = nameInput.value !== s.name;
+ const formChanged = formSelect.value !== s.formName;
+ const fullNameChanged = fullNameInput.value !== s.fullName;
+ const changed = nameChanged || formChanged || fullNameChanged;
+
+ if (formChanged) {
+ const form = formSelect.selectedOptions[0].dataset.form || null;
+ if (form) s.form = form;
+ }
+
+ s.name = nameInput.value;
+ s.formName = formSelect.value;
+ s.fullName = fullNameInput.value;
+ if (changed && stateNameEditorUpdateLabel.checked) BurgsAndStates.drawStateLabels([s.i]);
refreshStatesEditor();
}
}
|