Clamp tod_color values in the [-510, 510] range instead of [-255, 255]
[color_adjust] needs to be able to use absolute values as large as
2*255 in certain edge cases to set the screen a single solid colour when
interacting with time of day colour shifts.
Fixes #3144.
(cherry-picked from commit ae127ea73a
)
This commit is contained in:
parent
e0045bf78f
commit
3848fe30a9
2 changed files with 5 additions and 3 deletions
|
@ -175,6 +175,8 @@
|
|||
* Experimental AI: fixed recruiting evaluations sometimes not being updated
|
||||
* Replaced deprecated Lua code and all remaining uses of FOREACH and MESSAGE
|
||||
macros
|
||||
* Fixed [color_adjust] interacting poorly with time of day color shifts and
|
||||
values outside the [-255, 255] range (issue #3144).
|
||||
|
||||
## Version 1.13.12
|
||||
### Security fixes
|
||||
|
|
|
@ -27,9 +27,9 @@ class config;
|
|||
// This is a color delta, so do not replace with color_t!
|
||||
struct tod_color {
|
||||
explicit tod_color(int red = 0, int green = 0, int blue = 0)
|
||||
: r(utils::clamp(red, -255, 255))
|
||||
, g(utils::clamp(green, -255, 255))
|
||||
, b(utils::clamp(blue, -255, 255))
|
||||
: r(utils::clamp(red, -510, 510))
|
||||
, g(utils::clamp(green, -510, 510))
|
||||
, b(utils::clamp(blue, -510, 510))
|
||||
{}
|
||||
bool operator==(const tod_color& o) const {
|
||||
return r == o.r && g == o.g && b == o.b;
|
||||
|
|
Loading…
Add table
Reference in a new issue