mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-05 18:11:23 +01:00
fix: initialize heights array if not already set in HeightmapGenerator (#1277)
Some checks are pending
Deploy static content to Pages / deploy (push) Waiting to run
Some checks are pending
Deploy static content to Pages / deploy (push) Waiting to run
This commit is contained in:
parent
b228a8f610
commit
81c1ba2963
2 changed files with 2 additions and 4 deletions
|
|
@ -560,9 +560,7 @@ class HeightmapGenerator {
|
|||
if(!ctx) {
|
||||
throw new Error("Could not get canvas context");
|
||||
}
|
||||
if(!this.heights) {
|
||||
throw new Error("Heights array is not initialized");
|
||||
}
|
||||
this.heights = this.heights || new Uint8Array(cellsX * cellsY);
|
||||
ctx.drawImage(img, 0, 0, cellsX, cellsY);
|
||||
const imageData = ctx.getImageData(0, 0, cellsX, cellsY);
|
||||
this.setGraph(graph);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue