[nostalgia/core] Fix getTileIdx(TileSheet, SubSheetId)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (push) Successful in 3m16s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (push) Successful in 3m16s
				
			This commit is contained in:
		| @@ -52,7 +52,7 @@ TileSheet::SubSheet const *getSubsheet(TileSheet const&ts, SubSheetId const id) | |||||||
| static ox::Optional<size_t> getPixelIdx( | static ox::Optional<size_t> getPixelIdx( | ||||||
| 		TileSheet::SubSheet const&ss, | 		TileSheet::SubSheet const&ss, | ||||||
| 		SubSheetId const id, | 		SubSheetId const id, | ||||||
| 		size_t idx, | 		size_t &idx, | ||||||
| 		int8_t const bpp) noexcept { | 		int8_t const bpp) noexcept { | ||||||
| 	for (auto const&child: ss.subsheets) { | 	for (auto const&child: ss.subsheets) { | ||||||
| 		if (child.id == id) { | 		if (child.id == id) { | ||||||
| @@ -63,11 +63,12 @@ static ox::Optional<size_t> getPixelIdx( | |||||||
| 		} | 		} | ||||||
| 		idx += pixelCnt(child, bpp); | 		idx += pixelCnt(child, bpp); | ||||||
| 	} | 	} | ||||||
| 	return {}; | 	return ox::Optional<size_t>{}; | ||||||
| } | } | ||||||
|  |  | ||||||
| size_t getTileIdx(TileSheet const&ts, SubSheetId const id) noexcept { | 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; | 	return out.or_value(0) / PixelsPerTile; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user