mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Properly detect tiles with more than 4 colours
Fixes #1127, which was caused by a dumb logic error. Duh me.
This commit is contained in:
@@ -15,15 +15,20 @@
|
||||
#include <stdint.h>
|
||||
|
||||
class ProtoPalette {
|
||||
public:
|
||||
static constexpr size_t capacity = 4;
|
||||
|
||||
private:
|
||||
// Up to 4 colors, sorted, and where SIZE_MAX means the slot is empty
|
||||
// (OK because it's not a valid color index)
|
||||
// Sorting is done on the raw numerical values to lessen `compare`'s complexity
|
||||
std::array<uint16_t, 4> _colorIndices{UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
|
||||
std::array<uint16_t, capacity> _colorIndices{UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
|
||||
|
||||
public:
|
||||
/*
|
||||
* Adds the specified color to the set
|
||||
* Returns false if the set is full
|
||||
* Adds the specified color to the set, or **silently drops it** if the set is full.
|
||||
*
|
||||
* Returns whether the color was unique.
|
||||
*/
|
||||
bool add(uint16_t color);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user