Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — master (#812)
by Dan
04:19
created
engine/Default/shop_hardware_processing.php 1 patch
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,16 @@  discard block
 block discarded – undo
32 32
 	$ship->increaseHardware($hardware_id, $amount);
33 33
 
34 34
 	//HoF
35
-	if ($hardware_id == HARDWARE_COMBAT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE);
36
-	if ($hardware_id == HARDWARE_SCOUT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE);
37
-	if ($hardware_id == HARDWARE_MINE) $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE);
38
-}
39
-else if ($action == 'Sell') {
35
+	if ($hardware_id == HARDWARE_COMBAT) {
36
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE);
37
+	}
38
+	if ($hardware_id == HARDWARE_SCOUT) {
39
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE);
40
+	}
41
+	if ($hardware_id == HARDWARE_MINE) {
42
+		$player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE);
43
+	}
44
+	} else if ($action == 'Sell') {
40 45
 	// We only allow selling combat drones
41 46
 	if ($hardware_id != HARDWARE_COMBAT) {
42 47
 		throw new Exception('This item cannot be sold!');
@@ -49,8 +54,7 @@  discard block
 block discarded – undo
49 54
 
50 55
 	$player->increaseCredits(IRound($cost * CDS_REFUND_PERCENT) * $amount);
51 56
 	$ship->decreaseCDs($amount, true); // 2nd arg avoids under attack warning
52
-}
53
-else {
57
+} else {
54 58
 	throw new Exception('Action must be either Buy or Sell.');
55 59
 }
56 60
 
Please login to merge, or discard this patch.
engine/Default/planet_financial_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
 		$player->decreaseCredits($amount);
29 29
 		$planet->increaseCredits($amount);
30 30
 		$account->log(LOG_TYPE_BANK, 'Player puts ' . $amount . ' credits on planet', $player->getSectorID());
31
-	}
32
-	elseif ($action == 'Withdraw') {
31
+	} elseif ($action == 'Withdraw') {
33 32
 		if ($planet->getCredits() < $amount) {
34 33
 			create_error('There are not enough credits in the planetary account!');
35 34
 		}
Please login to merge, or discard this patch.
lib/Default/AbstractSmrShip.class.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	public function setWeaponLocations(array $orderArray) {
302 302
 		$weapons = $this->weapons;
303 303
 		foreach ($orderArray as $newOrder => $oldOrder) {
304
-			$this->weapons[$newOrder] =& $weapons[$oldOrder];
304
+			$this->weapons[$newOrder] = & $weapons[$oldOrder];
305 305
 		}
306 306
 		$this->hasChangedWeapons = true;
307 307
 	}
@@ -901,14 +901,14 @@  discard block
 block discarded – undo
901 901
 		}
902 902
 		$results['DeadBeforeShot'] = false;
903 903
 		foreach ($this->weapons as $orderID => $weapon) {
904
-			$results['Weapons'][$orderID] =& $weapon->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]);
904
+			$results['Weapons'][$orderID] = & $weapon->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]);
905 905
 			if ($results['Weapons'][$orderID]['Hit']) {
906 906
 				$results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
907 907
 			}
908 908
 		}
909 909
 		if ($this->hasCDs()) {
910 910
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs());
911
-			$results['Drones'] =& $thisCDs->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]);
911
+			$results['Drones'] = & $thisCDs->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]);
912 912
 			$results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage'];
913 913
 		}
914 914
 		$thisPlayer->increaseExperience(IRound($results['TotalDamage'] * self::EXP_PER_DAMAGE_PLAYER));
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 		}
927 927
 		$results['DeadBeforeShot'] = false;
928 928
 		foreach ($this->weapons as $orderID => $weapon) {
929
-			$results['Weapons'][$orderID] =& $weapon->shootForces($thisPlayer, $forces);
929
+			$results['Weapons'][$orderID] = & $weapon->shootForces($thisPlayer, $forces);
930 930
 			if ($results['Weapons'][$orderID]['Hit']) {
931 931
 				$results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
932 932
 				$thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumMines'], array('Combat', 'Forces', 'Mines', 'Killed'), HOF_PUBLIC);
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		}
941 941
 		if ($this->hasCDs()) {
942 942
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs());
943
-			$results['Drones'] =& $thisCDs->shootForces($thisPlayer, $forces);
943
+			$results['Drones'] = & $thisCDs->shootForces($thisPlayer, $forces);
944 944
 			$results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage'];
945 945
 			$thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumMines'], array('Combat', 'Forces', 'Mines', 'Killed'), HOF_PUBLIC);
946 946
 			$thisPlayer->increaseHOF($results['Drones']['ActualDamage']['Mines'], array('Combat', 'Forces', 'Mines', 'Damage Done'), HOF_PUBLIC);
@@ -965,14 +965,14 @@  discard block
 block discarded – undo
965 965
 		}
