We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | try { |
122 | - $TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE']; |
|
122 | + $TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE']; |
|
123 | 123 | debug('Action #' . $actions); |
124 | 124 | |
125 | 125 | //We have to reload player on each loop |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set. |
141 | - $TRADE_ROUTES =& findRoutes($player); |
|
142 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); |
|
141 | + $TRADE_ROUTES = & findRoutes($player); |
|
142 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if ($player->isDead()) { |
146 | 146 | debug('Some evil person killed us, let\'s move on now.'); |
147 | 147 | $previousContainer = null; //We died, we don't care what we were doing beforehand. |
148 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route |
|
148 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route |
|
149 | 149 | processContainer(create_container('death_processing.php')); |
150 | 150 | } |
151 | 151 | if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | processContainer(tradeGoods($goodID, $player, $port)); |
228 | 228 | } else { |
229 | 229 | //Move to next route or fed. |
230 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
230 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
231 | 231 | debug('Changing Route Failed'); |
232 | 232 | processContainer(plotToFed($player)); |
233 | 233 | } else { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | processContainer(tradeGoods($goodID, $player, $port)); |
255 | 255 | } else { |
256 | 256 | //Move to next route or fed. |
257 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
257 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
258 | 258 | debug('Changing Route Failed'); |
259 | 259 | processContainer(plotToFed($player)); |
260 | 260 | } else { |
@@ -586,9 +586,9 @@ discard block |
||
586 | 586 | return $false; |
587 | 587 | } |
588 | 588 | $routeKey = array_rand($tradeRoutes); |
589 | - $tradeRoute =& $tradeRoutes[$routeKey]; |
|
589 | + $tradeRoute = & $tradeRoutes[$routeKey]; |
|
590 | 590 | unset($tradeRoutes[$routeKey]); |
591 | - $GLOBALS['TRADE_ROUTE'] =& $tradeRoute; |
|
591 | + $GLOBALS['TRADE_ROUTE'] = & $tradeRoute; |
|
592 | 592 | debug('Switched route', $tradeRoute); |
593 | 593 | return $tradeRoute; |
594 | 594 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | continue; |
25 | 25 | } |
26 | 26 | $turns = min($attendeePlayer->getTurns() + $attendeePlayer->getTurnsGained(time(), true), |
27 | - $attendeePlayer->getMaxTurns()); |
|
27 | + $attendeePlayer->getMaxTurns()); |
|
28 | 28 | $oppers[$attendeePlayer->getPlayerName()] = $turns; |
29 | 29 | } |
30 | 30 |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | while ($this->db->nextRecord()) { |
315 | 315 | try { |
316 | 316 | $otherPlayer = SmrPlayer::getPlayer($this->db->getInt('from_account_id'), |
317 | - $this->getGameID(), $forceUpdate); |
|
317 | + $this->getGameID(), $forceUpdate); |
|
318 | 318 | } catch (PlayerNotFoundException $e) { |
319 | 319 | // Skip players that have not joined this game |
320 | 320 | continue; |
@@ -878,9 +878,9 @@ discard block |
||
878 | 878 | */ |
879 | 879 | public function canFight() { |
880 | 880 | return !($this->hasNewbieTurns() || |
881 | - $this->isDead() || |
|
882 | - $this->isLandedOnPlanet() || |
|
883 | - $this->hasFederalProtection()); |
|
881 | + $this->isDead() || |
|
882 | + $this->isLandedOnPlanet() || |
|
883 | + $this->hasFederalProtection()); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | public function setDead($bool) { |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | create_error('The saved sector must be in the box!'); |
1704 | 1704 | } |
1705 | 1705 | |
1706 | - $storedDestinations =& $this->getStoredDestinations(); |
|
1706 | + $storedDestinations = & $this->getStoredDestinations(); |
|
1707 | 1707 | foreach ($storedDestinations as &$sd) { |
1708 | 1708 | if ($sd['SectorID'] == $sectorID) { |
1709 | 1709 | $sd['OffsetTop'] = $offsetTop; |
@@ -2030,13 +2030,13 @@ discard block |
||
2030 | 2030 | $this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL); |
2031 | 2031 | $this->HOF = array(); |
2032 | 2032 | while ($this->db->nextRecord()) { |
2033 | - $hof =& $this->HOF; |
|
2033 | + $hof = & $this->HOF; |
|
2034 | 2034 | $typeList = explode(':', $this->db->getField('type')); |
2035 | 2035 | foreach ($typeList as $type) { |
2036 | 2036 | if (!isset($hof[$type])) { |
2037 | 2037 | $hof[$type] = array(); |
2038 | 2038 | } |
2039 | - $hof =& $hof[$type]; |
|
2039 | + $hof = & $hof[$type]; |
|
2040 | 2040 | } |
2041 | 2041 | $hof = $this->db->getFloat('amount'); |
2042 | 2042 | } |
@@ -2115,8 +2115,8 @@ discard block |
||
2115 | 2115 | } |
2116 | 2116 | self::$HOFVis[$hofType] = $visibility; |
2117 | 2117 | |
2118 | - $hof =& $this->HOF; |
|
2119 | - $hofChanged =& $this->hasHOFChanged; |
|
2118 | + $hof = & $this->HOF; |
|
2119 | + $hofChanged = & $this->hasHOFChanged; |
|
2120 | 2120 | $new = false; |
2121 | 2121 | foreach ($typeList as $type) { |
2122 | 2122 | if (!isset($hofChanged[$type])) { |
@@ -2126,8 +2126,8 @@ discard block |
||
2126 | 2126 | $hof[$type] = array(); |
2127 | 2127 | $new = true; |
2128 | 2128 | } |
2129 | - $hof =& $hof[$type]; |
|
2130 | - $hofChanged =& $hofChanged[$type]; |
|
2129 | + $hof = & $hof[$type]; |
|
2130 | + $hofChanged = & $hofChanged[$type]; |
|
2131 | 2131 | } |
2132 | 2132 | if ($hofChanged == null) { |
2133 | 2133 | $hofChanged = self::HOF_CHANGED; |
@@ -2730,7 +2730,7 @@ discard block |
||
2730 | 2730 | } |
2731 | 2731 | |
2732 | 2732 | private function setupMissionStep($missionID) { |
2733 | - $mission =& $this->missions[$missionID]; |
|
2733 | + $mission = & $this->missions[$missionID]; |
|
2734 | 2734 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
2735 | 2735 | // Nothing to do if this mission is already completed |
2736 | 2736 | return; |
@@ -2779,7 +2779,7 @@ discard block |
||
2779 | 2779 | 'Starting Sector' => $this->getSectorID() |
2780 | 2780 | ); |
2781 | 2781 | |
2782 | - $this->missions[$missionID] =& $mission; |
|
2782 | + $this->missions[$missionID] = & $mission; |
|
2783 | 2783 | $this->setupMissionStep($missionID); |
2784 | 2784 | $this->rebuildMission($missionID); |
2785 | 2785 | |
@@ -2829,7 +2829,7 @@ discard block |
||
2829 | 2829 | |
2830 | 2830 | public function claimMissionReward($missionID) { |
2831 | 2831 | $this->getMissions(); |
2832 | - $mission =& $this->missions[$missionID]; |
|
2832 | + $mission = & $this->missions[$missionID]; |
|
2833 | 2833 | if ($mission === false) { |
2834 | 2834 | throw new Exception('Unknown mission: ' . $missionID); |
2835 | 2835 | } |
@@ -44,8 +44,8 @@ |
||
44 | 44 | */ |
45 | 45 | public function getValue() : int { |
46 | 46 | if ($this->rank == self::RANK_JACK || |
47 | - $this->rank == self::RANK_QUEEN || |
|
48 | - $this->rank == self::RANK_KING) { |
|
47 | + $this->rank == self::RANK_QUEEN || |
|
48 | + $this->rank == self::RANK_KING) { |
|
49 | 49 | return 10; |
50 | 50 | } elseif ($this->isAce()) { |
51 | 51 | return 11; |
@@ -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 | } |
@@ -707,7 +707,7 @@ |
||
707 | 707 | if ($buildingTypeID === false) { |
708 | 708 | $structs = $this->typeInfo::STRUCTURES; |
709 | 709 | return array_combine(array_keys($structs), |
710 | - array_column($structs, 'max_amount')); |
|
710 | + array_column($structs, 'max_amount')); |
|
711 | 711 | } |
712 | 712 | return $this->getStructureTypes($buildingTypeID)->maxAmount(); |
713 | 713 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | $results['DeadBeforeShot'] = false; |
1167 | 1167 | $weapons = $this->getWeapons(); |
1168 | 1168 | foreach ($weapons as $orderID => $weapon) { |
1169 | - $results['Weapons'][$orderID] =& $weapon->shootPlayerAsPlanet($this, array_rand_value($targetPlayers)); |
|
1169 | + $results['Weapons'][$orderID] = & $weapon->shootPlayerAsPlanet($this, array_rand_value($targetPlayers)); |
|
1170 | 1170 | if ($results['Weapons'][$orderID]['Hit']) { |
1171 | 1171 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
1172 | 1172 | $results['TotalDamagePerTargetPlayer'][$results['Weapons'][$orderID]['TargetPlayer']->getAccountID()] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | } |
1175 | 1175 | if ($this->hasCDs()) { |
1176 | 1176 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs(), true); |
1177 | - $results['Drones'] =& $thisCDs->shootPlayerAsPlanet($this, array_rand_value($targetPlayers)); |
|
1177 | + $results['Drones'] = & $thisCDs->shootPlayerAsPlanet($this, array_rand_value($targetPlayers)); |
|
1178 | 1178 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
1179 | 1179 | $results['TotalDamagePerTargetPlayer'][$results['Drones']['TargetPlayer']->getAccountID()] += $results['Drones']['ActualDamage']['TotalDamage']; |
1180 | 1180 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | public static function mysqliFactory(MySqlProperties $mysqlProperties): mysqli { |
41 | - if (!mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT)) { |
|
41 | + if (!mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT)) { |
|
42 | 42 | throw new RuntimeException('Failed to enable mysqli error reporting'); |
43 | 43 | } |
44 | 44 | $mysql = new mysqli( |
@@ -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 | } |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | 3 | class DummyPlayer extends AbstractSmrPlayer { |
4 | - public function __construct($gameID=0,$playerName='Dummy',$raceID=1,$experience=1000,$alignment=100,$allianceID=0,$shipTypeID=60) { |
|
4 | + public function __construct($gameID = 0, $playerName = 'Dummy', $raceID = 1, $experience = 1000, $alignment = 100, $allianceID = 0, $shipTypeID = 60) { |
|
5 | 5 | $this->accountID = 0; |
6 | - $this->gameID = (int) $gameID; |
|
7 | - $this->playerName = (string) $playerName; |
|
6 | + $this->gameID = (int)$gameID; |
|
7 | + $this->playerName = (string)$playerName; |
|
8 | 8 | $this->playerID = 0; |
9 | 9 | $this->sectorID = 0; |
10 | - $this->lastSectorID = 0; |
|
10 | + $this->lastSectorID = 0; |
|
11 | 11 | $this->turns = 1000; |
12 | - $this->newbieTurns = 0; |
|
12 | + $this->newbieTurns = 0; |
|
13 | 13 | $this->lastNewsUpdate = 0; |
14 | 14 | $this->dead = false; |
15 | 15 | $this->landedOnPlanet = false; |
16 | - $this->lastActive = 0; |
|
17 | - $this->lastCPLAction = 0; |
|
18 | - $this->raceID = (int) $raceID; |
|
19 | - $this->credits = 0; |
|
20 | - $this->experience = (int) $experience; |
|
21 | - $this->alignment = (int) $alignment; |
|
22 | - $this->militaryPayment = 0; |
|
23 | - $this->allianceID = (int) $allianceID; |
|
24 | - $this->shipID = (int) $shipTypeID; |
|
16 | + $this->lastActive = 0; |
|
17 | + $this->lastCPLAction = 0; |
|
18 | + $this->raceID = (int)$raceID; |
|
19 | + $this->credits = 0; |
|
20 | + $this->experience = (int)$experience; |
|
21 | + $this->alignment = (int)$alignment; |
|
22 | + $this->militaryPayment = 0; |
|
23 | + $this->allianceID = (int)$allianceID; |
|
24 | + $this->shipID = (int)$shipTypeID; |
|
25 | 25 | $this->kills = 0; |
26 | 26 | $this->deaths = 0; |
27 | - $this->lastPort = 0; |
|
27 | + $this->lastPort = 0; |
|
28 | 28 | $this->bank = 0; |
29 | 29 | $this->zoom = 0; |
30 | 30 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | public function setAllianceID($ID) { |
51 | - if($this->allianceID == $ID) |
|
51 | + if ($this->allianceID == $ID) |
|
52 | 52 | return; |
53 | - $this->allianceID=$ID; |
|
53 | + $this->allianceID = $ID; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function &killPlayerByPlayer(AbstractSmrPlayer $killer) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $db = MySqlDatabase::getInstance(); |
77 | 77 | $db->query('REPLACE INTO cached_dummys ' . |
78 | 78 | '(type, id, info) ' . |
79 | - 'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeString($cache).')'); |
|
79 | + 'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeString($cache) . ')'); |
|
80 | 80 | unserialize($cache); |
81 | 81 | } |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $db->query('SELECT info FROM cached_dummys |
86 | 86 | WHERE type = \'DummyPlayer\' |
87 | 87 | AND id = ' . $db->escapeString($name) . ' LIMIT 1'); |
88 | - if($db->nextRecord()) { |
|
88 | + if ($db->nextRecord()) { |
|
89 | 89 | $return = unserialize($db->getField('info')); |
90 | 90 | return $return; |
91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $db->query('SELECT id FROM cached_dummys |
101 | 101 | WHERE type = \'DummyPlayer\''); |
102 | 102 | $dummyNames = array(); |
103 | - while($db->nextRecord()) { |
|
103 | + while ($db->nextRecord()) { |
|
104 | 104 | $dummyNames[] = $db->getField('id'); |
105 | 105 | } |
106 | 106 | return $dummyNames; |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setAllianceID($ID) { |
56 | - if($this->allianceID == $ID) |
|
57 | - return; |
|
56 | + if($this->allianceID == $ID) { |
|
57 | + return; |
|
58 | + } |
|
58 | 59 | $this->allianceID=$ID; |
59 | 60 | } |
60 | 61 | |
@@ -93,8 +94,7 @@ discard block |
||
93 | 94 | if($db->nextRecord()) { |
94 | 95 | $return = unserialize($db->getField('info')); |
95 | 96 | return $return; |
96 | - } |
|
97 | - else { |
|
97 | + } else { |
|
98 | 98 | $return = new DummyPlayer(); |
99 | 99 | return $return; |
100 | 100 | } |