5871: Fix skin prefix button container being used for multiple buttons r=heinrich5991 a=Robyt3

This meant that only the first skin prefix button could be activated.

Regression from #5633.

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
bors[bot] 2022-09-24 17:49:40 +00:00 committed by GitHub
commit 3d1583d9a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -510,14 +510,14 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
SkinPrefix.HSplitTop(2.0f, 0, &SkinPrefix);
{
static const char *s_apSkinPrefixes[] = {"kitty", "santa"};
for(auto &pPrefix : s_apSkinPrefixes)
static CButtonContainer s_aPrefixButtons[std::size(s_apSkinPrefixes)];
for(size_t i = 0; i < std::size(s_apSkinPrefixes); i++)
{
SkinPrefix.HSplitTop(20.0f, &Button, &SkinPrefix);
Button.HMargin(2.0f, &Button);
static CButtonContainer s_PrefixButton;
if(DoButton_Menu(&s_PrefixButton, pPrefix, 0, &Button))
if(DoButton_Menu(&s_aPrefixButtons[i], s_apSkinPrefixes[i], 0, &Button))
{
str_copy(g_Config.m_ClSkinPrefix, pPrefix);
str_copy(g_Config.m_ClSkinPrefix, s_apSkinPrefixes[i]);
}
}
}