From a83d7bab85f6edaf715c0b4022a709db6c116640 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 11 Aug 2024 22:17:58 +0200 Subject: [PATCH] feat: routes name - no unnamed burg names --- modules/routes-generator.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/routes-generator.js b/modules/routes-generator.js index 62f6a8c7..0926a6c3 100644 --- a/modules/routes-generator.js +++ b/modules/routes-generator.js @@ -668,19 +668,20 @@ window.Routes = (function () { const model = rw(models[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 === "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"; function getBurgName() { 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]; if (burgId) return getAdjective(pack.burgs[burgId].name); } - return "Unnamed"; + return null; } }