diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js index 7ba192da..dfb478fd 100644 --- a/modules/burgs-and-states.js +++ b/modules/burgs-and-states.js @@ -916,7 +916,9 @@ states.forEach(s => { s.provinces = []; if (!s.i || s.removed) return; - const stateBurgs = burgs.filter(b => b.state === s.i && !b.removed).sort((a, b) => b.population * gauss(1, .2, .5, 1.5, 3) - a.population); + const stateBurgs = burgs.filter(b => b.state === s.i && !b.removed) + .sort((a, b) => b.population * gauss(1, .2, .5, 1.5, 3) - a.population) + .sort((a, b) => b.capital - a.capital); if (stateBurgs.length < 2) return; // at least 2 provinces are required const provincesNumber = Math.max(Math.ceil(stateBurgs.length * percentage / 100), 2); const form = Object.assign({}, forms[s.form]); diff --git a/modules/ui/provinces-editor.js b/modules/ui/provinces-editor.js index b855ace2..a7916a46 100644 --- a/modules/ui/provinces-editor.js +++ b/modules/ui/provinces-editor.js @@ -125,7 +125,7 @@ function editProvinces() {
- + `; @@ -226,6 +226,8 @@ function editProvinces() { function declareProvinceIndependence(p) { const states = pack.states, provinces = pack.provinces, cells = pack.cells; + if (provinces[p].burgs.some(b => pack.burgs[b].capital)) {tip("Cannot declare independence of a province having capital burg. Please change capital first", false, "error"); return;} + const oldState = pack.provinces[p].state; const newState = pack.states.length;