Skip to content

Commit

Permalink
Add missing braces
Browse files Browse the repository at this point in the history
Avoids dangling-if and -for. No functionality changes.
  • Loading branch information
hemberger committed Apr 26, 2021
1 parent 36a4599 commit ce90abd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
24 changes: 16 additions & 8 deletions src/engine/Default/combat_simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/Default/DummyPlayer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit ce90abd

Please sign in to comment.