From 409abf1b90dc8326eb69c47a645693c1cccb6d83 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Fri, 27 Jul 2018 07:51:16 +0200 Subject: [PATCH] Simplify code a bit --- src/game/editor/auto_map.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/game/editor/auto_map.cpp b/src/game/editor/auto_map.cpp index ccab9be9e..8e34878a6 100644 --- a/src/game/editor/auto_map.cpp +++ b/src/game/editor/auto_map.cpp @@ -353,23 +353,24 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID) if(pRule->m_Value == CPosRule::INDEX) { - bool PosRuleTest = false; - for(int i = 0; i < pRule->m_aIndexList.size() && !PosRuleTest; ++i) { + RespectRules = false; + for(int i = 0; i < pRule->m_aIndexList.size(); ++i) { if(CheckIndex == pRule->m_aIndexList[i].m_ID && (pRule->m_aIndexList[i].m_Flag == -1 || CheckFlags == pRule->m_aIndexList[i].m_Flag)) - PosRuleTest = true; + { + RespectRules = true; + break; + } } - if(!PosRuleTest) - RespectRules = false; } else if(pRule->m_Value == CPosRule::NOTINDEX) { - bool PosRuleTest = true; - for(int i = 0; i < pRule->m_aIndexList.size() && PosRuleTest; ++i) { + for(int i = 0; i < pRule->m_aIndexList.size(); ++i) { if(CheckIndex == pRule->m_aIndexList[i].m_ID && (pRule->m_aIndexList[i].m_Flag == -1 || CheckFlags == pRule->m_aIndexList[i].m_Flag)) - PosRuleTest = false; + { + RespectRules = false; + break; + } } - if(!PosRuleTest) - RespectRules = false; } }