Skip to content

Fix wrongly used value in enum handling in the settings menu#1101

Open
Wartori54 wants to merge 2 commits intoEverestAPI:devfrom
Wartori54:enum-setting-fix
Open

Fix wrongly used value in enum handling in the settings menu#1101
Wartori54 wants to merge 2 commits intoEverestAPI:devfrom
Wartori54:enum-setting-fix

Conversation

@Wartori54
Copy link
Copy Markdown
Member

The default handling of Enum as a setting mixed the value and the index of the value, causing enums which do not have the values auto assigned in c# to misbehave.
This was first reported with an enum like following:

public enum MyEnum {
    Option1 = 0x1,
    Option2 = 0xff,
}

public MyEnum MyEnumSetting { get; set; } = MyEnum.Option2;

where the settings menu showed Option1 right after adding the setting to the class. This is due to mixing an internal index with the enum value.
Furthermore, it also saved the wrong values in the yaml, due to it using the internal index, rather than the proper value associated with the selected enum value.

@maddie480-bot maddie480-bot added the 1: review needed This PR needs 2 approvals to be merged (bot-managed) label Apr 3, 2026
Copy link
Copy Markdown
Member

@microlith57 microlith57 left a comment

Choose a reason for hiding this comment

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

👍

Comment thread Celeste.Mod.mm/Mod/Module/EverestModule.cs
Co-authored-by: microlith57 <microlith57@gmail.com>
Copy link
Copy Markdown
Member

@microlith57 microlith57 left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1: review needed This PR needs 2 approvals to be merged (bot-managed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants