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

Fix color24 #353

Merged
merged 2 commits into from
Oct 3, 2023
Merged

Fix color24 #353

merged 2 commits into from
Oct 3, 2023

Conversation

briaguya-ai
Copy link
Collaborator

fixes #352

not sure if you had a different way to handle this in mind @Kenix3 but imo this is way better than having it be straight up broken

@Malkierian
Copy link
Contributor

Could you do an auto on the grabbing of the variable from variable->second and keep the clr.r/g/b intact for the rest of it and have it work?

@briaguya-ai
Copy link
Collaborator Author

@Malkierian no, Color and Color24 are separate members of the cvar struct

typedef struct CVar {
const char* Name;
ConsoleVariableType Type;
int32_t Integer;
float Float;
std::string String;
Color_RGBA8 Color;
Color_RGB8 Color24;
} CVar;

if we wanted to do a bigger rework we could change that struct to have

typedef struct CVar {
    const char* Name;
    ConsoleVariableType Type;
    int32_t Integer;
    float Float;
    std::string String;
    uint8_t ColorR;
    uint8_t ColorG;
    uint8_t ColorB;
    uint8_t ColorA;
} CVar;

and then just return a Color or Color24 using those on Get or something

Copy link
Owner

@Kenix3 Kenix3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super thrilled with the complicated ternaries, but I don't like the fact that we have a struct on the cvar at all, so fixing that feels out of scope.

@Kenix3 Kenix3 merged commit 317edd7 into Kenix3:main Oct 3, 2023
KiritoDv pushed a commit to KiritoDv/libultraship that referenced this pull request Oct 6, 2023
* fix color24 saving

* clang format
@briaguya-ai briaguya-ai deleted the fix-color24 branch November 19, 2023 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConsoleVariable::SetColor24 doesn't properly save
3 participants