mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
Dev submaps (#770)
* bioms shouldn't be masked or the style selection box is useless * fix: misleading comment * experimental submapping feature * burg remapping * Submap with options * Fix: calculating absolute flux from precipitation normal-value. * effective distanceScale * updated resampler * fix: missing cell * Fix: River automatic rerender on regeneration. * FIX: wrong culture migration * fixed 0 index burg bug, more accurate coast detection for burgs * FIX: wrong burg cell id * fix invalid feature number at burg.ports, option to disable regenerations * Relocate submap * update height model and scale parameters * new menu * Dropbox OAuth implementation and Cloud framework * add some space * removing uneccesary logs, defer script load * map position on planet, fix wrong riverbed generation * fix:riverbed generation * better cell sampler * Auto-Smoothing,dist fix * FIX: incorrect province copy and minor fix of rebels * Cleanup * FIX: water detection bug * Recompute centers (states, cultures, provinces) * activating forwardmap * FIX: port burg relocation algo * FIX: coast detection (for burgs) * Fix: invalid html id * add dot * update for FMG 1.73 * Update submap gui * refactored submap ui options * Copy all visible military units from the old map. * add info text * Add Markers.deleteMarker API. * Lock markers and lock burgs options * better comment * submapper gui updates, remove feature mapping on/off * Fix typo (thx evolvedexperiment) * fix ugly GUI (2 digit roundoff) * resample dialog * Town Promotion to largetown * don't promote to capitals. * Fix typo * round style settings * do not draw removed burgs * Fix port cell search algo * Fix: robust error handling, no error for 0. * submap: projection moved to options, fix double burg error * complete rewrite of burg relocation * findcell by coordinates * prepare to merge, add comments, remove fluff * replacing lodash with deepCopy implementation Co-authored-by: Mészáros Gergely <monk@geotronic.hu>
This commit is contained in:
parent
3cbd451df9
commit
5703e62177
16 changed files with 741 additions and 53 deletions
|
|
@ -157,14 +157,6 @@ window.Military = (function () {
|
|||
}
|
||||
}
|
||||
|
||||
void (function removeExistingRegiments() {
|
||||
armies.selectAll("g > g").each(function () {
|
||||
const index = notes.findIndex(n => n.id === this.id);
|
||||
if (index != -1) notes.splice(index, 1);
|
||||
});
|
||||
armies.selectAll("g").remove();
|
||||
})();
|
||||
|
||||
const expected = 3 * populationRate; // expected regiment size
|
||||
const mergeable = (n0, n1) => (!n0.s && !n1.s) || n0.u === n1.u; // check if regiments can be merged
|
||||
|
||||
|
|
@ -172,9 +164,10 @@ window.Military = (function () {
|
|||
valid.forEach(s => {
|
||||
s.military = createRegiments(s.temp.platoons, s);
|
||||
delete s.temp; // do not store temp data
|
||||
drawRegiments(s.military, s.i);
|
||||
});
|
||||
|
||||
redraw();
|
||||
|
||||
function createRegiments(nodes, s) {
|
||||
if (!nodes.length) return [];
|
||||
|
||||
|
|
@ -236,6 +229,16 @@ window.Military = (function () {
|
|||
TIME && console.timeEnd("generateMilitaryForces");
|
||||
};
|
||||
|
||||
function redraw() {
|
||||
const validStates = pack.states.filter(s => s.i && !s.removed);
|
||||
armies.selectAll("g > g").each(function () {
|
||||
const index = notes.findIndex(n => n.id === this.id);
|
||||
if (index != -1) notes.splice(index, 1);
|
||||
});
|
||||
armies.selectAll("g").remove();
|
||||
validStates.forEach(s => drawRegiments(s.military, s.i));
|
||||
}
|
||||
|
||||
const getDefaultOptions = function () {
|
||||
return [
|
||||
{icon: "⚔️", name: "infantry", rural: 0.25, urban: 0.2, crew: 1, power: 1, type: "melee", separate: 0},
|
||||
|
|
@ -406,5 +409,5 @@ window.Military = (function () {
|
|||
notes.push({id: `regiment${s.i}-${r.i}`, name: `${r.icon} ${r.name}`, legend});
|
||||
};
|
||||
|
||||
return {generate, getDefaultOptions, getName, generateNote, drawRegiments, drawRegiment, moveRegiment, getTotal, getEmblem};
|
||||
return {generate, redraw, getDefaultOptions, getName, generateNote, drawRegiments, drawRegiment, moveRegiment, getTotal, getEmblem};
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue