Skip to content

Commit

Permalink
Fixed sprite filtering logic, added error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeychernyshev authored and AlexanderChernyshev committed May 6, 2024
1 parent 3d3e948 commit afa0ca0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ export const generateMapHTML = function (gameConfig, clusters) {

return { svg, tileNumber, spriteWidth, spriteHeight };
} else {
return "";
console.error(file, "is not a valid sprite");
return false; // invalid sprite
}
})
.filter((x) => x) // remove invalid sprites
.sort((a, b) => a.tileNumber - b.tileNumber);

const spriteEmbeds = sprites.map((sprite) => sprite.svg).join("");
Expand Down

0 comments on commit afa0ca0

Please sign in to comment.