Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly compute colors for palette indexes above 15 in curses builds #76124

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

db48x
Copy link
Contributor

@db48x db48x commented Sep 1, 2024

Summary

Bugfixes "avoid UB by properly computing colors for palette indexes above 15 in curses builds"

Purpose of change

Fixes #72973, #76092

Describe the solution

ANSI defines the default RGB values for color indexes above 15 using a simple formula, so just do that. While I was there, I went ahead and cached all the values avoid having to do division every time a color is needed from the palette. Probably not a huge cost savings overall, but it feels better.

Testing

Display any uilist with a disabled item in a curses build. Easiest way to do this is use “Play Now!” to start a new game, then walk into the same tile as the NPC who is with you in the evac shelter.

@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Sep 1, 2024
src/cata_imgui.cpp Show resolved Hide resolved
src/cata_imgui.cpp Show resolved Hide resolved
src/cata_imgui.cpp Show resolved Hide resolved
@l29ah
Copy link
Contributor

l29ah commented Sep 2, 2024

Built it, it works well, thank you.
By the way, is there a way to set the menu backgrounds back to black and the text back to white? Gray on gray isn't very readable.

@GuardianDll
Copy link
Member

Restarting borked tests

@GuardianDll GuardianDll closed this Sep 4, 2024
@GuardianDll GuardianDll reopened this Sep 4, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 4, 2024
@Maleclypse Maleclypse merged commit 0323609 into CleverRaven:master Sep 5, 2024
38 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assertion failure in draw_controls in achievement popups
5 participants