mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
feat: routes name - no unnamed burg names
This commit is contained in:
parent
b5a34afe93
commit
a83d7bab85
1 changed files with 5 additions and 4 deletions
|
|
@ -668,19 +668,20 @@ window.Routes = (function () {
|
||||||
const model = rw(models[group]);
|
const model = rw(models[group]);
|
||||||
const suffix = rw(suffixes[group]);
|
const suffix = rw(suffixes[group]);
|
||||||
|
|
||||||
if (model === "burg_suffix") return `${getBurgName()} ${suffix}`;
|
const burgName = getBurgName();
|
||||||
|
if (model === "burg_suffix" && burgName) return `${burgName} ${suffix}`;
|
||||||
if (model === "prefix_suffix") return `${ra(prefixes)} ${suffix}`;
|
if (model === "prefix_suffix") return `${ra(prefixes)} ${suffix}`;
|
||||||
if (model === "the_descriptor_prefix_suffix") return `The ${ra(descriptors)} ${ra(prefixes)} ${suffix}`;
|
if (model === "the_descriptor_prefix_suffix") return `The ${ra(descriptors)} ${ra(prefixes)} ${suffix}`;
|
||||||
if (model === "the_descriptor_burg_suffix") return `The ${ra(descriptors)} ${getBurgName()} ${suffix}`;
|
if (model === "the_descriptor_burg_suffix" && burgName) return `The ${ra(descriptors)} ${burgName} ${suffix}`;
|
||||||
return "Unnamed route";
|
return "Unnamed route";
|
||||||
|
|
||||||
function getBurgName() {
|
function getBurgName() {
|
||||||
const priority = [points.at(-1), points.at(0), points.slice(1, -1).reverse()];
|
const priority = [points.at(-1), points.at(0), points.slice(1, -1).reverse()];
|
||||||
for (const [x, y, cellId] of priority) {
|
for (const [_x, _y, cellId] of priority) {
|
||||||
const burgId = pack.cells.burg[cellId];
|
const burgId = pack.cells.burg[cellId];
|
||||||
if (burgId) return getAdjective(pack.burgs[burgId].name);
|
if (burgId) return getAdjective(pack.burgs[burgId].name);
|
||||||
}
|
}
|
||||||
return "Unnamed";
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue