6545: Use `IsEntitiesLayer` to reduce duplicate code r=heinrich5991 a=Robyt3



## 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] 2023-04-29 10:14:42 +00:00 committed by GitHub
commit e917c12419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2359,14 +2359,7 @@ void CEditor::DoMapEditor(CUIRect View)
m_Map.m_pGameGroup->MapScreen();
for(auto &pLayer : m_Map.m_pGameGroup->m_vpLayers)
{
if(
pLayer->m_Visible &&
(pLayer == m_Map.m_pGameLayer ||
pLayer == m_Map.m_pFrontLayer ||
pLayer == m_Map.m_pTeleLayer ||
pLayer == m_Map.m_pSpeedupLayer ||
pLayer == m_Map.m_pSwitchLayer ||
pLayer == m_Map.m_pTuneLayer))
if(pLayer->m_Visible && pLayer->IsEntitiesLayer())
pLayer->Render();
}
}
@ -3703,12 +3696,7 @@ void CEditor::RenderLayers(CUIRect LayersBox)
FontSize--;
int Checked = IsLayerSelected ? 1 : 0;
if(m_Map.m_vpGroups[g]->m_vpLayers[i] == m_Map.m_pGameLayer ||
m_Map.m_vpGroups[g]->m_vpLayers[i] == m_Map.m_pFrontLayer ||
m_Map.m_vpGroups[g]->m_vpLayers[i] == m_Map.m_pSwitchLayer ||
m_Map.m_vpGroups[g]->m_vpLayers[i] == m_Map.m_pTuneLayer ||
m_Map.m_vpGroups[g]->m_vpLayers[i] == m_Map.m_pSpeedupLayer ||
m_Map.m_vpGroups[g]->m_vpLayers[i] == m_Map.m_pTeleLayer)
if(m_Map.m_vpGroups[g]->m_vpLayers[i]->IsEntitiesLayer())
{
Checked += 6;
}