966 966
 		$results['DeadBeforeShot'] = false;
967 967
 		foreach ($this->weapons as $orderID => $weapon) {
968
-			$results['Weapons'][$orderID] =& $weapon->shootPort($thisPlayer, $port);
968
+			$results['Weapons'][$orderID] = & $weapon->shootPort($thisPlayer, $port);
969 969
 			if ($results['Weapons'][$orderID]['Hit']) {
970 970
 				$results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
971 971
 			}
972 972
 		}
973 973
 		if ($this->hasCDs()) {
974 974
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs());
975
-			$results['Drones'] =& $thisCDs->shootPort($thisPlayer, $port);
975
+			$results['Drones'] = & $thisCDs->shootPort($thisPlayer, $port);
976 976
 			$results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage'];
977 977
 		}
978 978
 		$thisPlayer->increaseExperience(IRound($results['TotalDamage'] * self::EXP_PER_DAMAGE_PORT));
@@ -1003,14 +1003,14 @@  discard block
 block discarded – undo
1003 1003
 		}
1004 1004
 		$results['DeadBeforeShot'] = false;
1005 1005
 		foreach ($this->weapons as $orderID => $weapon) {
1006
-			$results['Weapons'][$orderID] =& $weapon->shootPlanet($thisPlayer, $planet, $delayed);
1006
+			$results['Weapons'][$orderID] = & $weapon->shootPlanet($thisPlayer, $planet, $delayed);
1007 1007
 			if ($results['Weapons'][$orderID]['Hit']) {
1008 1008
 				$results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
1009 1009
 			}
1010 1010
 		}
1011 1011
 		if ($this->hasCDs()) {
1012 1012
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs());
1013
-			$results['Drones'] =& $thisCDs->shootPlanet($thisPlayer, $planet, $delayed);
1013
+			$results['Drones'] = & $thisCDs->shootPlanet($thisPlayer, $planet, $delayed);
1014 1014
 			$results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage'];
1015 1015
 		}
1016 1016
 		$thisPlayer->increaseExperience(IRound($results['TotalDamage'] * self::EXP_PER_DAMAGE_PLANET));
Please login to merge, or discard this patch.
lib/Default/SmrWeapon.class.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -193,22 +193,28 @@
 block discarded – undo
193 193
 	}
194 194
 	
195 195
 	public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
196
-		if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
196
+		if (!$this->canShootForces()) {
197
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
197 198
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
199
+		}
198 200
 		$damage =& $this->getModifiedDamage();
199 201
 		return $damage;
200 202
 	}
201 203
 	
202 204
 	public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
203
-		if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
205
+		if (!$this->canShootPorts()) {
206
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
204 207
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
208
+		}
205 209
 		$damage =& $this->getModifiedDamage();
206 210
 		return $damage;
207 211
 	}
208 212
 	
209 213
 	public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) {
210
-		if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
214
+		if (!$this->canShootPlanets()) {
215
+			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
211 216
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
217
+		}
212 218
 		$damage =& $this->getModifiedDamage();
213 219
 		
214 220
 		$planetMod = self::PLANET_DAMAGE_MOD;
Please login to merge, or discard this patch.
lib/Default/AbstractSmrCombatWeapon.class.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	protected $maxDamage;
13 13
 	protected $shieldDamage;
14 14
 	protected $armourDamage;
15
-	protected $empDamage=0;
15
+	protected $empDamage = 0;
16 16
 	protected $accuracy;
17 17
 	protected $damageRollover;
18 18
 	protected $raidWeapon;
@@ -85,68 +85,68 @@  discard block
 block discarded – undo
85 85
 	abstract public function &getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer);
86 86
 	
