mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 02:01:22 +01:00
feat: detect coastline - fix issue with border feature
This commit is contained in:
parent
796eb4e8be
commit
c76a737f94
1 changed files with 2 additions and 2 deletions
|
|
@ -183,9 +183,9 @@ window.Features = (function () {
|
|||
const getType = cellId => featureIds[cellId];
|
||||
const type = getType(firstCell);
|
||||
const ofSameType = cellId => getType(cellId) === type;
|
||||
const ofDifferentType = cellId => borderCells[cellId] || getType(cellId) !== type;
|
||||
const ofDifferentType = cellId => getType(cellId) !== type;
|
||||
|
||||
const isOnBorder = neighbors[firstCell].some(ofDifferentType);
|
||||
const isOnBorder = borderCells[firstCell] || neighbors[firstCell].some(ofDifferentType);
|
||||
if (!isOnBorder) throw new Error(`Markup: firstCell ${firstCell} is not on the feature or map border`);
|
||||
|
||||
const startingVertex = cells.v[firstCell].find(v => vertices.c[v].some(ofDifferentType));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue