diff --git a/src/nostalgia/modules/core/src/tilesheet.cpp b/src/nostalgia/modules/core/src/tilesheet.cpp index 18b62d04..fb336f79 100644 --- a/src/nostalgia/modules/core/src/tilesheet.cpp +++ b/src/nostalgia/modules/core/src/tilesheet.cpp @@ -52,7 +52,7 @@ TileSheet::SubSheet const *getSubsheet(TileSheet const&ts, SubSheetId const id) static ox::Optional getPixelIdx( TileSheet::SubSheet const&ss, SubSheetId const id, - size_t idx, + size_t &idx, int8_t const bpp) noexcept { for (auto const&child: ss.subsheets) { if (child.id == id) { @@ -63,11 +63,12 @@ static ox::Optional getPixelIdx( } idx += pixelCnt(child, bpp); } - return {}; + return ox::Optional{}; } size_t getTileIdx(TileSheet const&ts, SubSheetId const id) noexcept { - auto const out = getPixelIdx(ts.subsheet, id, 0, ts.bpp); + size_t idx{}; + auto const out = getPixelIdx(ts.subsheet, id, idx, ts.bpp); return out.or_value(0) / PixelsPerTile; }