87 87
 	protected function &doPlayerDamageToForce(array &$return, AbstractSmrPlayer $weaponPlayer, SmrForce $forces) {
88
-		$return['WeaponDamage'] =& $this->getModifiedDamageAgainstForces($weaponPlayer,$forces);
89
-		$return['ActualDamage'] =& $forces->doWeaponDamage($return['WeaponDamage']);
90
-		if($return['ActualDamage']['KillingShot']) {
91
-			$return['KillResults'] =& $forces->killForcesByPlayer($weaponPlayer);
88
+		$return['WeaponDamage'] = & $this->getModifiedDamageAgainstForces($weaponPlayer, $forces);
89
+		$return['ActualDamage'] = & $forces->doWeaponDamage($return['WeaponDamage']);
90
+		if ($return['ActualDamage']['KillingShot']) {
91
+			$return['KillResults'] = & $forces->killForcesByPlayer($weaponPlayer);
92 92
 		}
93 93
 		return $return;
94 94
 	}
95 95
 	
96 96
 	protected function &doPlayerDamageToPlayer(array &$return, AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) {
97
-		$return['WeaponDamage'] =& $this->getModifiedDamageAgainstPlayer($weaponPlayer,$targetPlayer);
98
-		$return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
97
+		$return['WeaponDamage'] = & $this->getModifiedDamageAgainstPlayer($weaponPlayer, $targetPlayer);
98
+		$return['ActualDamage'] = & $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
99 99
 
100
-		if($return['ActualDamage']['KillingShot']) {
101
-			$return['KillResults'] =& $targetPlayer->killPlayerByPlayer($weaponPlayer);
100
+		if ($return['ActualDamage']['KillingShot']) {
101
+			$return['KillResults'] = & $targetPlayer->killPlayerByPlayer($weaponPlayer);
102 102
 		}
103 103
 		return $return;
104 104
 	}
105 105
 	
106 106
 	protected function &doPlayerDamageToPort(array &$return, AbstractSmrPlayer $weaponPlayer, SmrPort $port) {
107
-		$return['WeaponDamage'] =& $this->getModifiedDamageAgainstPort($weaponPlayer,$port);
108
-		$return['ActualDamage'] =& $port->doWeaponDamage($return['WeaponDamage']);
109
-		if($return['ActualDamage']['KillingShot']) {
110
-			$return['KillResults'] =& $port->killPortByPlayer($weaponPlayer);
107
+		$return['WeaponDamage'] = & $this->getModifiedDamageAgainstPort($weaponPlayer, $port);
108
+		$return['ActualDamage'] = & $port->doWeaponDamage($return['WeaponDamage']);
109
+		if ($return['ActualDamage']['KillingShot']) {
110
+			$return['KillResults'] = & $port->killPortByPlayer($weaponPlayer);
111 111
 		}
112 112
 		return $return;
113 113
 	}
114 114
 	
115 115
 	protected function &doPlayerDamageToPlanet(array &$return, AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet, $delayed) {
116
-		$return['WeaponDamage'] =& $this->getModifiedDamageAgainstPlanet($weaponPlayer,$planet);
117
-		$return['ActualDamage'] =& $planet->doWeaponDamage($return['WeaponDamage'],$delayed);
118
-		if($return['ActualDamage']['KillingShot']) {
119
-			$return['KillResults'] =& $planet->killPlanetByPlayer($weaponPlayer);
116
+		$return['WeaponDamage'] = & $this->getModifiedDamageAgainstPlanet($weaponPlayer, $planet);
117
+		$return['ActualDamage'] = & $planet->doWeaponDamage($return['WeaponDamage'], $delayed);
118
+		if ($return['ActualDamage']['KillingShot']) {
119
+			$return['KillResults'] = & $planet->killPlanetByPlayer($weaponPlayer);
120 120
 		}
121 121
 		return $return;
122 122
 	}
123 123
 	
124 124
 	protected function &doPortDamageToPlayer(array &$return, SmrPort $port, AbstractSmrPlayer $targetPlayer) {
125
-		$return['WeaponDamage'] =& $this->getModifiedPortDamageAgainstPlayer($port,$targetPlayer);
126
-		$return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
125
+		$return['WeaponDamage'] = & $this->getModifiedPortDamageAgainstPlayer($port, $targetPlayer);
126
+		$return['ActualDamage'] = & $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
127 127
 
128
-		if($return['ActualDamage']['KillingShot']) {
129
-			$return['KillResults'] =& $targetPlayer->killPlayerByPort($port);
128
+		if ($return['ActualDamage']['KillingShot']) {
129
+			$return['KillResults'] = & $targetPlayer->killPlayerByPort($port);
130 130
 		}
131 131
 		return $return;
132 132
 	}
133 133
 	
134 134
 	protected function &doPlanetDamageToPlayer(array &$return, SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) {
135
-		$return['WeaponDamage'] =& $this->getModifiedPlanetDamageAgainstPlayer($planet,$targetPlayer);
136
-		$return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
135
+		$return['WeaponDamage'] = & $this->getModifiedPlanetDamageAgainstPlayer($planet, $targetPlayer);
136
+		$return['ActualDamage'] = & $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
137 137
 
138
-		if($return['ActualDamage']['KillingShot']) {
139
-			$return['KillResults'] =& $targetPlayer->killPlayerByPlanet($planet);
138
+		if ($return['ActualDamage']['KillingShot']) {
139
+			$return['KillResults'] = & $targetPlayer->killPlayerByPlanet($planet);
140 140
 		}
141 141
 		return $return;
142 142
 	}
143 143
 	
144 144
 	protected function &doForceDamageToPlayer(array &$return, SmrForce $forces, AbstractSmrPlayer $targetPlayer) {
145
-		$return['WeaponDamage'] =& $this->getModifiedForceDamageAgainstPlayer($forces,$targetPlayer);
146
-		$return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
145
+		$return['WeaponDamage'] = & $this->getModifiedForceDamageAgainstPlayer($forces, $targetPlayer);
146
+		$return['ActualDamage'] = & $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']);
147 147
 
148
-		if($return['ActualDamage']['KillingShot']) {
149
-			$return['KillResults'] =& $targetPlayer->killPlayerByForces($forces);
148
+		if ($return['ActualDamage']['KillingShot']) {
149
+			$return['KillResults'] = & $targetPlayer->killPlayerByForces($forces);
150 150
 		}
151 151
 		return $return;
152 152
 	}
Please login to merge, or discard this patch.
lib/Default/AbstractSmrPlayer.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
lib/Default/Routes/RouteGenerator.class.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 		$routes = array();
72 72
 		foreach ($distances as $currentSectorId => $d) {
73 73
 			$raceID = $sectors[$currentSectorId]->getPort()->getRaceID();
74
-			if (isset($races[$raceID])===false) {
75
-				echo 'Error with Race ID: '.$sectors[$currentSectorId]->getPort()->getRaceID();
74
+			if (isset($races[$raceID]) === false) {
75
+				echo 'Error with Race ID: ' . $sectors[$currentSectorId]->getPort()->getRaceID();
76 76
 				continue;
77 77
 			}
78
-			if($races[$raceID]===false) {
78
+			if ($races[$raceID] === false) {
79 79
 				continue;
80 80
 			}
81 81
 			$rl = array();
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 				if (!$races[$sectors[$targetSectorId]->getPort()->getRaceID()]) {
84 84
 					continue;
85 85
 				}
86
-				if($routesForPort!==-1 && $currentSectorId !== $routesForPort && $targetSectorId !== $routesForPort) {
86
+				if ($routesForPort !== -1 && $currentSectorId !== $routesForPort && $targetSectorId !== $routesForPort) {
87 87
 					continue;
88 88
 				}
89 89
 
90
-				if ($goods[GOOD_NOTHING]===true) {
90
+				if ($goods[GOOD_NOTHING] === true) {
91 91
 					$rl[] = new OneWayRoute($currentSectorId, $targetSectorId, $raceID, $sectors[$targetSectorId]->getPort()->getRaceID(), 0, 0, $distance, GOOD_NOTHING);
92 92
 				}
93 93
 
94 94
 				foreach (\Globals::getGoods() as $goodId => $value) {
95
-					if ($goods[$goodId]===true) {
95
+					if ($goods[$goodId] === true) {
96 96
 						if ($sectors[$currentSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_SELLS &&
97 97
 						    $sectors[$targetSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_BUYS) {
98 98
 							$rl[] = new OneWayRoute($currentSectorId, $targetSectorId, $raceID, $sectors[$targetSectorId]->getPort()->getRaceID(), $sectors[$currentSectorId]->getPort()->getGoodDistance($goodId), $sectors[$targetSectorId]->getPort()->getGoodDistance($goodId), $distance, $goodId);
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	public static function generateOneWayRoutes(array $sectors, array $distances, array $goods, array $races, int $routesForPort) : array {
109 109
 		self::initialize();
110 110
 		foreach ($distances as $currentSectorId => $d) {
111
-			if ($races[$sectors[$currentSectorId]->getPort()->getRaceID()]===false) {
111
+			if ($races[$sectors[$currentSectorId]->getPort()->getRaceID()] === false) {
112 112
 				continue;
113 113
 			}
114 114
 			foreach ($d as $targetSectorId => $distance) {
115
-				if ($races[$sectors[$targetSectorId]->getPort()->getRaceID()]===false) {
115
+				if ($races[$sectors[$targetSectorId]->getPort()->getRaceID()] === false) {
116 116
 					continue;
117 117
 				}
118
-				if($routesForPort!==-1 && $currentSectorId !== $routesForPort && $targetSectorId !== $routesForPort) {
118
+				if ($routesForPort !== -1 && $currentSectorId !== $routesForPort && $targetSectorId !== $routesForPort) {
119 119
 					continue;
120 120
 				}
121 121
 
122 122
 				foreach (\Globals::getGoods() as $goodId => $value) {
123
-					if ($goods[$goodId]===true) {
123
+					if ($goods[$goodId] === true) {
124 124
 						if ($sectors[$currentSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_SELLS &&
125 125
 						    $sectors[$targetSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_BUYS) {
126 126
 							$owr = new OneWayRoute($currentSectorId, $targetSectorId, $sectors[$currentSectorId]->getPort()->getRaceID(), $sectors[$targetSectorId]->getPort()->getRaceID(), $sectors[$currentSectorId]->getPort()->getGoodDistance($goodId), $sectors[$targetSectorId]->getPort()->getGoodDistance($goodId), $distance, $goodId);
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 		$i = 0;
167 167
 		krsort(self::$expRoutes, SORT_NUMERIC);
168 168
 		foreach (self::$expRoutes as $multi => $routesByMulti) {
169
-			if(count($routesByMulti)+$i < $trimToBestXRoutes) {
169
+			if (count($routesByMulti) + $i < $trimToBestXRoutes) {
170 170
 				$i += count($routesByMulti);
171 171
 			}
172
-			else if($i > $trimToBestXRoutes) {
172
+			else if ($i > $trimToBestXRoutes) {
173 173
 				unset(self::$expRoutes[$multi]);
174 174
 			}
175 175
 			else {
176
-				foreach($routesByMulti as $key => $value) {
176
+				foreach ($routesByMulti as $key => $value) {
177 177
 					$i++;
178
-					if($i < $trimToBestXRoutes) {
178
+					if ($i < $trimToBestXRoutes) {
179 179
 						continue;
180 180
 					}
181
-					if($i === $trimToBestXRoutes) {
181
+					if ($i === $trimToBestXRoutes) {
182 182
 						self::$dontAddWorseThan[self::EXP_ROUTE] = $multi;
183 183
 						continue;
184 184
 					}
@@ -190,20 +190,20 @@  discard block
 block discarded – undo
190 190
 		$i = 0;
191 191
 		krsort(self::$moneyRoutes, SORT_NUMERIC);
192 192
 		foreach (self::$moneyRoutes as $multi => $routesByMulti) {
193
-			if(count($routesByMulti)+$i < $trimToBestXRoutes) {
193
+			if (count($routesByMulti) + $i < $trimToBestXRoutes) {
194 194
 				$i += count($routesByMulti);
195 195
 			}
196
-			else if($i > $trimToBestXRoutes) {
196
+			else if ($i > $trimToBestXRoutes) {
197 197
 				unset(self::$moneyRoutes[$multi]);
198 198
 				continue;
199 199
 			}
200 200
 			else {
201
-				foreach($routesByMulti as $key => $value) {
201
+				foreach ($routesByMulti as $key => $value) {
202 202
 					$i++;
203
-					if($i < $trimToBestXRoutes) {
203
+					if ($i < $trimToBestXRoutes) {
204 204
 						continue;
205 205
 					}
206
-					if($i === $trimToBestXRoutes) {
206
+					if ($i === $trimToBestXRoutes) {
207 207
 						self::$dontAddWorseThan[self::MONEY_ROUTE] = $multi;
208 208
 						continue;
209 209
 					}
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
 					$mpr = new MultiplePortRoute($routeToContinue, $currentStepRoute);
59 59
 					self::addExpRoute($mpr);
60 60
 					self::addMoneyRoute($mpr);
61
-				}
62
-				else if ($maxNumPorts > 1 && !$routeToContinue->containsPort($currentStepBuySector)) {
61
+				} else if ($maxNumPorts > 1 && !$routeToContinue->containsPort($currentStepBuySector)) {
63 62
 					$mpr = new MultiplePortRoute($routeToContinue, $currentStepRoute);
64 63
 					self::getContinueRoutes($maxNumPorts - 1, $startSectorId, $mpr, $routeLists[$currentStepBuySector], $routeLists, $lastGoodIsNothing);
65 64
 				}
@@ -168,11 +167,9 @@  discard block
 block discarded – undo
168 167
 		foreach (self::$expRoutes as $multi => $routesByMulti) {
169 168
 			if(count($routesByMulti)+$i < $trimToBestXRoutes) {
170 169
 				$i += count($routesByMulti);
171
-			}
172
-			else if($i > $trimToBestXRoutes) {
170
+			} else if($i > $trimToBestXRoutes) {
173 171
 				unset(self::$expRoutes[$multi]);
174
-			}
175
-			else {
172
+			} else {
176 173
 				foreach($routesByMulti as $key => $value) {
177 174
 					$i++;
178 175
 					if($i < $trimToBestXRoutes) {
@@ -192,12 +189,10 @@  discard block
 block discarded – undo
192 189
 		foreach (self::$moneyRoutes as $multi => $routesByMulti) {
193 190
 			if(count($routesByMulti)+$i < $trimToBestXRoutes) {
194 191
 				$i += count($routesByMulti);
195
-			}
196
-			else if($i > $trimToBestXRoutes) {
192
+			} else if($i > $trimToBestXRoutes) {
197 193
 				unset(self::$moneyRoutes[$multi]);
198 194
 				continue;
199
-			}
200
-			else {
195
+			} else {
201 196
 				foreach($routesByMulti as $key => $value) {
202 197
 					$i++;
203 198
 					if($i < $trimToBestXRoutes) {
Please login to merge, or discard this patch.
admin/Default/box_delete_processing.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 	foreach ($_REQUEST['message_id'] as $id) {
9 9
 		$db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id));
10 10
 	}
11
-}
12
-else if ($action == 'All Messages') {
11
+} else if ($action == 'All Messages') {
13 12
 	if (!isset($var['box_type_id'])) {
14 13
 		create_error('No box selected.');
15 14
 	}
Please login to merge, or discard this patch.
htdocs/loader.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,9 +74,15 @@  discard block
 block discarded – undo
74 74
 	// Must not call `get_file_loc` until after we have set $overrideGameID
75 75
 	// (unless we're exiting immediately with an error, as above).
76 76
 	$overrideGameID = 0;
77
-	if (isset($var['game_id']) && is_numeric($var['game_id'])) $overrideGameID = $var['game_id'];
78
-	if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) $overrideGameID = $var['GameID'];
79
-	if ($overrideGameID == 0) $overrideGameID = SmrSession::getGameID();
77
+	if (isset($var['game_id']) && is_numeric($var['game_id'])) {
78
+		$overrideGameID = $var['game_id'];
79
+	}
80
+	if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) {
81
+		$overrideGameID = $var['GameID'];
82
+	}
83
+	if ($overrideGameID == 0) {
84
+		$overrideGameID = SmrSession::getGameID();
85
+	}
80 86
 
81 87
 	require_once(get_file_loc('smr.inc'));
82 88
 
@@ -92,22 +98,19 @@  discard block
 block discarded – undo
92 98
 			} else {
93 99
 				forward(create_container('skeleton.php', 'invalid_email.php'));
94 100
 			}
95
-		}
96
-		else if ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) {
101
+		} else if ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) {
97 102
 			if (isset($var['do_reopen_account'])) {
98 103
 				// The user has requested to reopen their account
99 104
 				$account->unbanAccount($account);
100 105
 			} else {
101 106
 				forward(create_container('skeleton.php', 'reopen_account.php'));
102 107
 			}
103
-		}
104
-		else {
108
+		} else {
105 109
 			forward(create_container('disabled.php'));
106 110
 		}
107 111
 	}
108 112
 	
109 113
 	do_voodoo();
110
-}
111
-catch (Throwable $e) {
114
+} catch (Throwable $e) {
112 115
 	handleException($e);
113 116
 }
Please login to merge, or discard this patch.