5169: fix HUD assets Tab r=heinrich5991 a=C0D3D3V

fixes #5168
should maybe next time test if everything still works before I let merge something big xD

![grafik](https://user-images.githubusercontent.com/14315968/169562898-358f0fcf-c51f-4042-9971-8a227511546e.png)


## 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 if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] 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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
bors[bot] 2022-05-20 15:41:57 +00:00 committed by GitHub
commit b95754a38e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,9 +227,10 @@ int CMenus::ParticlesScan(const char *pName, int IsDir, int DirType, void *pUser
int CMenus::HudScan(const char *pName, int IsDir, int DirType, void *pUser)
{
CMenus *pMenus = (CMenus *)pUser;
IGraphics *pGraphics = pMenus->Graphics();
return AssetScan(pName, IsDir, DirType, pMenus->m_HudList, "hud", pGraphics, pUser);
auto *pRealUser = (SMenuAssetScanUser *)pUser;
auto *pThis = (CMenus *)pRealUser->m_pUser;
IGraphics *pGraphics = pThis->Graphics();
return AssetScan(pName, IsDir, DirType, pThis->m_HudList, "hud", pGraphics, pUser);
}
static sorted_array<const CMenus::SCustomEntities *> s_SearchEntitiesList;
@ -423,7 +424,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
}
else if(s_CurCustomTab == ASSETS_TAB_HUD)
{
InitAssetList(m_HudList, "assets/hud", "hud", HudScan, Graphics(), Storage(), this);
InitAssetList(m_HudList, "assets/hud", "hud", HudScan, Graphics(), Storage(), &User);
}
MainView.HSplitTop(10.0f, 0, &MainView);