DFHack / stonesense

A retro isometric visualizer for Dwarf Fortress
https://github.com/DFHack/dfhack
Other
370 stars 54 forks source link

Remove incorrect use of DFHack::Units::MAX_COLORS #108

Closed Bumber64 closed 2 months ago

Bumber64 commented 2 months ago

DFHack::Units::MAX_COLORS is being removed because it's not used (properly) anywhere, and is equivalent to DFHack::COLOR_MAX (AFAIK of its intent).

I've replaced the usage of it in Stonesense with the equivalent value of 15, since it wasn't even being used as a color enum. The value is currently being used as however many elements of unit.appearance.colors we're willing to store in the SS_Unit struct. Note that these elements are used as indices to get caste_raw pattern data such as what color the unit's hair is at a given age. Stonesense only needs to know what color it is right now, so this is due for a rework.

myk002 commented 2 months ago

so the original code (and this new code) will just display correct colors up to age 15? what happens beyond that age?

Bumber64 commented 2 months ago

so the original code (and this new code) will just display correct colors up to age 15? what happens beyond that age?

No, it can store 15 (indices to) definitions. Vanilla dwarves have 5: Original hair color, gray hair transition (80-130 years), white hair transition (130-150 years), skin, and eyes.

You could define more in creature_standard.txt, and Stonesense wouldn't draw color rectangles for any beyond 15 (if the code weren't commented out regardless). IDK what those rectangles are for to begin with, so IDK what the consequences are.