Use IsEntitiesLayer to reduce duplicate code

This commit is contained in:
Robert Müller 2023-04-29 11:18:46 +02:00
parent dc804f88ac
commit 996353a8e4

View file

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