From ce90abd61172ba666d5190c02658280729d5c810 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Sat, 24 Apr 2021 20:39:03 -0700 Subject: [PATCH] Add missing braces Avoids dangling-if and -for. No functionality changes. --- src/engine/Default/combat_simulator.php | 24 ++++++++++++++++-------- src/lib/Default/DummyPlayer.class.php | 3 +-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/engine/Default/combat_simulator.php b/src/engine/Default/combat_simulator.php index b667379d2..4a2ba5448 100644 --- a/src/engine/Default/combat_simulator.php +++ b/src/engine/Default/combat_simulator.php @@ -12,10 +12,11 @@ $realAttackers = array(); $attackers = array(); $i = 1; -if (isset($_POST['attackers'])) +if (isset($_POST['attackers'])) { foreach ($_POST['attackers'] as $attackerName) { - if ($attackerName == 'none') + if ($attackerName == 'none') { continue; + } if (isset($usedNames[$attackerName])) { $duplicates = true; continue; @@ -26,18 +27,21 @@ $realAttackers[$i] = $attackers[$i]; ++$i; } +} -for (;$i <= 10; ++$i) +for (;$i <= 10; ++$i) { $attackers[$i] = null; +} $template->assign('Attackers', $attackers); $i = 1; $realDefenders = array(); $defenders = array(); -if (isset($_POST['defenders'])) +if (isset($_POST['defenders'])) { foreach ($_POST['defenders'] as $defenderName) { - if ($defenderName == 'none') + if ($defenderName == 'none') { continue; + } if (isset($usedNames[$defenderName])) { $duplicates = true; continue; @@ -48,9 +52,11 @@ $realDefenders[$i] = $defenders[$i]; ++$i; } +} -for (;$i <= 10; ++$i) +for (;$i <= 10; ++$i) { $defenders[$i] = null; +} $template->assign('Defenders', $defenders); $template->assign('Duplicates', $duplicates); @@ -65,12 +71,14 @@ while (count($realAttackers) > 0 && count($realDefenders) > 0) { runAnAttack($realAttackers, $realDefenders); foreach ($realAttackers as $key => &$teamPlayer) { - if ($teamPlayer->isDead()) + if ($teamPlayer->isDead()) { unset($realAttackers[$key]); + } } unset($teamPlayer); foreach ($realDefenders as $key => &$teamPlayer) { - if ($teamPlayer->isDead()) + if ($teamPlayer->isDead()) { unset($realDefenders[$key]); + } } unset($teamPlayer); } } diff --git a/src/lib/Default/DummyPlayer.class.php b/src/lib/Default/DummyPlayer.class.php index 17818973f..7850d1662 100644 --- a/src/lib/Default/DummyPlayer.class.php +++ b/src/lib/Default/DummyPlayer.class.php @@ -83,8 +83,7 @@ public static function getCachedDummyPlayer($name) { AND id = ' . $db->escapeString($name) . ' LIMIT 1'); if ($db->nextRecord()) { return $db->getObject('info'); - } - else { + } else { return new DummyPlayer(); } }