Skip to content

Commit

Permalink
Fix bad empty pixel sentinel value. (#30)
Browse files Browse the repository at this point in the history
With truly huge tiles, the bad sentinel value could actually
be used as a saddle index, causing an infinite loop.
  • Loading branch information
akirmse authored Mar 15, 2024
1 parent ca47751 commit 21e5ebf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions code/pixel_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ template<typename Pixel> class PixelArray {
delete [] mPixels;
}

// A non-terrain value
static const Pixel EmptyPixel = -32738;
// A non-terrain value; also don't overlap with peak or saddle
// indexes.
static const Pixel EmptyPixel = std::numeric_limits<Pixel>::min();

Pixel get(int x, int y) const {
return mPixels[y * mWidth + x];
Expand Down

0 comments on commit 21e5ebf

Please sign in to comment.