mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
fix: #1170
This commit is contained in:
parent
8db9dc9bed
commit
fa03b2d705
4 changed files with 23 additions and 18 deletions
|
|
@ -8076,7 +8076,7 @@
|
||||||
|
|
||||||
<script defer src="modules/relief-icons.js?v=1.99.05"></script>
|
<script defer src="modules/relief-icons.js?v=1.99.05"></script>
|
||||||
<script defer src="modules/ui/style.js?v=1.104.0"></script>
|
<script defer src="modules/ui/style.js?v=1.104.0"></script>
|
||||||
<script defer src="modules/ui/editors.js?v=1.105.11"></script>
|
<script defer src="modules/ui/editors.js?v=1.105.23"></script>
|
||||||
<script defer src="modules/ui/tools.js?v=1.105.12"></script>
|
<script defer src="modules/ui/tools.js?v=1.105.12"></script>
|
||||||
<script defer src="modules/ui/world-configurator.js?v=1.105.4"></script>
|
<script defer src="modules/ui/world-configurator.js?v=1.105.4"></script>
|
||||||
<script defer src="modules/ui/heightmap-editor.js?v=1.105.2"></script>
|
<script defer src="modules/ui/heightmap-editor.js?v=1.105.2"></script>
|
||||||
|
|
|
||||||
|
|
@ -345,10 +345,13 @@ function cultureChangeName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cultureRegenerateName() {
|
function cultureRegenerateName() {
|
||||||
const culture = +this.parentNode.dataset.id;
|
const cultureId = +this.parentNode.dataset.id;
|
||||||
const name = Names.getCultureShort(culture);
|
const base = pack.cultures[cultureId].base;
|
||||||
|
if (!nameBases[base]) return tip("Namesbase is not defined, please select a valid namesbase", false, "error", 5000);
|
||||||
|
|
||||||
|
const name = Names.getCultureShort(cultureId);
|
||||||
this.parentNode.querySelector("input.cultureName").value = name;
|
this.parentNode.querySelector("input.cultureName").value = name;
|
||||||
pack.cultures[culture].name = name;
|
pack.cultures[cultureId].name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cultureChangeExpansionism() {
|
function cultureChangeExpansionism() {
|
||||||
|
|
@ -494,12 +497,15 @@ function cultureRegenerateBurgs() {
|
||||||
if (customization === 4) return;
|
if (customization === 4) return;
|
||||||
|
|
||||||
const cultureId = +this.parentNode.dataset.id;
|
const cultureId = +this.parentNode.dataset.id;
|
||||||
const cBurgs = pack.burgs.filter(b => b.culture === cultureId && !b.lock);
|
const base = pack.cultures[cultureId].base;
|
||||||
cBurgs.forEach(b => {
|
if (!nameBases[base]) return tip("Namesbase is not defined, please select a valid namesbase", false, "error", 5000);
|
||||||
|
|
||||||
|
const cultureBurgs = pack.burgs.filter(b => b.culture === cultureId && !b.removed && !b.lock);
|
||||||
|
cultureBurgs.forEach(b => {
|
||||||
b.name = Names.getCulture(cultureId);
|
b.name = Names.getCulture(cultureId);
|
||||||
labels.select("[data-id='" + b.i + "']").text(b.name);
|
labels.select("[data-id='" + b.i + "']").text(b.name);
|
||||||
});
|
});
|
||||||
tip(`Names for ${cBurgs.length} burgs are regenerated`, false, "success");
|
tip(`Names for ${cultureBurgs.length} burgs are regenerated`, false, "success");
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeCulture(cultureId) {
|
function removeCulture(cultureId) {
|
||||||
|
|
@ -849,14 +855,15 @@ async function uploadCulturesData() {
|
||||||
this.value = "";
|
this.value = "";
|
||||||
const csv = await file.text();
|
const csv = await file.text();
|
||||||
const data = d3.csvParse(csv, d => ({
|
const data = d3.csvParse(csv, d => ({
|
||||||
i: +d.Id,
|
|
||||||
name: d.Name,
|
name: d.Name,
|
||||||
|
i: +d.Id,
|
||||||
color: d.Color,
|
color: d.Color,
|
||||||
expansionism: +d.Expansionism,
|
expansionism: +d.Expansionism,
|
||||||
type: d.Type,
|
type: d.Type,
|
||||||
population: +d.Population,
|
population: +d.Population,
|
||||||
emblemsShape: d["Emblems Shape"],
|
emblemsShape: d["Emblems Shape"],
|
||||||
origins: d.Origins
|
origins: d.Origins,
|
||||||
|
namesbase: d.Namesbase
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const {cultures, cells} = pack;
|
const {cultures, cells} = pack;
|
||||||
|
|
@ -883,7 +890,7 @@ async function uploadCulturesData() {
|
||||||
culture.i
|
culture.i
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
current = {i: cultures.length, center: ra(populated), area: 0, cells: 0, origin: 0, rural: 0, urban: 0};
|
current = {i: cultures.length, center: ra(populated), area: 0, cells: 0, origins: [0], rural: 0, urban: 0};
|
||||||
cultures.push(current);
|
cultures.push(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -903,6 +910,10 @@ async function uploadCulturesData() {
|
||||||
else current.type = "Generic";
|
else current.type = "Generic";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
culture.origins = current.i ? restoreOrigins(culture.origins || "") : [null];
|
||||||
|
current.shield = shapes.includes(culture.emblemsShape) ? culture.emblemsShape : "heater";
|
||||||
|
current.base = nameBases.findIndex(n => n.name == culture.namesbase); // can be -1 if namesbase is not found
|
||||||
|
|
||||||
function restoreOrigins(originsString) {
|
function restoreOrigins(originsString) {
|
||||||
const originNames = originsString
|
const originNames = originsString
|
||||||
.replaceAll('"', "")
|
.replaceAll('"', "")
|
||||||
|
|
@ -918,12 +929,6 @@ async function uploadCulturesData() {
|
||||||
current.origins = originIds.filter(id => id !== null);
|
current.origins = originIds.filter(id => id !== null);
|
||||||
if (!current.origins.length) current.origins = [0];
|
if (!current.origins.length) current.origins = [0];
|
||||||
}
|
}
|
||||||
|
|
||||||
culture.origins = current.i ? restoreOrigins(culture.origins || "") : [null];
|
|
||||||
current.shield = shapes.includes(culture.emblemsShape) ? culture.emblemsShape : "heater";
|
|
||||||
|
|
||||||
const nameBaseIndex = nameBases.findIndex(n => n.name == culture.namesbase);
|
|
||||||
current.base = nameBaseIndex === -1 ? 0 : nameBaseIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cultures.filter(c => c.removed).forEach(c => removeCulture(c.i));
|
cultures.filter(c => c.removed).forEach(c => removeCulture(c.i));
|
||||||
|
|
|
||||||
|
|
@ -1255,7 +1255,7 @@ async function editStates() {
|
||||||
|
|
||||||
async function editCultures() {
|
async function editCultures() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
const Editor = await import("../dynamic/editors/cultures-editor.js?v=1.105.11");
|
const Editor = await import("../dynamic/editors/cultures-editor.js?v=1.105.23");
|
||||||
Editor.open();
|
Editor.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const VERSION = "1.105.22";
|
const VERSION = "1.105.23";
|
||||||
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue