mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Avoid sorting proto-palettes breaking mappings
The sorting was performed without updating the mappings, which broke the world. We can instead sort the IDs as they are inserted into the packing queue, which should also be faster than moving the actual proto-pal objects around.
This commit is contained in:
@@ -736,6 +736,9 @@ void Palette::addColor(uint16_t color) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the color in the palette, or `size()` if the color is not in
|
||||
*/
|
||||
uint8_t Palette::indexOf(uint16_t color) const {
|
||||
return std::find(colors.begin(), colors.end(), color) - colors.begin();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user