We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | $template->assign('Weapons', $weapons); |
| 46 | 46 | |
| 47 | 47 | $template->display('weapon_list.php'); |
| 48 | -} |
|
| 49 | -catch(Throwable $e) { |
|
| 48 | +} catch(Throwable $e) { |
|
| 50 | 49 | handleException($e); |
| 51 | 50 | } |
| 52 | 51 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | $weapons = []; |
| 12 | 12 | $db->query('SELECT * FROM weapon_type JOIN race USING(race_id)'); |
| 13 | 13 | while ($db->nextRecord()) { |
| 14 | - switch($db->getInt('buyer_restriction')) { |
|
| 14 | + switch ($db->getInt('buyer_restriction')) { |
|
| 15 | 15 | case BUYER_RESTRICTION_GOOD: |
| 16 | 16 | $restriction = '<span class="dgreen">Good</span>'; |
| 17 | 17 | break; |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $template->display('weapon_list.php'); |
| 48 | 48 | } |
| 49 | -catch(Throwable $e) { |
|
| 49 | +catch (Throwable $e) { |
|
| 50 | 50 | handleException($e); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function buildSelector($db, $name, $table) { |
| 54 | 54 | $selector = '<select onchange="filterSelect(this)"><option>All</option>'; |
| 55 | - $db->query("SELECT DISTINCT ".$name." FROM ".$table." ORDER BY ".$name); |
|
| 55 | + $db->query("SELECT DISTINCT " . $name . " FROM " . $table . " ORDER BY " . $name); |
|
| 56 | 56 | while ($db->nextRecord()) { |
| 57 | - $selector .= '<option>'.$db->getField($name).'</option>'; |
|
| 57 | + $selector .= '<option>' . $db->getField($name) . '</option>'; |
|
| 58 | 58 | } |
| 59 | 59 | $selector .= '</select>'; |
| 60 | 60 | return $selector; |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | foreach (Globals::getRaces() as $raceID => $raceData) { |
| 67 | 67 | $raceName = $raceData['Race Name']; |
| 68 | 68 | $racebox .= ' |
| 69 | - <input type="checkbox" id="race'.$raceID.'" name="races" value="'.$raceName.'" onClick="raceToggle()"> |
|
| 70 | - <label for="race'.$raceID.'" class="race'.$raceID.'">'.$raceName.'</label> '; |
|
| 69 | + <input type="checkbox" id="race'.$raceID . '" name="races" value="' . $raceName . '" onClick="raceToggle()"> |
|
| 70 | + <label for="race'.$raceID . '" class="race' . $raceID . '">' . $raceName . '</label> '; |
|
| 71 | 71 | } |
| 72 | 72 | $racebox .= '</form>'; |
| 73 | 73 | return $racebox; |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | if (!empty(BUG_REPORT_TO_ADDRESSES)) { |
| 70 | 70 | $mail = setupMailer(); |
| 71 | 71 | $mail->Subject = (defined('PAGE_PREFIX') ? PAGE_PREFIX : '??? ') . |
| 72 | - 'Automatic Bug Report'; |
|
| 72 | + 'Automatic Bug Report'; |
|
| 73 | 73 | $mail->setFrom('[email protected]'); |
| 74 | 74 | $mail->Body = $message; |
| 75 | 75 | foreach (BUG_REPORT_TO_ADDRESSES as $toAddress) { |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function getValue() { |
| 46 | 46 | if ($this->rankID == self::RANK_JACK || |
| 47 | - $this->rankID == self::RANK_QUEEN || |
|
| 48 | - $this->rankID == self::RANK_KING) { |
|
| 47 | + $this->rankID == self::RANK_QUEEN || |
|
| 48 | + $this->rankID == self::RANK_KING) { |
|
| 49 | 49 | return 10; |
| 50 | 50 | } elseif ($this->isAce()) { |
| 51 | 51 | return 11; |
@@ -242,9 +242,9 @@ |
||
| 242 | 242 | */ |
| 243 | 243 | public function canFight() { |
| 244 | 244 | return !($this->hasNewbieTurns() || |
| 245 | - $this->isDead() || |
|
| 246 | - $this->isLandedOnPlanet() || |
|
| 247 | - $this->hasFederalProtection()); |
|
| 245 | + $this->isDead() || |
|
| 246 | + $this->isLandedOnPlanet() || |
|
| 247 | + $this->hasFederalProtection()); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | public function setDead($bool) { |
@@ -929,8 +929,8 @@ discard block |
||
| 929 | 929 | } |
| 930 | 930 | self::$HOFVis[$hofType] = $visibility; |
| 931 | 931 | |
| 932 | - $hof =& $this->HOF; |
|
| 933 | - $hofChanged =& $this->hasHOFChanged; |
|
| 932 | + $hof = & $this->HOF; |
|
| 933 | + $hofChanged = & $this->hasHOFChanged; |
|
| 934 | 934 | $new = false; |
| 935 | 935 | foreach ($typeList as $type) { |
| 936 | 936 | if (!isset($hofChanged[$type])) { |
@@ -940,8 +940,8 @@ discard block |
||
| 940 | 940 | $hof[$type] = array(); |
| 941 | 941 | $new = true; |
| 942 | 942 | } |
| 943 | - $hof =& $hof[$type]; |
|
| 944 | - $hofChanged =& $hofChanged[$type]; |
|
| 943 | + $hof = & $hof[$type]; |
|
| 944 | + $hofChanged = & $hofChanged[$type]; |
|
| 945 | 945 | } |
| 946 | 946 | if ($hofChanged == null) { |
| 947 | 947 | $hofChanged = self::HOF_CHANGED; |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | private function setupMissionStep($missionID) { |
| 1100 | - $mission =& $this->missions[$missionID]; |
|
| 1100 | + $mission = & $this->missions[$missionID]; |
|
| 1101 | 1101 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
| 1102 | 1102 | // Nothing to do if this mission is already completed |
| 1103 | 1103 | return; |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | 'Starting Sector' => $this->getSectorID() |
| 1143 | 1143 | ); |
| 1144 | 1144 | |
| 1145 | - $this->missions[$missionID] =& $mission; |
|
| 1145 | + $this->missions[$missionID] = & $mission; |
|
| 1146 | 1146 | $this->setupMissionStep($missionID); |
| 1147 | 1147 | $this->rebuildMission($missionID); |
| 1148 | 1148 | |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | |
| 1202 | 1202 | public function claimMissionReward($missionID) { |
| 1203 | 1203 | $this->getMissions(); |
| 1204 | - $mission =& $this->missions[$missionID]; |
|
| 1204 | + $mission = & $this->missions[$missionID]; |
|
| 1205 | 1205 | if ($mission === false) { |
| 1206 | 1206 | throw new Exception('Unknown mission: ' . $missionID); |
| 1207 | 1207 | } |
@@ -464,7 +464,9 @@ discard block |
||
| 464 | 464 | if ($this->level === null) { |
| 465 | 465 | $LEVELS_REQUIREMENTS = Globals::getLevelRequirements(); |
| 466 | 466 | foreach ($LEVELS_REQUIREMENTS as $level_id => $require) { |
| 467 | - if ($this->getExperience() >= $require['Requirement']) continue; |
|
| 467 | + if ($this->getExperience() >= $require['Requirement']) { |
|
| 468 | + continue; |
|
| 469 | + } |
|
| 468 | 470 | $this->level = $level_id - 1; |
| 469 | 471 | return $this->level; |
| 470 | 472 | } |
@@ -585,8 +587,7 @@ discard block |
||
| 585 | 587 | public function getAllianceDisplayName($linked = false, $includeAllianceID = false) { |
| 586 | 588 | if ($this->hasAlliance()) { |
| 587 | 589 | return $this->getAlliance()->getAllianceDisplayName($linked, $includeAllianceID); |
| 588 | - } |
|
| 589 | - else { |
|
| 590 | + } else { |
|
| 590 | 591 | return 'No Alliance'; |
| 591 | 592 | } |
| 592 | 593 | } |
@@ -923,8 +924,7 @@ discard block |
||
| 923 | 924 | $hofType = implode(':', $typeList); |
| 924 | 925 | if (!isset(self::$HOFVis[$hofType])) { |
| 925 | 926 | self::$hasHOFVisChanged[$hofType] = self::HOF_NEW; |
| 926 | - } |
|
| 927 | - else if (self::$HOFVis[$hofType] != $visibility) { |
|
| 927 | + } else if (self::$HOFVis[$hofType] != $visibility) { |
|
| 928 | 928 | self::$hasHOFVisChanged[$hofType] = self::HOF_CHANGED; |
| 929 | 929 | } |
| 930 | 930 | self::$HOFVis[$hofType] = $visibility; |
@@ -1159,8 +1159,7 @@ discard block |
||
| 1159 | 1159 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
| 1160 | 1160 | // If we have completed this mission just use false to indicate no current task. |
| 1161 | 1161 | $currentStep = false; |
| 1162 | - } |
|
| 1163 | - else { |
|
| 1162 | + } else { |
|
| 1164 | 1163 | $currentStep = MISSIONS[$missionID]['Steps'][$mission['On Step']]; |
| 1165 | 1164 | $currentStep['Text'] = str_replace(array('<Race>', '<Sector>', '<Starting Sector>', '<trader>'), array($this->getRaceID(), $mission['Sector'], $mission['Starting Sector'], $this->playerName), $currentStep['Text']); |
| 1166 | 1165 | if (isset($currentStep['Task'])) { |
@@ -1168,8 +1167,7 @@ discard block |
||
| 1168 | 1167 | } |
| 1169 | 1168 | if (isset($currentStep['Level'])) { |
| 1170 | 1169 | $currentStep['Level'] = str_replace('<Player Level>', $this->getLevelID(), $currentStep['Level']); |
| 1171 | - } |
|
| 1172 | - else { |
|
| 1170 | + } else { |
|
| 1173 | 1171 | $currentStep['Level'] = 0; |
| 1174 | 1172 | } |
| 1175 | 1173 | } |
@@ -1386,8 +1384,9 @@ discard block |
||
| 1386 | 1384 | if (!isset($this->visitedSectors)) { |
| 1387 | 1385 | $this->visitedSectors = array(); |
| 1388 | 1386 | $this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL); |
| 1389 | - while ($this->db->nextRecord()) |
|
| 1390 | - $this->visitedSectors[$this->db->getInt('sector_id')] = false; |
|
| 1387 | + while ($this->db->nextRecord()) { |
|
| 1388 | + $this->visitedSectors[$this->db->getInt('sector_id')] = false; |
|
| 1389 | + } |
|
| 1391 | 1390 | } |
| 1392 | 1391 | return !isset($this->visitedSectors[$sectorID]); |
| 1393 | 1392 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function isAttacking(array &$board, array &$hasMoved, $king, $x = -1, $y = -1) { |
| 55 | - $moves =& $this->getPossibleMoves($board, $hasMoved, null, true); |
|
| 56 | - foreach($moves as &$move) { |
|
| 57 | - $p =& $board[$move[1]][$move[0]]; |
|
| 58 | - if(($move[0] == $x && $move[1] == $y) || ($king === true && $p != null && $p->pieceID == self::KING && $this->colour != $p->colour)) { |
|
| 55 | + $moves = & $this->getPossibleMoves($board, $hasMoved, null, true); |
|
| 56 | + foreach ($moves as &$move) { |
|
| 57 | + $p = & $board[$move[1]][$move[0]]; |
|
| 58 | + if (($move[0] == $x && $move[1] == $y) || ($king === true && $p != null && $p->pieceID == self::KING && $this->colour != $p->colour)) { |
|
| 59 | 59 | return true; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -64,130 +64,130 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function &getPossibleMoves(array &$board, array &$hasMoved, $forAccountID = null, $attackingCheck = false) { |
| 66 | 66 | $moves = array(); |
| 67 | - if($forAccountID == null || $this->accountID == $forAccountID) { |
|
| 68 | - if($this->pieceID==self::PAWN) { |
|
| 69 | - $dirY = $this->colour==ChessGame::PLAYER_BLACK ? 1 : -1; |
|
| 70 | - $moveY = $this->y+$dirY; |
|
| 67 | + if ($forAccountID == null || $this->accountID == $forAccountID) { |
|
| 68 | + if ($this->pieceID == self::PAWN) { |
|
| 69 | + $dirY = $this->colour == ChessGame::PLAYER_BLACK ? 1 : -1; |
|
| 70 | + $moveY = $this->y + $dirY; |
|
| 71 | 71 | //Pawn forward movement is not attacking - so don't check it if doing an attacking check. |
| 72 | - if(!$attackingCheck) { |
|
| 73 | - if(ChessGame::isValidCoord($this->x, $moveY, $board) && $board[$moveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $moveY)) { |
|
| 74 | - $moves[] = array($this->x,$moveY); |
|
| 72 | + if (!$attackingCheck) { |
|
| 73 | + if (ChessGame::isValidCoord($this->x, $moveY, $board) && $board[$moveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $moveY)) { |
|
| 74 | + $moves[] = array($this->x, $moveY); |
|
| 75 | 75 | } |
| 76 | 76 | $doubleMoveY = $moveY + $dirY; |
| 77 | - if($this->y-$dirY == 0 || $this->y-$dirY*2 == count($board)) { //Double move first move |
|
| 78 | - if($board[$moveY][$this->x] == null && $board[$doubleMoveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $doubleMoveY)) { |
|
| 79 | - $moves[] = array($this->x,$doubleMoveY); |
|
| 77 | + if ($this->y - $dirY == 0 || $this->y - $dirY * 2 == count($board)) { //Double move first move |
|
| 78 | + if ($board[$moveY][$this->x] == null && $board[$doubleMoveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $doubleMoveY)) { |
|
| 79 | + $moves[] = array($this->x, $doubleMoveY); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - for($i=-1;$i<2;$i+=2) { |
|
| 84 | - $moveX = $this->x+$i; |
|
| 85 | - if(ChessGame::isValidCoord($moveX, $moveY, $board)) { |
|
| 86 | - if($attackingCheck || |
|
| 83 | + for ($i = -1; $i < 2; $i += 2) { |
|
| 84 | + $moveX = $this->x + $i; |
|
| 85 | + if (ChessGame::isValidCoord($moveX, $moveY, $board)) { |
|
| 86 | + if ($attackingCheck || |
|
| 87 | 87 | ((($hasMoved[ChessPiece::PAWN][0] == $moveX && $hasMoved[ChessPiece::PAWN][1] == $this->y) || |
| 88 | - ($board[$moveY][$moveX] != null && $board[$moveY][$moveX]->colour!=$this->colour)) |
|
| 88 | + ($board[$moveY][$moveX] != null && $board[$moveY][$moveX]->colour != $this->colour)) |
|
| 89 | 89 | && $this->isSafeMove($board, $hasMoved, $moveX, $moveY))) { |
| 90 | - $moves[] = array($moveX,$moveY); |
|
| 90 | + $moves[] = array($moveX, $moveY); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - else if($this->pieceID==self::KING) { |
|
| 96 | - for($i = -1; $i < 2; $i++) { |
|
| 97 | - for($j = -1; $j < 2; $j++) { |
|
| 98 | - if($i!=0 || $j!=0) { |
|
| 99 | - $this->addMove($this->x+$i, $this->y+$j, $board, $moves, $hasMoved, $attackingCheck); |
|
| 95 | + else if ($this->pieceID == self::KING) { |
|
| 96 | + for ($i = -1; $i < 2; $i++) { |
|
| 97 | + for ($j = -1; $j < 2; $j++) { |
|
| 98 | + if ($i != 0 || $j != 0) { |
|
| 99 | + $this->addMove($this->x + $i, $this->y + $j, $board, $moves, $hasMoved, $attackingCheck); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | //Castling is not attacking - so don't check it if doing an attacking check. |
| 104 | - if(!$attackingCheck && !$hasMoved[$this->colour][ChessPiece::KING] && !ChessGame::isPlayerChecked($board, $hasMoved, $this->colour)) { |
|
| 105 | - if(!$hasMoved[$this->colour][ChessPiece::ROOK]['Queen'] && |
|
| 106 | - ChessGame::isValidCoord($this->x-1, $this->y, $board) && $board[$this->y][$this->x-1] == null && |
|
| 107 | - ChessGame::isValidCoord($this->x-3, $this->y, $board) && $board[$this->y][$this->x-3] == null && |
|
| 108 | - $this->isSafeMove($board, $hasMoved, $this->x-1, $this->y)) { |
|
| 109 | - $this->addMove($this->x-2, $this->y, $board, $moves, $hasMoved, $attackingCheck); |
|
| 104 | + if (!$attackingCheck && !$hasMoved[$this->colour][ChessPiece::KING] && !ChessGame::isPlayerChecked($board, $hasMoved, $this->colour)) { |
|
| 105 | + if (!$hasMoved[$this->colour][ChessPiece::ROOK]['Queen'] && |
|
| 106 | + ChessGame::isValidCoord($this->x - 1, $this->y, $board) && $board[$this->y][$this->x - 1] == null && |
|
| 107 | + ChessGame::isValidCoord($this->x - 3, $this->y, $board) && $board[$this->y][$this->x - 3] == null && |
|
| 108 | + $this->isSafeMove($board, $hasMoved, $this->x - 1, $this->y)) { |
|
| 109 | + $this->addMove($this->x - 2, $this->y, $board, $moves, $hasMoved, $attackingCheck); |
|
| 110 | 110 | } |
| 111 | - if(!$hasMoved[$this->colour][ChessPiece::ROOK]['King'] && |
|
| 112 | - ChessGame::isValidCoord($this->x+1, $this->y, $board) && $board[$this->y][$this->x+1] == null && |
|
| 113 | - $this->isSafeMove($board, $hasMoved, $this->x+1, $this->y)) { |
|
| 114 | - $this->addMove($this->x+2, $this->y, $board, $moves, $hasMoved, $attackingCheck); |
|
| 111 | + if (!$hasMoved[$this->colour][ChessPiece::ROOK]['King'] && |
|
| 112 | + ChessGame::isValidCoord($this->x + 1, $this->y, $board) && $board[$this->y][$this->x + 1] == null && |
|
| 113 | + $this->isSafeMove($board, $hasMoved, $this->x + 1, $this->y)) { |
|
| 114 | + $this->addMove($this->x + 2, $this->y, $board, $moves, $hasMoved, $attackingCheck); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - else if($this->pieceID==self::QUEEN) { |
|
| 118 | + else if ($this->pieceID == self::QUEEN) { |
|
| 119 | 119 | $moveX = $this->x; |
| 120 | 120 | $moveY = $this->y; |
| 121 | - while($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left |
|
| 121 | + while ($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left |
|
| 122 | 122 | $moveX = $this->x; |
| 123 | 123 | $moveY = $this->y; |
| 124 | - while($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right |
|
| 124 | + while ($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right |
|
| 125 | 125 | $moveX = $this->x; |
| 126 | 126 | $moveY = $this->y; |
| 127 | - while($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up |
|
| 127 | + while ($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up |
|
| 128 | 128 | $moveX = $this->x; |
| 129 | 129 | $moveY = $this->y; |
| 130 | - while($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down |
|
| 130 | + while ($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down |
|
| 131 | 131 | $moveX = $this->x; |
| 132 | 132 | $moveY = $this->y; |
| 133 | - while($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 133 | + while ($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 134 | 134 | $moveX = $this->x; |
| 135 | 135 | $moveY = $this->y; |
| 136 | - while($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right |
|
| 136 | + while ($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right |
|
| 137 | 137 | $moveX = $this->x; |
| 138 | 138 | $moveY = $this->y; |
| 139 | - while($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left |
|
| 139 | + while ($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left |
|
| 140 | 140 | $moveX = $this->x; |
| 141 | 141 | $moveY = $this->y; |
| 142 | - while($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 142 | + while ($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 143 | 143 | } |
| 144 | - else if($this->pieceID==self::ROOK) { |
|
| 144 | + else if ($this->pieceID == self::ROOK) { |
|
| 145 | 145 | $moveX = $this->x; |
| 146 | 146 | $moveY = $this->y; |
| 147 | - while($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left |
|
| 147 | + while ($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left |
|
| 148 | 148 | $moveX = $this->x; |
| 149 | 149 | $moveY = $this->y; |
| 150 | - while($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right |
|
| 150 | + while ($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right |
|
| 151 | 151 | $moveX = $this->x; |
| 152 | 152 | $moveY = $this->y; |
| 153 | - while($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up |
|
| 153 | + while ($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up |
|
| 154 | 154 | $moveX = $this->x; |
| 155 | 155 | $moveY = $this->y; |
| 156 | - while($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down |
|
| 156 | + while ($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down |
|
| 157 | 157 | } |
| 158 | - else if($this->pieceID==self::BISHOP) { |
|
| 158 | + else if ($this->pieceID == self::BISHOP) { |
|
| 159 | 159 | $moveX = $this->x; |
| 160 | 160 | $moveY = $this->y; |
| 161 | - while($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 161 | + while ($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 162 | 162 | $moveX = $this->x; |
| 163 | 163 | $moveY = $this->y; |
| 164 | - while($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right |
|
| 164 | + while ($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right |
|
| 165 | 165 | $moveX = $this->x; |
| 166 | 166 | $moveY = $this->y; |
| 167 | - while($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left |
|
| 167 | + while ($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left |
|
| 168 | 168 | $moveX = $this->x; |
| 169 | 169 | $moveY = $this->y; |
| 170 | - while($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 170 | + while ($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
|
| 171 | 171 | } |
| 172 | - else if($this->pieceID==self::KNIGHT) { |
|
| 173 | - $moveX = $this->x-1; |
|
| 174 | - $moveY = $this->y-2; |
|
| 175 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2up-left |
|
| 172 | + else if ($this->pieceID == self::KNIGHT) { |
|
| 173 | + $moveX = $this->x - 1; |
|
| 174 | + $moveY = $this->y - 2; |
|
| 175 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2up-left |
|
| 176 | 176 | $moveX += 2; |
| 177 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2up-right |
|
| 178 | - $moveY = $this->y+2; |
|
| 179 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2down-right |
|
| 177 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2up-right |
|
| 178 | + $moveY = $this->y + 2; |
|
| 179 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2down-right |
|
| 180 | 180 | $moveX -= 2; |
| 181 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2down-left |
|
| 182 | - $moveX = $this->x-2; |
|
| 183 | - $moveY = $this->y-1; |
|
| 184 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2left-up |
|
| 181 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2down-left |
|
| 182 | + $moveX = $this->x - 2; |
|
| 183 | + $moveY = $this->y - 1; |
|
| 184 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2left-up |
|
| 185 | 185 | $moveY += 2; |
| 186 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2left-down |
|
| 187 | - $moveX = $this->x+2; |
|
| 188 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2right-down |
|
| 186 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2left-down |
|
| 187 | + $moveX = $this->x + 2; |
|
| 188 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2right-down |
|
| 189 | 189 | $moveY -= 2; |
| 190 | - $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2right-up |
|
| 190 | + $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2right-up |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | private function addMove($toX, $toY, array &$board, array &$moves, array &$hasMoved = null, $attackingCheck = true) { |
| 198 | - if(ChessGame::isValidCoord($toX, $toY, $board)) { |
|
| 199 | - if(($board[$toY][$toX] == null || $board[$toY][$toX]->colour!=$this->colour)) { |
|
| 198 | + if (ChessGame::isValidCoord($toX, $toY, $board)) { |
|
| 199 | + if (($board[$toY][$toX] == null || $board[$toY][$toX]->colour != $this->colour)) { |
|
| 200 | 200 | //We can only actually move to this position if it is safe to do so, however we can pass through it looking for a safe move so we still want to return true. |
| 201 | - if(($attackingCheck == true || $this->isSafeMove($board, $hasMoved, $toX, $toY))) { |
|
| 202 | - $moves[] = array($toX,$toY); |
|
| 201 | + if (($attackingCheck == true || $this->isSafeMove($board, $hasMoved, $toX, $toY))) { |
|
| 202 | + $moves[] = array($toX, $toY); |
|
| 203 | 203 | } |
| 204 | 204 | return true; |
| 205 | 205 | } |
@@ -208,30 +208,30 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | public function promote($pawnPromotionPieceID, array &$board) { |
| 211 | - if($pawnPromotionPieceID==null) { |
|
| 211 | + if ($pawnPromotionPieceID == null) { |
|
| 212 | 212 | throw new Exception('Promotion piece cannot be null on a promote.'); |
| 213 | 213 | } |
| 214 | 214 | $takenNos = array(); |
| 215 | - foreach($board as $row) { |
|
| 216 | - foreach($row as $piece) { |
|
| 217 | - if($piece != null && $piece->pieceID == $pawnPromotionPieceID && $piece->colour == $this->colour) { |
|
| 215 | + foreach ($board as $row) { |
|
| 216 | + foreach ($row as $piece) { |
|
| 217 | + if ($piece != null && $piece->pieceID == $pawnPromotionPieceID && $piece->colour == $this->colour) { |
|
| 218 | 218 | $takenNos[$piece->pieceNo] = true; |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | - $i=0; |
|
| 223 | - while(isset($takenNos[$i])) { |
|
| 222 | + $i = 0; |
|
| 223 | + while (isset($takenNos[$i])) { |
|
| 224 | 224 | $i++; |
| 225 | 225 | } |
| 226 | 226 | return array('PieceID' => $pawnPromotionPieceID, 'PieceNo' => $i); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | public function getPieceLetter() { |
| 230 | - return self::getLetterForPiece($this->pieceID,$this->colour); |
|
| 230 | + return self::getLetterForPiece($this->pieceID, $this->colour); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | public function getPieceSymbol() { |
| 234 | - return self::getSymbolForPiece($this->pieceID,$this->colour); |
|
| 234 | + return self::getSymbolForPiece($this->pieceID, $this->colour); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | public static function getSymbolForPiece($pieceID, $colour) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | public static function getLetterForPiece($pieceID, $colour) { |
| 242 | - switch($pieceID) { |
|
| 242 | + switch ($pieceID) { |
|
| 243 | 243 | case self::KING: |
| 244 | 244 | $letter = 'k'; |
| 245 | 245 | break; |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | $letter = 'p'; |
| 261 | 261 | break; |
| 262 | 262 | } |
| 263 | - if($colour == ChessGame::PLAYER_WHITE) { |
|
| 263 | + if ($colour == ChessGame::PLAYER_WHITE) { |
|
| 264 | 264 | $letter = strtoupper($letter); |
| 265 | 265 | } |
| 266 | 266 | return $letter; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | public static function getPieceForLetter($letter) { |
| 270 | - switch($letter) { |
|
| 270 | + switch ($letter) { |
|
| 271 | 271 | case 'k': |
| 272 | 272 | case 'K': |
| 273 | 273 | return self::KING; |
@@ -91,8 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | - } |
|
| 95 | - else if($this->pieceID==self::KING) { |
|
| 94 | + } else if($this->pieceID==self::KING) { |
|
| 96 | 95 | for($i = -1; $i < 2; $i++) { |
| 97 | 96 | for($j = -1; $j < 2; $j++) { |
| 98 | 97 | if($i!=0 || $j!=0) { |
@@ -114,8 +113,7 @@ discard block |
||
| 114 | 113 | $this->addMove($this->x+2, $this->y, $board, $moves, $hasMoved, $attackingCheck); |
| 115 | 114 | } |
| 116 | 115 | } |
| 117 | - } |
|
| 118 | - else if($this->pieceID==self::QUEEN) { |
|
| 116 | + } else if($this->pieceID==self::QUEEN) { |
|
| 119 | 117 | $moveX = $this->x; |
| 120 | 118 | $moveY = $this->y; |
| 121 | 119 | while($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left |
@@ -140,8 +138,7 @@ discard block |
||
| 140 | 138 | $moveX = $this->x; |
| 141 | 139 | $moveY = $this->y; |
| 142 | 140 | while($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
| 143 | - } |
|
| 144 | - else if($this->pieceID==self::ROOK) { |
|
| 141 | + } else if($this->pieceID==self::ROOK) { |
|
| 145 | 142 | $moveX = $this->x; |
| 146 | 143 | $moveY = $this->y; |
| 147 | 144 | while($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left |
@@ -154,8 +151,7 @@ discard block |
||
| 154 | 151 | $moveX = $this->x; |
| 155 | 152 | $moveY = $this->y; |
| 156 | 153 | while($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down |
| 157 | - } |
|
| 158 | - else if($this->pieceID==self::BISHOP) { |
|
| 154 | + } else if($this->pieceID==self::BISHOP) { |
|
| 159 | 155 | $moveX = $this->x; |
| 160 | 156 | $moveY = $this->y; |
| 161 | 157 | while($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
@@ -168,8 +164,7 @@ discard block |
||
| 168 | 164 | $moveX = $this->x; |
| 169 | 165 | $moveY = $this->y; |
| 170 | 166 | while($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left |
| 171 | - } |
|
| 172 | - else if($this->pieceID==self::KNIGHT) { |
|
| 167 | + } else if($this->pieceID==self::KNIGHT) { |
|
| 173 | 168 | $moveX = $this->x-1; |
| 174 | 169 | $moveY = $this->y-2; |
| 175 | 170 | $this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2up-left |
@@ -72,8 +72,7 @@ |
||
| 72 | 72 | $return = unserialize($db->getField('info')); |
| 73 | 73 | $return->regenerate($player); |
| 74 | 74 | self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] =& $return; |
| 75 | - } |
|
| 76 | - else { |
|
| 75 | + } else { |
|
| 77 | 76 | self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] = new DummyShip($player); |
| 78 | 77 | } |
| 79 | 78 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $this->cargo_left = $this->getCargoHolds(); |
| 18 | 18 | } |
| 19 | 19 | protected function doFullUNO() { |
| 20 | - foreach($this->getMaxHardware() as $hardwareTypeID => $max) { |
|
| 20 | + foreach ($this->getMaxHardware() as $hardwareTypeID => $max) { |
|
| 21 | 21 | $this->hardware[$hardwareTypeID] = $max; |
| 22 | 22 | $this->oldHardware[$hardwareTypeID] = $max; |
| 23 | 23 | } |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function getIllusionShip() { |
| 50 | - if(!isset($this->illusionShip)) { |
|
| 51 | - $this->illusionShip=false; |
|
| 50 | + if (!isset($this->illusionShip)) { |
|
| 51 | + $this->illusionShip = false; |
|
| 52 | 52 | } |
| 53 | 53 | return $this->illusionShip; |
| 54 | 54 | } |
@@ -58,20 +58,20 @@ discard block |
||
| 58 | 58 | $db = new SmrMySqlDatabase(); |
| 59 | 59 | $db->query('REPLACE INTO cached_dummys ' . |
| 60 | 60 | '(type, id, info) ' . |
| 61 | - 'VALUES (\'DummyShip\', '.$db->escapeString($this->getPlayer()->getPlayerName()).', '.$db->escapeString($cache).')'); |
|
| 61 | + 'VALUES (\'DummyShip\', ' . $db->escapeString($this->getPlayer()->getPlayerName()) . ', ' . $db->escapeString($cache) . ')'); |
|
| 62 | 62 | unserialize($cache); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public static function getCachedDummyShip(AbstractSmrPlayer $player) { |
| 66 | - if(!isset(self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()])) { |
|
| 66 | + if (!isset(self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()])) { |
|
| 67 | 67 | $db = new SmrMySqlDatabase(); |
| 68 | 68 | $db->query('SELECT info FROM cached_dummys |
| 69 | 69 | WHERE type = \'DummyShip\' |
| 70 | 70 | AND id = ' . $db->escapeString($player->getPlayerName()) . ' LIMIT 1'); |
| 71 | - if($db->nextRecord()) { |
|
| 71 | + if ($db->nextRecord()) { |
|
| 72 | 72 | $return = unserialize($db->getField('info')); |
| 73 | 73 | $return->regenerate($player); |
| 74 | - self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] =& $return; |
|
| 74 | + self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] = & $return; |
|
| 75 | 75 | } |
| 76 | 76 | else { |
| 77 | 77 | self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] = new DummyShip($player); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $db->query('SELECT id FROM cached_dummys |
| 86 | 86 | WHERE type = \'DummyShip\''); |
| 87 | 87 | $dummyNames = array(); |
| 88 | - while($db->nextRecord()) { |
|
| 88 | + while ($db->nextRecord()) { |
|
| 89 | 89 | $dummyNames[] = $db->getField('id'); |
| 90 | 90 | } |
| 91 | 91 | return $dummyNames; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | public function __sleep() { |
| 97 | - return array('gameID','weapons'); |
|
| 97 | + return array('gameID', 'weapons'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function __wakeup() { |
@@ -549,7 +549,7 @@ |
||
| 549 | 549 | */ |
| 550 | 550 | public function setWarp(SmrSector $warp) { |
| 551 | 551 | if ($this->getWarp() == $warp->getSectorID() && |
| 552 | - $warp->getWarp() == $this->getSectorID()) { |
|
| 552 | + $warp->getWarp() == $this->getSectorID()) { |
|
| 553 | 553 | // Warps are already set correctly! |
| 554 | 554 | return; |
| 555 | 555 | } |
@@ -126,15 +126,13 @@ discard block |
||
| 126 | 126 | $this->links['Right'] = $db->getInt('link_right'); |
| 127 | 127 | } |
| 128 | 128 | $this->warp = $db->getInt('warp'); |
| 129 | - } |
|
| 130 | - else if ($create) { |
|
| 129 | + } else if ($create) { |
|
| 131 | 130 | $this->battles = 0; |
| 132 | 131 | $this->links = array(); |
| 133 | 132 | $this->warp = 0; |
| 134 | 133 | $this->isNew = true; |
| 135 | 134 | return; |
| 136 | - } |
|
| 137 | - else { |
|
| 135 | + } else { |
|
| 138 | 136 | throw new SectorNotFoundException('No sector ' . $sectorID . ' in game ' . $gameID); |
| 139 | 137 | } |
| 140 | 138 | } |
@@ -492,8 +490,7 @@ discard block |
||
| 492 | 490 | public function toggleLink($dir) { |
| 493 | 491 | if ($this->hasLink($dir)) { |
| 494 | 492 | $this->disableLink($dir); |
| 495 | - } |
|
| 496 | - else { |
|
| 493 | + } else { |
|
| 497 | 494 | $this->enableLink($dir); |
| 498 | 495 | } |
| 499 | 496 | } |
@@ -446,20 +446,20 @@ |
||
| 446 | 446 | |
| 447 | 447 | if ($this->hasMines()) { |
| 448 | 448 | $thisMines = new SmrMines($this->getGameID(), $this->getMines()); |
| 449 | - $results['Results']['Mines'] =& $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker); |
|
| 449 | + $results['Results']['Mines'] = & $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker); |
|
| 450 | 450 | $results['TotalDamage'] += $results['Results']['Mines']['ActualDamage']['TotalDamage']; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | if ($this->hasCDs()) { |
| 454 | 454 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
| 455 | - $results['Results']['Drones'] =& $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 455 | + $results['Results']['Drones'] = & $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 456 | 456 | $results['TotalDamage'] += $results['Results']['Drones']['ActualDamage']['TotalDamage']; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | if (!$minesAreAttacker) { |
| 460 | 460 | if ($this->hasSDs()) { |
| 461 | 461 | $thisSDs = new SmrScoutDrones($this->getGameID(), $this->getSDs()); |
| 462 | - $results['Results']['Scouts'] =& $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 462 | + $results['Results']['Scouts'] = & $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 463 | 463 | $results['TotalDamage'] += $results['Results']['Scouts']['ActualDamage']['TotalDamage']; |
| 464 | 464 | } |
| 465 | 465 | } |
@@ -279,8 +279,7 @@ discard block |
||
| 279 | 279 | // Changed (26/10/05) - scout drones count * 2 |
| 280 | 280 | if ($this->getCDs() == 0 && $this->getMines() == 0 && $this->getSDs() > 0) { |
| 281 | 281 | $time = self::TIME_PER_SCOUT_ONLY * $this->getSDs(); |
| 282 | - } |
|
| 283 | - else { |
|
| 282 | + } else { |
|
| 284 | 283 | $time = ($this->getCDs() * self::TIME_PERCENT_PER_COMBAT + $this->getSDs() * self::TIME_PERCENT_PER_SCOUT + $this->getMines() * self::TIME_PERCENT_PER_MINE) * $this->getMaxGalaxyExpireTime(); |
| 285 | 284 | } |
| 286 | 285 | $this->setExpire(TIME + $time); |
@@ -307,11 +306,9 @@ discard block |
||
| 307 | 306 | } |
| 308 | 307 | if ($mines < 10) { |
| 309 | 308 | $turns = 1; |
| 310 | - } |
|
| 311 | - else if ($mines < 25) { |
|
| 309 | + } else if ($mines < 25) { |
|
| 312 | 310 | $turns = 2; |
| 313 | - } |
|
| 314 | - else { |
|
| 311 | + } else { |
|
| 315 | 312 | $turns = 3; |
| 316 | 313 | } |
| 317 | 314 | if ($ship->isFederal() || $ship->hasDCS()) { |
@@ -366,12 +363,10 @@ discard block |
||
| 366 | 363 | if (!$this->exists()) { |
| 367 | 364 | $this->db->query('DELETE FROM sector_has_forces WHERE ' . $this->SQL); |
| 368 | 365 | $this->isNew = true; |
| 369 | - } |
|
| 370 | - else if ($this->hasChanged) { |
|
| 366 | + } else if ($this->hasChanged) { |
|
| 371 | 367 | $this->db->query('UPDATE sector_has_forces SET combat_drones = ' . $this->db->escapeNumber($this->combatDrones) . ', scout_drones = ' . $this->db->escapeNumber($this->scoutDrones) . ', mines = ' . $this->db->escapeNumber($this->mines) . ', expire_time = ' . $this->db->escapeNumber($this->expire) . ' WHERE ' . $this->SQL); |
| 372 | 368 | } |
| 373 | - } |
|
| 374 | - else if ($this->exists()) { |
|
| 369 | + } else if ($this->exists()) { |
|
| 375 | 370 | $this->db->query('INSERT INTO sector_has_forces (game_id, sector_id, owner_id, combat_drones, scout_drones, mines, expire_time) |
| 376 | 371 | VALUES('.$this->db->escapeNumber($this->gameID) . ', ' . $this->db->escapeNumber($this->sectorID) . ', ' . $this->db->escapeNumber($this->ownerID) . ', ' . $this->db->escapeNumber($this->combatDrones) . ', ' . $this->db->escapeNumber($this->scoutDrones) . ', ' . $this->db->escapeNumber($this->mines) . ', ' . $this->db->escapeNumber($this->expire) . ')'); |
| 377 | 372 | $this->isNew = false; |
@@ -100,16 +100,16 @@ |
||
| 100 | 100 | $container['view_game_id'] = $var['view_game_id']; |
| 101 | 101 | $container['game_name'] = $var['game_name']; |
| 102 | 102 | $menuItems[] = ['Link' => SmrSession::getNewHREF($container), |
| 103 | - 'Text' => 'Game Details']; |
|
| 103 | + 'Text' => 'Game Details']; |
|
| 104 | 104 | $container['body'] = 'history_games_detail.php'; |
| 105 | 105 | $menuItems[] = ['Link' => SmrSession::getNewHREF($container), |
| 106 | - 'Text' => 'Extended Stats']; |
|
| 106 | + 'Text' => 'Extended Stats']; |
|
| 107 | 107 | $container['body'] = 'history_games_hof.php'; |
| 108 | 108 | $menuItems[] = ['Link' => SmrSession::getNewHREF($container), |
| 109 | - 'Text' => 'Hall of Fame']; |
|
| 109 | + 'Text' => 'Hall of Fame']; |
|
| 110 | 110 | $container['body'] = 'history_games_news.php'; |
| 111 | 111 | $menuItems[] = ['Link' => SmrSession::getNewHREF($container), |
| 112 | - 'Text' => 'Game News']; |
|
| 112 | + 'Text' => 'Game News']; |
|
| 113 | 113 | // make the selected index bold |
| 114 | 114 | $boldItem =& $menuItems[$selected_index]['Text']; |
| 115 | 115 | $boldItem = '<b>' . $boldItem . '</b>'; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $menuItems[] = array('Link'=>Globals::getPlanetListHREF($alliance_id), 'Text'=>'Defense'); |
| 13 | 13 | $menuItems[] = array('Link'=>Globals::getPlanetListFinancialHREF($alliance_id), 'Text'=>'Financial'); |
| 14 | 14 | // make the selected index bold |
| 15 | - $boldItem =& $menuItems[$selected_index]['Text']; |
|
| 15 | + $boldItem = & $menuItems[$selected_index]['Text']; |
|
| 16 | 16 | $boldItem = '<span class="bold">' . $boldItem . '</span>'; |
| 17 | 17 | $template->assign('MenuItems', $menuItems); |
| 18 | 18 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $menuItems[] = ['Link' => SmrSession::getNewHREF($container), |
| 108 | 108 | 'Text' => 'Game News']; |
| 109 | 109 | // make the selected index bold |
| 110 | - $boldItem =& $menuItems[$selected_index]['Text']; |
|
| 110 | + $boldItem = & $menuItems[$selected_index]['Text']; |
|
| 111 | 111 | $boldItem = '<b>' . $boldItem . '</b>'; |
| 112 | 112 | $template->assign('MenuItems', $menuItems); |
| 113 | 113 | } |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | if ($alliance_id) { |
| 24 | 24 | $in_alliance = ($alliance_id == $player->getAllianceID()); |
| 25 | - } |
|
| 26 | - else { |
|
| 25 | + } else { |
|
| 27 | 26 | $in_alliance = $player->hasAlliance(); |
| 28 | 27 | } |
| 29 | 28 | if (!$in_alliance) { |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | $mbRead = $db->getBoolean('mb_read'); |
| 37 | 36 | $modRead = $db->getBoolean('mod_read'); |
| 38 | 37 | $planetLand = $db->getBoolean('planet_land'); |
| 39 | - } |
|
| 40 | - else { |
|
| 38 | + } else { |
|
| 41 | 39 | $mbRead = FALSE; |
| 42 | 40 | $modRead = FALSE; |
| 43 | 41 | $planetLand = FALSE; |
@@ -366,8 +364,7 @@ discard block |
||
| 366 | 364 | } |
| 367 | 365 | } |
| 368 | 366 | $return .= ('</small></td>'); |
| 369 | - } |
|
| 370 | - else { |
|
| 367 | + } else { |
|
| 371 | 368 | // if it's not the first entry we have to put |
| 372 | 369 | // additional empty cell for the spacer |
| 373 | 370 | //if ($number > 0) |