diff --git a/lib/Default/AbstractSmrAccount.class.inc b/lib/Default/AbstractSmrAccount.class.inc index 0de091c67..15e6d2715 100644 --- a/lib/Default/AbstractSmrAccount.class.inc +++ b/lib/Default/AbstractSmrAccount.class.inc @@ -168,7 +168,7 @@ abstract class AbstractSmrAccount { return self::getAccountByName($login); } - public static function getUserScoreCaseStatement(&$db) { + public static function getUserScoreCaseStatement($db) { $userRankingTypes = array(); $case = 'FLOOR(SUM(CASE type '; foreach(self::$USER_RANKINGS_SCORE as $userRankingScore) { @@ -437,7 +437,7 @@ abstract class AbstractSmrAccount { return $this->score; } - public function &getIndividualScores(SmrPlayer &$player = null) { + public function &getIndividualScores(SmrPlayer $player = null) { $gameID=0; if($player!=null) $gameID = $player->getGameID(); @@ -526,7 +526,7 @@ abstract class AbstractSmrAccount { $credits+=$rewardCredits; $rewardCredits=0; } - if($this->credits==0&&$this->rewardCredits==0) + if($this->credits==0 && $this->rewardCredits==0) $this->db->query('REPLACE INTO account_has_credits (account_id, credits_left, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).','.$this->db->escapeNumber($rewardCredits).')'); else $this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).', reward_credits='.$this->db->escapeNumber($rewardCredits).' WHERE '.$this->SQL.' LIMIT 1'); @@ -547,7 +547,7 @@ abstract class AbstractSmrAccount { public function setSmrCredits($credits) { if($this->getSmrCredits()==$credits) return; - if($this->credits==0&&$this->rewardCredits==0) + if($this->credits==0 && $this->rewardCredits==0) $this->db->query('REPLACE INTO account_has_credits (account_id, credits_left) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')'); else $this->db->query('UPDATE account_has_credits SET credits_left='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1'); @@ -575,7 +575,7 @@ abstract class AbstractSmrAccount { public function setSmrRewardCredits($credits) { if($this->getSmrRewardCredits()==$credits) return; - if($this->credits==0&&$this->rewardCredits==0) + if($this->credits==0 && $this->rewardCredits==0) $this->db->query('REPLACE INTO account_has_credits (account_id, reward_credits) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($credits).')'); else $this->db->query('UPDATE account_has_credits SET reward_credits='.$this->db->escapeNumber($credits).' WHERE '.$this->SQL.' LIMIT 1'); @@ -1172,7 +1172,7 @@ abstract class AbstractSmrAccount { $this->setPoints($this->getPoints()-$numPoints,$lastUpdate); } - public function addPoints($numPoints,SmrAccount &$admin,$reasonID,$suspicion) { + public function addPoints($numPoints,SmrAccount $admin,$reasonID,$suspicion) { //do we have points $this->setPoints($this->getPoints() + $numPoints,TIME); $totalPoints = $this->getPoints(); @@ -1232,7 +1232,7 @@ abstract class AbstractSmrAccount { $this->hasChanged = true; } - public function banAccount($expireTime,SmrAccount &$admin,$reasonID,$suspicion,$removeExceptions = false) { + public function banAccount($expireTime,SmrAccount $admin,$reasonID,$suspicion,$removeExceptions = false) { $this->db->query('REPLACE INTO account_is_closed (account_id, reason_id, suspicion, expires) VALUES('.$this->db->escapeNumber($this->getAccountID()).', '.$this->db->escapeNumber($reasonID).', '.$this->db->escapeString($suspicion).', '.$this->db->escapeNumber($expireTime).')'); @@ -1261,7 +1261,7 @@ abstract class AbstractSmrAccount { $this->db->query('DELETE FROM account_exceptions WHERE ' . $this->SQL); } - public function unbanAccount(SmrAccount &$admin = null,$currException=false) { + public function unbanAccount(SmrAccount $admin = null,$currException=false) { $adminID = 0; if($admin!==null) $adminID = $admin->getAccountID(); diff --git a/lib/Default/AbstractSmrCombatWeapon.class.inc b/lib/Default/AbstractSmrCombatWeapon.class.inc index 7f1dbd9e4..ae2116036 100644 --- a/lib/Default/AbstractSmrCombatWeapon.class.inc +++ b/lib/Default/AbstractSmrCombatWeapon.class.inc @@ -73,14 +73,14 @@ abstract class AbstractSmrCombatWeapon { return array('MaxDamage' => $this->getMaxDamage(), 'Shield' => $this->getShieldDamage(), 'Armour' => $this->getArmourDamage(), 'Rollover' => $this->isDamageRollover()); } - abstract public function &getModifiedDamageAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces); - abstract public function &getModifiedDamageAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port); - abstract public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet); - abstract public function &getModifiedPortDamageAgainstPlayer(SmrPort &$port, AbstractSmrPlayer &$targetPlayer); - abstract public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer); - abstract public function &getModifiedForceDamageAgainstPlayer(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer); - - protected function &doPlayerDamageToForce(array &$return, AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + abstract public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces); + abstract public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port); + abstract public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet); + abstract public function &getModifiedPortDamageAgainstPlayer(SmrPort $port, AbstractSmrPlayer $targetPlayer); + abstract public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer); + abstract public function &getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer); + + protected function &doPlayerDamageToForce(array &$return, AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { $return['WeaponDamage'] =& $this->getModifiedDamageAgainstForces($weaponPlayer,$forces); $return['ActualDamage'] =& $forces->doWeaponDamage($return['WeaponDamage']); if($return['ActualDamage']['KillingShot']) @@ -88,7 +88,7 @@ abstract class AbstractSmrCombatWeapon { return $return; } - protected function &doPlayerDamageToPlayer(array &$return, AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + protected function &doPlayerDamageToPlayer(array &$return, AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { $return['WeaponDamage'] =& $this->getModifiedDamageAgainstPlayer($weaponPlayer,$targetPlayer); $return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']); @@ -97,7 +97,7 @@ abstract class AbstractSmrCombatWeapon { return $return; } - protected function &doPlayerDamageToPort(array &$return, AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + protected function &doPlayerDamageToPort(array &$return, AbstractSmrPlayer $weaponPlayer, SmrPort $port) { $return['WeaponDamage'] =& $this->getModifiedDamageAgainstPort($weaponPlayer,$port); $return['ActualDamage'] =& $port->doWeaponDamage($return['WeaponDamage']); if($return['ActualDamage']['KillingShot']) @@ -105,7 +105,7 @@ abstract class AbstractSmrCombatWeapon { return $return; } - protected function &doPlayerDamageToPlanet(array &$return, AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet, $delayed) { + protected function &doPlayerDamageToPlanet(array &$return, AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet, $delayed) { $return['WeaponDamage'] =& $this->getModifiedDamageAgainstPlanet($weaponPlayer,$planet); $return['ActualDamage'] =& $planet->doWeaponDamage($return['WeaponDamage'],$delayed); if($return['ActualDamage']['KillingShot']) @@ -113,7 +113,7 @@ abstract class AbstractSmrCombatWeapon { return $return; } - protected function &doPortDamageToPlayer(array &$return, SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { + protected function &doPortDamageToPlayer(array &$return, SmrPort $port, AbstractSmrPlayer $targetPlayer) { $return['WeaponDamage'] =& $this->getModifiedPortDamageAgainstPlayer($port,$targetPlayer); $return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']); @@ -122,7 +122,7 @@ abstract class AbstractSmrCombatWeapon { return $return; } - protected function &doPlanetDamageToPlayer(array &$return, SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { + protected function &doPlanetDamageToPlayer(array &$return, SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { $return['WeaponDamage'] =& $this->getModifiedPlanetDamageAgainstPlayer($planet,$targetPlayer); $return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']); @@ -131,7 +131,7 @@ abstract class AbstractSmrCombatWeapon { return $return; } - protected function &doForceDamageToPlayer(array &$return, SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { + protected function &doForceDamageToPlayer(array &$return, SmrForce $forces, AbstractSmrPlayer $targetPlayer) { $return['WeaponDamage'] =& $this->getModifiedForceDamageAgainstPlayer($forces,$targetPlayer); $return['ActualDamage'] =& $targetPlayer->getShip()->doWeaponDamage($return['WeaponDamage']); @@ -140,9 +140,9 @@ abstract class AbstractSmrCombatWeapon { return $return; } - abstract public function &shootForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces); - abstract public function &shootPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer); - abstract public function &shootPlayerAsForce(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer); + abstract public function &shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces); + abstract public function &shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer); + abstract public function &shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer); } -?> \ No newline at end of file +?> diff --git a/lib/Default/AbstractSmrPlayer.class.inc b/lib/Default/AbstractSmrPlayer.class.inc index 554faacd0..9b451ae1e 100644 --- a/lib/Default/AbstractSmrPlayer.class.inc +++ b/lib/Default/AbstractSmrPlayer.class.inc @@ -491,7 +491,7 @@ abstract class AbstractSmrPlayer { return Globals::getRaceName($this->getRaceID()); } - public static function getColouredRaceNameOrDefault($otherRaceID, AbstractSmrPlayer &$player = null, $linked = false) { + public static function getColouredRaceNameOrDefault($otherRaceID, AbstractSmrPlayer $player = null, $linked = false) { $relations = 0; if($player !== null) { $relations = $player->getRelation($otherRaceID); @@ -680,23 +680,23 @@ abstract class AbstractSmrPlayer { return max(0,min(1, 1 - ($this->getPastMaint() / ($this->getShip()->getSpeed() * 25 + 475)))); } - public function &shootPlayer(AbstractSmrPlayer &$targetPlayer) { + public function &shootPlayer(AbstractSmrPlayer $targetPlayer) { return $this->getShip()->shootPlayer($targetPlayer); } - public function &shootForces(SmrForce &$forces) { + public function &shootForces(SmrForce $forces) { return $this->getShip()->shootForces($forces); } - public function &shootPort(SmrPort &$port) { + public function &shootPort(SmrPort $port) { return $this->getShip()->shootPort($port); } - public function &shootPlanet(SmrPlanet &$planet, $delayed) { + public function &shootPlanet(SmrPlanet $planet, $delayed) { return $this->getShip()->shootPlanet($planet, $delayed); } - public function &shootPlayers(array &$targetPlayers) { + public function &shootPlayers(array $targetPlayers) { return $this->getShip()->shootPlayers($targetPlayers); } @@ -950,10 +950,10 @@ abstract class AbstractSmrPlayer { } abstract public function killPlayer($sectorID); - abstract public function &killPlayerByPlayer(AbstractSmrPlayer &$killer); - abstract public function &killPlayerByForces(SmrForce &$forces); - abstract public function &killPlayerByPort(SmrPort &$port); - abstract public function &killPlayerByPlanet(SmrPlanet &$planet); + abstract public function &killPlayerByPlayer(AbstractSmrPlayer $killer); + abstract public function &killPlayerByForces(SmrForce $forces); + abstract public function &killPlayerByPort(SmrPort $port); + abstract public function &killPlayerByPlanet(SmrPlanet $planet); abstract public function getHome(); @@ -1300,8 +1300,8 @@ abstract class AbstractSmrPlayer { } } - public function canSeeAny(array &$otherPlayerArray) { - foreach($otherPlayerArray as &$otherPlayer) { + public function canSeeAny(array $otherPlayerArray) { + foreach($otherPlayerArray as $otherPlayer) { if($this->canSee($otherPlayer)) { return true; } @@ -1309,7 +1309,7 @@ abstract class AbstractSmrPlayer { return false; } - public function canSee(AbstractSmrPlayer &$otherPlayer) { + public function canSee(AbstractSmrPlayer $otherPlayer) { if(!$otherPlayer->getShip()->isCloaked()) return true; if($this->sameAlliance($otherPlayer)) @@ -1319,51 +1319,51 @@ abstract class AbstractSmrPlayer { return false; } - public function equals(AbstractSmrPlayer &$otherPlayer = null) { - return $otherPlayer!==null && $this->getAccountID()==$otherPlayer->getAccountID()&&$this->getGameID()==$otherPlayer->getGameID(); + public function equals(AbstractSmrPlayer $otherPlayer = null) { + return $otherPlayer!==null && $this->getAccountID()==$otherPlayer->getAccountID() && $this->getGameID()==$otherPlayer->getGameID(); } - public function sameAlliance(AbstractSmrPlayer &$otherPlayer = null) { - return $otherPlayer != null && ($this->equals($otherPlayer) || ($this->hasAlliance()&&$this->getAllianceID()==$otherPlayer->getAllianceID())); + public function sameAlliance(AbstractSmrPlayer $otherPlayer = null) { + return $otherPlayer != null && ($this->equals($otherPlayer) || ($this->hasAlliance() && $this->getAllianceID()==$otherPlayer->getAllianceID())); } - public function sharedForceAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function sharedForceAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function forceNAPAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function forceNAPAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function planetNAPAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function planetNAPAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function traderNAPAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderNAPAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function traderMAPAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderMAPAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->traderAttackTraderAlliance($otherPlayer) && $this->traderDefendTraderAlliance($otherPlayer); } - public function traderAttackTraderAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderAttackTraderAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function traderDefendTraderAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderDefendTraderAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function traderAttackForceAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderAttackForceAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function traderAttackPortAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderAttackPortAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } - public function traderAttackPlanetAlliance(AbstractSmrPlayer &$otherPlayer = null) { + public function traderAttackPlanetAlliance(AbstractSmrPlayer $otherPlayer = null) { return $this->sameAlliance($otherPlayer); } diff --git a/lib/Default/AbstractSmrShip.class.inc b/lib/Default/AbstractSmrShip.class.inc index e1b8763ae..cf236daa0 100644 --- a/lib/Default/AbstractSmrShip.class.inc +++ b/lib/Default/AbstractSmrShip.class.inc @@ -37,7 +37,7 @@ abstract class AbstractSmrShip { return self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID]; } - protected static function &buildBaseShip(Database &$db) { + protected static function &buildBaseShip(Database $db) { $ship = array(); $ship['Type'] = 'Ship'; $ship['Name'] = $db->getField('ship_name'); @@ -120,7 +120,7 @@ abstract class AbstractSmrShip { return self::$CACHE_BASE_SHIPS[$gameTypeID]; } - protected function __construct(AbstractSmrPlayer &$player) { + protected function __construct(AbstractSmrPlayer $player) { $this->player = $player; $this->gameID = $player->getGameID(); $this->regenerateBaseShip(); @@ -191,7 +191,7 @@ abstract class AbstractSmrShip { public function getPowerUsed() { $power = 0; if($this->getNumWeapons()>0) - foreach ($this->weapons as &$weapon) + foreach ($this->weapons as $weapon) $power += $weapon->getPowerLevel(); return $power; } @@ -212,7 +212,7 @@ abstract class AbstractSmrShip { return $this->hasCargo(5) || $this->hasCargo(9) || $this->hasCargo(12); } - public function getDisplayAttackRating(AbstractSmrPlayer &$player) { + public function getDisplayAttackRating(AbstractSmrPlayer $player) { if($this->hasActiveIllusion()) return $this->getIllusionAttack(); else @@ -905,13 +905,13 @@ abstract class AbstractSmrShip { return $this->getShipTypeID() == 23 || $this->getShipTypeID() == 24 || $this->getShipTypeID() == 25; } - public function &shootPlayer(AbstractSmrPlayer &$targetPlayer) { - return $this->shootPlayers(array(&$targetPlayer)); + public function &shootPlayer(AbstractSmrPlayer $targetPlayer) { + return $this->shootPlayers(array($targetPlayer)); } - public function &shootPlayers(array &$targetPlayers) { + public function &shootPlayers(array $targetPlayers) { $thisPlayer = $this->getPlayer(); - $results = array('Player' => &$thisPlayer, 'TotalDamage' => 0); + $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); if($thisPlayer->isDead()) { $results['DeadBeforeShot'] = true; return $results; @@ -933,9 +933,9 @@ abstract class AbstractSmrShip { return $results; } - public function &shootForces(SmrForce &$forces) { + public function &shootForces(SmrForce $forces) { $thisPlayer = $this->getPlayer(); - $results = array('Player' => &$thisPlayer, 'TotalDamage' => 0); + $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); if($thisPlayer->isDead()) { $results['DeadBeforeShot'] = true; return $results; @@ -972,9 +972,9 @@ abstract class AbstractSmrShip { return $results; } - public function &shootPort(SmrPort &$port) { + public function &shootPort(SmrPort $port) { $thisPlayer = $this->getPlayer(); - $results = array('Player' => &$thisPlayer, 'TotalDamage' => 0); + $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); if($thisPlayer->isDead()) { $results['DeadBeforeShot'] = true; return $results; @@ -1009,9 +1009,9 @@ abstract class AbstractSmrShip { return $results; } - public function &shootPlanet(SmrPlanet &$planet, $delayed) { + public function &shootPlanet(SmrPlanet $planet, $delayed) { $thisPlayer = $this->getPlayer(); - $results = array('Player' => &$thisPlayer, 'TotalDamage' => 0); + $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); if($thisPlayer->isDead()) { $results['DeadBeforeShot'] = true; return $results; diff --git a/lib/Default/DummyPlayer.class.inc b/lib/Default/DummyPlayer.class.inc index f02734382..a4517bb4d 100644 --- a/lib/Default/DummyPlayer.class.inc +++ b/lib/Default/DummyPlayer.class.inc @@ -121,7 +121,7 @@ class DummyPlayer extends AbstractSmrPlayer { $this->allianceID=$ID; } - public function &killPlayerByPlayer(AbstractSmrPlayer &$killer) { + public function &killPlayerByPlayer(AbstractSmrPlayer $killer) { $return = array(); $msg = $this->getDisplayName(); @@ -257,13 +257,13 @@ class DummyPlayer extends AbstractSmrPlayer { return $return; } - public function &killPlayerByForces(SmrForce &$forces) { + public function &killPlayerByForces(SmrForce $forces) { } - public function &killPlayerByPort(SmrPort &$port) { + public function &killPlayerByPort(SmrPort $port) { } - public function &killPlayerByPlanet(SmrPlanet &$planet) { + public function &killPlayerByPlanet(SmrPlanet $planet) { } public function &getShip() { diff --git a/lib/Default/DummyShip.class.inc b/lib/Default/DummyShip.class.inc index 629c40f73..99019df0c 100644 --- a/lib/Default/DummyShip.class.inc +++ b/lib/Default/DummyShip.class.inc @@ -4,7 +4,7 @@ require_once('AbstractSmrShip.class.inc'); class DummyShip extends AbstractSmrShip { protected static $CACHED_DUMMY_SHIPS; - public function __construct(AbstractSmrPlayer &$player) { + public function __construct(AbstractSmrPlayer $player) { parent::__construct($player); $this->weapons = array(); @@ -24,8 +24,8 @@ class DummyShip extends AbstractSmrShip { } } - public function regenerate(AbstractSmrPlayer &$player) { - $this->player =& $player; + public function regenerate(AbstractSmrPlayer $player) { + $this->player = $player; $this->regenerateBaseShip(); $this->doFullUNO(); // for($i=0;$i<$this->getHardpoints();++$i) { @@ -63,7 +63,7 @@ class DummyShip extends AbstractSmrShip { unserialize($cache); } - public static function &getCachedDummyShip(AbstractSmrPlayer &$player) { + public static function &getCachedDummyShip(AbstractSmrPlayer $player) { if(!isset(self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()])) { $db = new SmrMySqlDatabase(); $db->query('SELECT info FROM cached_dummys diff --git a/lib/Default/Globals.class.inc b/lib/Default/Globals.class.inc index e95eef0e0..4c443a4d9 100644 --- a/lib/Default/Globals.class.inc +++ b/lib/Default/Globals.class.inc @@ -32,7 +32,7 @@ class Globals { return self::$AVAILABLE_LINKS; } - public static function canAccessPage($pageName, AbstractSmrPlayer &$player, array $extraInfo) { + public static function canAccessPage($pageName, AbstractSmrPlayer $player, array $extraInfo) { switch($pageName) { case 'AllianceMOTD': if($player->getAllianceID() != $extraInfo['AllianceID']) { diff --git a/lib/Default/Plotter.class.inc b/lib/Default/Plotter.class.inc index d978e2754..01614ed03 100644 --- a/lib/Default/Plotter.class.inc +++ b/lib/Default/Plotter.class.inc @@ -85,10 +85,10 @@ class Plotter { * The resulting path prefers neighbors in their order in SmrSector->links, * (i.e. up, down, left, right). */ - public static function &findDistanceToX($x, SmrSector &$sector, $useFirst, AbstractSmrPlayer $needsToHaveBeenExploredBy=null, AbstractSmrPlayer $player=null, $distanceLimit=10000, $lowLimit=0, $highLimit=100000) { + public static function &findDistanceToX($x, SmrSector $sector, $useFirst, AbstractSmrPlayer $needsToHaveBeenExploredBy=null, AbstractSmrPlayer $player=null, $distanceLimit=10000, $lowLimit=0, $highLimit=100000) { $warpAddIndex = TURNS_WARP_SECTOR_EQUIVALENCE-1; - $checkSector =& $sector; + $checkSector = $sector; $gameID = $sector->getGameID(); $distances = array(); $sectorsTravelled = 0; @@ -133,7 +133,7 @@ class Plotter { $visitedSectors[$checkSectorID] = true; // This is here for warps, because they are delayed visits if we set this before the actual visit we'll get sectors marked as visited long before they are actually visited - causes problems when it's quicker to walk to the warp exit than to warp there. // We still need to mark walked sectors as visited before we go to each one otherwise we get a huge number of paths being checked twice (up then left, left then up are essentially the same but if we set up-left as visited only when we actually check it then it gets queued up twice - nasty) if ($checkSectorID >= $lowLimit && $checkSectorID <= $highLimit) { - $checkSector =& SmrSector::getSector($gameID,$checkSectorID); + $checkSector = SmrSector::getSector($gameID,$checkSectorID); if($x=='Distance') { $distances[$sectorsTravelled][$checkSector->getSectorID()] = $distance; } @@ -170,21 +170,21 @@ class Plotter { return $distances; } - public static function &calculatePortToPortDistances(array &$sectors, $distanceLimit = 10000, $lowLimit = 0, $highLimit = 100000) { + public static function &calculatePortToPortDistances(array $sectors, $distanceLimit = 10000, $lowLimit = 0, $highLimit = 100000) { $distances = array(); - foreach($sectors as &$sec) { + foreach($sectors as $sec) { if ($sec !== null) { if ($sec->getSectorID() >= $lowLimit && $sec->getSectorID() <= $highLimit) { if ($sec->hasPort()===true) { - $distances[$sec->getSectorID()] =& self::findDistanceToOtherPorts($sec, $distanceLimit, $lowLimit, $highLimit); + $distances[$sec->getSectorID()] = self::findDistanceToOtherPorts($sec, $distanceLimit, $lowLimit, $highLimit); } } } - } unset($sec); + } return $distances; } - public static function &findDistanceToOtherPorts(SmrSector &$sector, $distanceLimit = 10000, $lowLimit = 0, $highLimit = 100000) { + public static function &findDistanceToOtherPorts(SmrSector $sector, $distanceLimit = 10000, $lowLimit = 0, $highLimit = 100000) { return self::findDistanceToX('Port', $sector, false, null, null, $distanceLimit, $lowLimit, $highLimit, $distanceLimit); } } @@ -253,7 +253,7 @@ class Distance { return $this->path[0]; } - public function compareTo(Distance &$d) { + public function compareTo(Distance $d) { if ($this->equals($d)===true) return 0; else if ($d->getTurns() > $this->getTurns()) diff --git a/lib/Default/SmrAlliance.class.inc b/lib/Default/SmrAlliance.class.inc index 700165ffb..04fded031 100644 --- a/lib/Default/SmrAlliance.class.inc +++ b/lib/Default/SmrAlliance.class.inc @@ -235,7 +235,7 @@ class SmrAlliance { $this->description=nl2br(htmlspecialchars($description)); } - public function canJoinAlliance(SmrPlayer &$player) { + public function canJoinAlliance(SmrPlayer $player) { if($player->hasAlliance()) { return false; } diff --git a/lib/Default/SmrCombatDrones.class.inc b/lib/Default/SmrCombatDrones.class.inc index ee85d5921..fd0d6d638 100644 --- a/lib/Default/SmrCombatDrones.class.inc +++ b/lib/Default/SmrCombatDrones.class.inc @@ -34,51 +34,51 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $modifiedAccuracy; } - protected function getModifiedAccuracyAgainstForcesUsingRandom(AbstractSmrPlayer &$weaponPlayer,SmrForce &$forces, $random) { + protected function getModifiedAccuracyAgainstForcesUsingRandom(AbstractSmrPlayer $weaponPlayer,SmrForce $forces, $random) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy += $random; return max(0,min(100,$modifiedAccuracy)); } - public function getMaxModifiedAccuracyAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function getMaxModifiedAccuracyAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { return $this->getModifiedAccuracyAgainstForcesUsingRandom($weaponPlayer,$forces,self::MAX_CDS_RAND); } - public function getModifiedAccuracyAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function getModifiedAccuracyAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { return $this->getModifiedAccuracyAgainstForcesUsingRandom($weaponPlayer,$forces,mt_rand(3,self::MAX_CDS_RAND)); } - protected function getModifiedAccuracyAgainstPortUsingRandom(AbstractSmrPlayer &$weaponPlayer,SmrPort &$port, $random) { + protected function getModifiedAccuracyAgainstPortUsingRandom(AbstractSmrPlayer $weaponPlayer,SmrPort $port, $random) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy += $random; return max(0,min(100,$modifiedAccuracy)); } - public function getMaxModifiedAccuracyAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function getMaxModifiedAccuracyAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { return $this->getModifiedAccuracyAgainstPortUsingRandom($weaponPlayer,$port,self::MAX_CDS_RAND); } - public function getModifiedAccuracyAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function getModifiedAccuracyAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { return $this->getModifiedAccuracyAgainstPortUsingRandom($weaponPlayer,$port,mt_rand(3,self::MAX_CDS_RAND)); } - protected function getModifiedAccuracyAgainstPlanetUsingRandom(AbstractSmrPlayer &$weaponPlayer,SmrPlanet &$planet, $random) { + protected function getModifiedAccuracyAgainstPlanetUsingRandom(AbstractSmrPlayer $weaponPlayer,SmrPlanet $planet, $random) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy += $random; return max(0,min(100,$modifiedAccuracy)); } - public function getMaxModifiedAccuracyAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function getMaxModifiedAccuracyAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { return $this->getModifiedAccuracyAgainstPlanetUsingRandom($weaponPlayer,$planet,self::MAX_CDS_RAND); } - public function getModifiedAccuracyAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function getModifiedAccuracyAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { return $this->getModifiedAccuracyAgainstPlanetUsingRandom($weaponPlayer,$planet,mt_rand(3,self::MAX_CDS_RAND)); } - public function getModifiedAccuracyAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function getModifiedAccuracyAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { return $this->getModifiedAccuracyAgainstPlayerUsingRandom($weaponPlayer,$targetPlayer,mt_rand(3,self::MAX_CDS_RAND)); } - protected function getModifiedAccuracyAgainstPlayerUsingRandom(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer, $random) { + protected function getModifiedAccuracyAgainstPlayerUsingRandom(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer, $random) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy += ($random + mt_rand($weaponPlayer->getLevelID() / 2,$weaponPlayer->getLevelID()) - ($targetPlayer->getLevelID() - $weaponPlayer->getLevelID())/3)/1.5; @@ -91,34 +91,34 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return max(0,min(100,$modifiedAccuracy)); } - public function getMaxModifiedAccuracyAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function getMaxModifiedAccuracyAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { return $this->getModifiedAccuracyAgainstPlayerUsingRandom($weaponPlayer,$targetPlayer,self::MAX_CDS_RAND); } - public function getModifiedForceAccuracyAgainstPlayer(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer) { + public function getModifiedForceAccuracyAgainstPlayer(SmrForce $forces,AbstractSmrPlayer $targetPlayer) { return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces,$targetPlayer,mt_rand(3,self::MAX_CDS_RAND)); } - protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer, $random) { + protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce $forces,AbstractSmrPlayer $targetPlayer, $random) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy += $random; return max(0,min(100,$modifiedAccuracy)); } - protected function getModifiedPortAccuracyAgainstPlayer(SmrPort &$port,AbstractSmrPlayer &$targetPlayer) { + protected function getModifiedPortAccuracyAgainstPlayer(SmrPort $port,AbstractSmrPlayer $targetPlayer) { return 100; } - protected function getModifiedPlanetAccuracyAgainstPlayer(SmrPlanet &$planet,AbstractSmrPlayer &$targetPlayer) { + protected function getModifiedPlanetAccuracyAgainstPlayer(SmrPlanet $planet,AbstractSmrPlayer $targetPlayer) { return 100; } - public function getMaxModifiedForceAccuracyAgainstPlayer(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer) { + public function getMaxModifiedForceAccuracyAgainstPlayer(SmrForce $forces,AbstractSmrPlayer $targetPlayer) { return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces,$targetPlayer,self::MAX_CDS_RAND); } - public function getMaxModifiedPortAccuracyAgainstPlayer(SmrPort &$forces,AbstractSmrPlayer &$targetPlayer) { + public function getMaxModifiedPortAccuracyAgainstPlayer(SmrPort $forces,AbstractSmrPlayer $targetPlayer) { return 100; } @@ -127,7 +127,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { if(!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); $damage =& $this->getModifiedDamage(); @@ -154,7 +154,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { if(!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); $damage =& $this->getModifiedDamage(); @@ -171,7 +171,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { if(!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); $damage =& $this->getModifiedDamage(); @@ -192,7 +192,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -214,7 +214,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedForceDamageAgainstPlayer(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -234,7 +234,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedPortDamageAgainstPlayer(SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPortDamageAgainstPlayer(SmrPort $port, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -253,7 +253,7 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -272,8 +272,8 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &shootForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { - $return = array('Weapon' => &$this, 'TargetForces' => &$forces, 'Hit' => true); + public function &shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { + $return = array('Weapon' => $this, 'TargetForces' => $forces, 'Hit' => true); $this->doPlayerDamageToForce($return,$weaponPlayer, $forces); if($return['WeaponDamage']['Kamikaze'] > 0) { $weaponPlayer->getShip()->decreaseCDs($return['WeaponDamage']['Kamikaze']); @@ -281,33 +281,33 @@ class SmrCombatDrones extends AbstractSmrCombatWeapon { return $return; } - public function &shootPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { - $return = array('Weapon' => &$this, 'TargetPort' => &$port, 'Hit' => true); + public function &shootPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { + $return = array('Weapon' => $this, 'TargetPort' => $port, 'Hit' => true); return $this->doPlayerDamageToPort($return,$weaponPlayer, $port); } - public function &shootPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet, $delayed) { - $return = array('Weapon' => &$this, 'TargetPlanet' => &$planet, 'Hit' => true); + public function &shootPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet, $delayed) { + $return = array('Weapon' => $this, 'TargetPlanet' => $planet, 'Hit' => true); return $this->doPlayerDamageToPlanet($return,$weaponPlayer, $planet, $delayed); } - public function &shootPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => true); + public function &shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true); return $this->doPlayerDamageToPlayer($return, $weaponPlayer, $targetPlayer); } - public function &shootPlayerAsForce(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => true); + public function &shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true); return $this->doForceDamageToPlayer($return, $forces, $targetPlayer); } - public function &shootPlayerAsPort(SmrPort &$forces, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => true); + public function &shootPlayerAsPort(SmrPort $forces, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true); return $this->doPortDamageToPlayer($return, $forces, $targetPlayer); } - public function &shootPlayerAsPlanet(SmrPlanet &$forces, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => true); + public function &shootPlayerAsPlanet(SmrPlanet $forces, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true); return $this->doPlanetDamageToPlayer($return, $forces, $targetPlayer); } } diff --git a/lib/Default/SmrForce.class.inc b/lib/Default/SmrForce.class.inc index d6c2d30a6..6c5bba0a1 100644 --- a/lib/Default/SmrForce.class.inc +++ b/lib/Default/SmrForce.class.inc @@ -78,7 +78,7 @@ class SmrForce { return self::$CACHE_FORCES[$gameID][$sectorID][$ownerID]; } - public static function tidyUpForces(SmrGalaxy &$galaxyToTidy) { + public static function tidyUpForces(SmrGalaxy $galaxyToTidy) { if(!isset(self::$TIDIED_UP[$galaxyToTidy->getGameID()][$galaxyToTidy->getGalaxyID()])) { self::$TIDIED_UP[$galaxyToTidy->getGameID()][$galaxyToTidy->getGalaxyID()] = true; $db = new SmrMySqlDatabase(); @@ -308,7 +308,7 @@ class SmrForce { return $this->getGalaxy()->getMaxForceTime(); } - public function getBumpTurnCost(AbstractSmrShip &$ship) { + public function getBumpTurnCost(AbstractSmrShip $ship) { $mines = $this->getMines(); if($mines <= 1) { return 0; @@ -328,7 +328,7 @@ class SmrForce { return $turns; } - public function getAttackTurnCost(AbstractSmrShip &$ship) { + public function getAttackTurnCost(AbstractSmrShip $ship) { if($ship->isFederal() || $ship->hasDCS()) { return 2; } @@ -351,7 +351,7 @@ class SmrForce { return $this->sectorID; } - public function ping($pingMessage, AbstractSmrPlayer &$playerPinging, $skipCheck=false) { + public function ping($pingMessage, AbstractSmrPlayer $playerPinging, $skipCheck=false) { if(!$this->hasSDs() && !$skipCheck) { return; } @@ -463,11 +463,11 @@ class SmrForce { return SmrSession::getNewHREF($container); } - public function &shootPlayer(AbstractSmrPlayer &$targetPlayer,$minesAreAttacker) { + public function &shootPlayer(AbstractSmrPlayer $targetPlayer,$minesAreAttacker) { return $this->shootPlayers(array($targetPlayer),$minesAreAttacker); } - public function &shootPlayers(array &$targetPlayers,$minesAreAttacker) { + public function &shootPlayers(array $targetPlayers,$minesAreAttacker) { $results = array('TotalDamage' => 0); if(!$this->exists()) { $results['DeadBeforeShot'] = true; @@ -555,7 +555,7 @@ class SmrForce { return $actualDamage*SD_ARMOUR; } - public function &killForcesByPlayer(AbstractSmrPlayer &$killer) { + public function &killForcesByPlayer(AbstractSmrPlayer $killer) { $return = array(); return $return; } diff --git a/lib/Default/SmrLocation.class.inc b/lib/Default/SmrLocation.class.inc index 9db155934..75e33ed19 100644 --- a/lib/Default/SmrLocation.class.inc +++ b/lib/Default/SmrLocation.class.inc @@ -355,11 +355,11 @@ class SmrLocation { return SmrSession::getNewHREF($container); } - public function equals(SmrLocation &$otherLocation) { + public function equals(SmrLocation $otherLocation) { return $this->getTypeID()==$otherLocation->getTypeID(); } - public function hasX(/*Object*/ &$x, AbstractSmrPlayer &$player=null) { + public function hasX(/*Object*/ $x, AbstractSmrPlayer $player=null) { if ($x instanceof SmrWeapon) { return $this->isWeaponSold($x->getWeaponTypeID()); } diff --git a/lib/Default/SmrMines.class.inc b/lib/Default/SmrMines.class.inc index dea574237..2d31aa289 100644 --- a/lib/Default/SmrMines.class.inc +++ b/lib/Default/SmrMines.class.inc @@ -28,11 +28,11 @@ class SmrMines extends AbstractSmrCombatWeapon { return $modifiedAccuracy; } - public function getModifiedForceAccuracyAgainstPlayer(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer,$minesAreAttacker) { + public function getModifiedForceAccuracyAgainstPlayer(SmrForce $forces,AbstractSmrPlayer $targetPlayer,$minesAreAttacker) { return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces,$targetPlayer,mt_rand(1,7) * mt_rand(1,7),$minesAreAttacker); } - protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer, $random,$minesAreAttacker) { + protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce $forces,AbstractSmrPlayer $targetPlayer, $random,$minesAreAttacker) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy -= $targetPlayer->getLevelID() + $random; if($minesAreAttacker) { @@ -50,7 +50,7 @@ class SmrMines extends AbstractSmrCombatWeapon { return max(0,min(100,$modifiedAccuracy)); } - public function getMaxModifiedForceAccuracyAgainstPlayer(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer,$minesAreAttacker) { + public function getMaxModifiedForceAccuracyAgainstPlayer(SmrForce $forces,AbstractSmrPlayer $targetPlayer,$minesAreAttacker) { return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces,$targetPlayer,49,$minesAreAttacker); } @@ -59,37 +59,37 @@ class SmrMines extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedPortDamageAgainstPlayer(SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPortDamageAgainstPlayer(SmrPort $port, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedForceDamageAgainstPlayer(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer,$minesAreAttacker=false) { + public function &getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer,$minesAreAttacker=false) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -113,24 +113,24 @@ class SmrMines extends AbstractSmrCombatWeapon { return $damage; } - public function &shootForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { - $return = array('Weapon' => &$this, 'TargetForces' => &$forces); + public function &shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { + $return = array('Weapon' => $this, 'TargetForces' => $forces); return $return; } - public function &shootPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => false); + public function &shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => false); return $return; } - public function &shootPlayerAsForce(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer,$minesAreAttacker=false) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => true); + public function &shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer,$minesAreAttacker=false) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true); $this->doForceDamageToPlayer($return, $forces, $targetPlayer, $minesAreAttacker); $forces->takeMines($return['ActualDamage']['Launched']); return $return; } - protected function &doForceDamageToPlayer(array &$return, SmrForce &$forces, AbstractSmrPlayer &$targetPlayer,$minesAreAttacker=false) { + protected function &doForceDamageToPlayer(array &$return, SmrForce $forces, AbstractSmrPlayer $targetPlayer,$minesAreAttacker=false) { $return['WeaponDamage'] =& $this->getModifiedForceDamageAgainstPlayer($forces,$targetPlayer,$minesAreAttacker); $return['ActualDamage'] =& $targetPlayer->getShip()->doMinesDamage($return['WeaponDamage']); $return['ActualDamage']['Launched'] = ceil($return['WeaponDamage']['Launched'] * $return['ActualDamage']['TotalDamage'] / $return['WeaponDamage']['MaxDamage']); diff --git a/lib/Default/SmrPlanet.class.inc b/lib/Default/SmrPlanet.class.inc index 3b7110c24..81f28586c 100644 --- a/lib/Default/SmrPlanet.class.inc +++ b/lib/Default/SmrPlanet.class.inc @@ -878,7 +878,7 @@ class SmrPlanet { return count($this->getCurrentlyBuilding()) > 0; } - function canBuild(AbstractSmrPlayer &$constructor, $constructionID) { + function canBuild(AbstractSmrPlayer $constructor, $constructionID) { if($this->hasCurrentlyBuilding()) { return 'There is already a building in progress!'; } @@ -919,7 +919,7 @@ class SmrPlanet { return $constructionTime; } - function startBuilding(AbstractSmrPlayer &$constructor, $constructionID) { + function startBuilding(AbstractSmrPlayer $constructor, $constructionID) { if(($message = $this->canBuild($constructor, $constructionID)) !== true) { throw new Exception('Unable to start building: '.$message); } @@ -1063,17 +1063,17 @@ class SmrPlanet { return count($this->getPlayers()) > 0; } - public function &getOtherTraders(AbstractSmrPlayer &$player) { + public function &getOtherTraders(AbstractSmrPlayer $player) { $players = SmrPlayer::getPlanetPlayers($this->getGameID(),$this->getSectorID()); //Do not use & because we unset something and only want that in what we return unset($players[$player->getAccountID()]); return $players; } - public function hasOtherTraders(AbstractSmrPlayer &$player) { + public function hasOtherTraders(AbstractSmrPlayer $player) { return count($this->getOtherTraders($player)) > 0; } - public function hasEnemyTraders(AbstractSmrPlayer &$player) { + public function hasEnemyTraders(AbstractSmrPlayer $player) { if(!$this->hasOtherTraders($player)) return false; $otherPlayers = $this->getOtherTraders($player); @@ -1084,7 +1084,7 @@ class SmrPlanet { return false; } - public function hasFriendlyTraders(AbstractSmrPlayer &$player) { + public function hasFriendlyTraders(AbstractSmrPlayer $player) { if(!$this->hasOtherTraders($player)) return false; $otherPlayers = $this->getOtherTraders($player); @@ -1107,12 +1107,12 @@ class SmrPlanet { return count($this->getWeapons())>0; } - public function &shootPlayer(AbstractSmrPlayer &$targetPlayer) { + public function &shootPlayer(AbstractSmrPlayer $targetPlayer) { return $this->shootPlayers(array($targetPlayer)); } - public function &shootPlayers(array &$targetPlayers) { - $results = array('Planet' => &$this, 'TotalDamage' => 0, $results['TotalDamagePerTargetPlayer'] = array()); + public function &shootPlayers(array $targetPlayers) { + $results = array('Planet' => $this, 'TotalDamage' => 0, $results['TotalDamagePerTargetPlayer'] = array()); foreach($targetPlayers as $targetPlayer) { $results['TotalDamagePerTargetPlayer'][$targetPlayer->getAccountID()] = 0; } @@ -1271,7 +1271,7 @@ class SmrPlanet { $this->db->query('DELETE FROM player_attacks_planet WHERE ' . $this->SQL); } - public function &killPlanetByPlayer(AbstractSmrPlayer &$killer) { + public function &killPlanetByPlayer(AbstractSmrPlayer $killer) { $return = array(); $this->creditCurrentAttackersForKill(); diff --git a/lib/Default/SmrPlayer.class.inc b/lib/Default/SmrPlayer.class.inc index 8b9d21cf5..a0d39e151 100644 --- a/lib/Default/SmrPlayer.class.inc +++ b/lib/Default/SmrPlayer.class.inc @@ -446,14 +446,14 @@ class SmrPlayer extends AbstractSmrPlayer { $alliance = $this->getAlliance(); if($kickedBy != null) { $kickedBy->sendMessage($this->getAccountID(), MSG_PLAYER, 'You were kicked out of the alliance!', false); - $this->actionTaken('PlayerKicked', array('Alliance' => &$alliance, 'Player' => &$kickedBy)); - $kickedBy->actionTaken('KickPlayer', array('Alliance' => &$alliance, 'Player' => &$this)); + $this->actionTaken('PlayerKicked', array('Alliance' => $alliance, 'Player' => $kickedBy)); + $kickedBy->actionTaken('KickPlayer', array('Alliance' => $alliance, 'Player' => $this)); } else if($this->isAllianceLeader()) { - $this->actionTaken('DisbandAlliance', array('Alliance' => &$alliance)); + $this->actionTaken('DisbandAlliance', array('Alliance' => $alliance)); } else { - $this->actionTaken('LeaveAlliance', array('Alliance' => &$alliance)); + $this->actionTaken('LeaveAlliance', array('Alliance' => $alliance)); if ($alliance->getLeaderID() != 0 && $alliance->getLeaderID() != ACCOUNT_ID_NHL) { $this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I left your alliance!', false); } @@ -474,7 +474,7 @@ class SmrPlayer extends AbstractSmrPlayer { if (!$this->isAllianceLeader()) $this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I joined your alliance!', false); $this->db->query('INSERT INTO player_has_alliance_role (game_id, account_id, role_id, alliance_id) VALUES (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getAccountID()) . ', 2,' . $this->db->escapeNumber($alliance->getAllianceID()) . ')'); - $this->actionTaken('JoinAlliance', array('Alliance' => &$alliance)); + $this->actionTaken('JoinAlliance', array('Alliance' => $alliance)); } function getAllianceJoinable() { @@ -1139,7 +1139,7 @@ class SmrPlayer extends AbstractSmrPlayer { return 1; } - public function &killPlayerByPlayer(AbstractSmrPlayer &$killer) { + public function &killPlayerByPlayer(AbstractSmrPlayer $killer) { $return = array(); $msg = $this->getBBLink(); @@ -1303,7 +1303,7 @@ class SmrPlayer extends AbstractSmrPlayer { return $return; } - public function &killPlayerByForces(SmrForce &$forces) { + public function &killPlayerByForces(SmrForce $forces) { $return = array(); $owner = $forces->getOwner(); // send a message to the person who died @@ -1350,7 +1350,7 @@ class SmrPlayer extends AbstractSmrPlayer { return $return; } - public function &killPlayerByPort(SmrPort &$port) { + public function &killPlayerByPort(SmrPort $port) { $return = array(); // send a message to the person who died self::sendMessageFromFedClerk($this->getGameID(), $this->getAccountID(), 'You were DESTROYED by the defenses of '.$port->getDisplayName()); @@ -1382,7 +1382,7 @@ class SmrPlayer extends AbstractSmrPlayer { return $return; } - public function &killPlayerByPlanet(SmrPlanet &$planet) { + public function &killPlayerByPlanet(SmrPlanet $planet) { $return = array(); // send a message to the person who died $planetOwner = $planet->getOwner(); @@ -1596,7 +1596,7 @@ class SmrPlayer extends AbstractSmrPlayer { public function isPresident() { $president = Council::getPresident($this->getGameID(),$this->getRaceID()); - return is_object($president)&&$this->equals($president); + return is_object($president) && $this->equals($president); } public function isOnCouncil() { @@ -1872,7 +1872,7 @@ class SmrPlayer extends AbstractSmrPlayer { return $this->getPlottedCourse()!==false; } - public function isPartOfCourse(&$sectorOrSectorID) { + public function isPartOfCourse($sectorOrSectorID) { if(!$this->hasPlottedCourse()) return false; if($sectorOrSectorID instanceof SmrSector ) diff --git a/lib/Default/SmrPort.class.inc b/lib/Default/SmrPort.class.inc index af148f7c5..c83a1c3a9 100644 --- a/lib/Default/SmrPort.class.inc +++ b/lib/Default/SmrPort.class.inc @@ -221,7 +221,7 @@ class SmrPort { } } - private function getVisibleGoods($transaction, AbstractSmrPlayer &$player=null) { + private function getVisibleGoods($transaction, AbstractSmrPlayer $player=null) { $goodIDs = $this->goodIDs[$transaction]; if ($player == null) { return $goodIDs; @@ -237,14 +237,14 @@ class SmrPort { /** * Get IDs of goods that can be sold by $player to the port */ - public function getVisibleGoodsSold(AbstractSmrPlayer &$player=null) { + public function getVisibleGoodsSold(AbstractSmrPlayer $player=null) { return $this->getVisibleGoods('Sell', $player); } /** * Get IDs of goods that can be bought by $player from the port */ - public function getVisibleGoodsBought(AbstractSmrPlayer &$player=null) { + public function getVisibleGoodsBought(AbstractSmrPlayer $player=null) { return $this->getVisibleGoods('Buy', $player); } @@ -332,7 +332,7 @@ class SmrPort { return $this->goodAmounts[$goodID]; } - public function decreaseGood(array &$good,$amount,$doRefresh) { + public function decreaseGood(array $good,$amount,$doRefresh) { $this->setGoodAmount($good['ID'],$this->getGoodAmount($good['ID']) - $amount); if($doRefresh===true) { //get id of goods to replenish @@ -363,7 +363,7 @@ class SmrPort { } } - protected function tradeGoods(array &$good, $goodsTraded, $exp) { + protected function tradeGoods(array $good, $goodsTraded, $exp) { $goodsTradedMoney = $goodsTraded * self::GOODS_TRADED_MONEY_MULTIPLIER; $this->increaseUpgrade($goodsTradedMoney); $this->increaseCredits($goodsTradedMoney); @@ -371,13 +371,13 @@ class SmrPort { $this->decreaseGood($good,$goodsTraded,true); } - public function buyGoods(array &$good, $goodsTraded, $idealPrice, $bargainPrice, $exp) { + public function buyGoods(array $good, $goodsTraded, $idealPrice, $bargainPrice, $exp) { $this->tradeGoods($good, $goodsTraded, $exp); $this->increaseUpgrade(min(max($idealPrice, $goodsTraded * 1000), $bargainPrice)); $this->increaseCredits($bargainPrice); } - public function sellGoods(array &$good, $goodsTraded, $idealPrice, $bargainPrice, $exp) { + public function sellGoods(array $good, $goodsTraded, $idealPrice, $bargainPrice, $exp) { $this->tradeGoods($good, $goodsTraded, $exp); } @@ -853,7 +853,7 @@ class SmrPort { } public function isDestroyed() { - return ($this->getArmour()<1&&$this->isUnderAttack()); + return ($this->getArmour()<1 && $this->isUnderAttack()); } public function exists() { @@ -1117,12 +1117,12 @@ class SmrPort { } - public function &shootPlayer(AbstractSmrPlayer &$targetPlayer) { + public function &shootPlayer(AbstractSmrPlayer $targetPlayer) { return $this->shootPlayers(array($targetPlayer)); } - public function &shootPlayers(array &$targetPlayers) { - $results = array('Port' => &$this, 'TotalDamage' => 0, $results['TotalDamagePerTargetPlayer'] = array()); + public function &shootPlayers(array $targetPlayers) { + $results = array('Port' => $this, 'TotalDamage' => 0, $results['TotalDamagePerTargetPlayer'] = array()); foreach($targetPlayers as $targetPlayer) { $results['TotalDamagePerTargetPlayer'][$targetPlayer->getAccountID()] = 0; $results['TotalShotsPerTargetPlayer'][$targetPlayer->getAccountID()] = 0; @@ -1226,7 +1226,7 @@ class SmrPort { } } - protected function payout(AbstractSmrPlayer &$killer, $credits, $payoutType) { + protected function payout(AbstractSmrPlayer $killer, $credits, $payoutType) { if($this->getCredits() == 0) { return false; } @@ -1240,7 +1240,7 @@ class SmrPort { return true; } - public function razePort(AbstractSmrPlayer &$killer) { + public function razePort(AbstractSmrPlayer $killer) { $credits = floor($this->getCredits() * self::RAZE_MONEY_PERCENT / 100); if($this->payout($killer, $credits, 'Razed')) { $this->doDowngrade(); @@ -1248,13 +1248,13 @@ class SmrPort { return $credits; } - public function lootPort(AbstractSmrPlayer &$killer) { + public function lootPort(AbstractSmrPlayer $killer) { $credits = $this->getCredits(); $this->payout($killer, $credits, 'Looted'); return $credits; } - public function &killPortByPlayer(AbstractSmrPlayer &$killer) { + public function &killPortByPlayer(AbstractSmrPlayer $killer) { $return = array(); // Port is destroyed, so empty the port of all trade goods @@ -1283,7 +1283,7 @@ class SmrPort { return $return; } - public function hasX(/*Object*/ &$x) { + public function hasX(/*Object*/ $x) { if (is_array($x) && $x['Type']=='Good') { // instanceof Good) - No Good class yet, so array is the best we can do if(isset($x['ID'])) return $this->hasGood($x['ID'],isset($x['TransactionType'])?$x['TransactionType']:false); diff --git a/lib/Default/SmrScoutDrones.class.inc b/lib/Default/SmrScoutDrones.class.inc index 9702bc66e..9813b9a4f 100644 --- a/lib/Default/SmrScoutDrones.class.inc +++ b/lib/Default/SmrScoutDrones.class.inc @@ -26,18 +26,18 @@ class SmrScoutDrones extends AbstractSmrCombatWeapon { return $modifiedAccuracy; } - public function getModifiedForceAccuracyAgainstPlayer(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer) { + public function getModifiedForceAccuracyAgainstPlayer(SmrForce $forces,AbstractSmrPlayer $targetPlayer) { return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces,$targetPlayer,mt_rand(1,7) * mt_rand(1,7)); } - protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer, $random) { + protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce $forces,AbstractSmrPlayer $targetPlayer, $random) { $modifiedAccuracy = $this->getModifiedAccuracy(); $modifiedAccuracy -= $targetPlayer->getLevelID() + $random; return max(0,min(100,$modifiedAccuracy)); } - public function getMaxModifiedForceAccuracyAgainstPlayer(SmrForce &$forces,AbstractSmrPlayer &$targetPlayer) { + public function getMaxModifiedForceAccuracyAgainstPlayer(SmrForce $forces,AbstractSmrPlayer $targetPlayer) { return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces,$targetPlayer,49); } @@ -46,37 +46,37 @@ class SmrScoutDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedPortDamageAgainstPlayer(SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPortDamageAgainstPlayer(SmrPort $port, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedForceDamageAgainstPlayer(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -89,22 +89,22 @@ class SmrScoutDrones extends AbstractSmrCombatWeapon { return $damage; } - public function &shootForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { - $return = array('Weapon' => &$this, 'TargetForces' => &$forces); + public function &shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { + $return = array('Weapon' => $this, 'TargetForces' => $forces); return $return; } - public function &shootPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => false); + public function &shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => false); return $return; } - public function &shootPlayerAsForce(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => true); + public function &shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true); $this->doForceDamageToPlayer($return, $forces, $targetPlayer); $forces->takeSDs($return['WeaponDamage']['Launched']); return $return; } } -?> \ No newline at end of file +?> diff --git a/lib/Default/SmrSector.class.inc b/lib/Default/SmrSector.class.inc index 8474d2814..58d61f740 100644 --- a/lib/Default/SmrSector.class.inc +++ b/lib/Default/SmrSector.class.inc @@ -171,7 +171,7 @@ class SmrSector { } } - function markVisited(AbstractSmrPlayer &$player) { + function markVisited(AbstractSmrPlayer $player) { if($this->hasPort()) $this->getPort()->addCachePort($player->getAccountID()); @@ -264,7 +264,7 @@ class SmrSector { return false; } - function enteringSector(AbstractSmrPlayer &$player, $movementType) { + function enteringSector(AbstractSmrPlayer $player, $movementType) { // send scout messages to user $message = 'Your forces have spotted ' . $player->getBBLink() . ' '; switch($movementType) { @@ -286,7 +286,7 @@ class SmrSector { } } - function leavingSector(AbstractSmrPlayer &$player, $movementType) { + function leavingSector(AbstractSmrPlayer $player, $movementType) { // send scout messages to user $message = 'Your forces have spotted ' . $player->getBBLink() . ' '; switch($movementType) { @@ -311,7 +311,7 @@ class SmrSector { AND refresher = ' . $this->db->escapeNumber($player->getAccountID())); } - function diedHere(AbstractSmrPlayer &$player) { + function diedHere(AbstractSmrPlayer $player) { // iterate over all scout drones in sector $forces = $this->getForces(); foreach($forces as $force) { @@ -450,7 +450,7 @@ class SmrSector { /** * Cannot be used for Warps */ - public function setLinkSector($dir,SmrSector &$linkSector) { + public function setLinkSector($dir,SmrSector $linkSector) { if($this->getLink($dir)==$linkSector->getSectorID()||$linkSector->equals($this)) return; $this->setLink($dir,$linkSector->getSectorID()); @@ -552,7 +552,7 @@ class SmrSector { return $this->getWarp()!=0; } - public function setWarp(SmrSector &$warp,$justThisObjectData=false) { + public function setWarp(SmrSector $warp,$justThisObjectData=false) { if($justThisObjectData===false) { if($this->hasWarp()) { //Update both possible combinations for the warp @@ -610,11 +610,11 @@ class SmrSector { SmrPort::removePort($this->getGameID(),$this->getSectorID()); } - public function hasCachedPort(AbstractSmrPlayer &$player=null) { + public function hasCachedPort(AbstractSmrPlayer $player=null) { return $this->getCachedPort($player)!==false; } - public function &getCachedPort(AbstractSmrPlayer &$player=null) { + public function &getCachedPort(AbstractSmrPlayer $player=null) { if($player == null) { $return = false; return $return; @@ -649,7 +649,7 @@ class SmrSector { return SmrLocation::getSectorLocations($this->getGameID(),$this->getSectorID()); } - public function addLocation(SmrLocation &$location) { + public function addLocation(SmrLocation $location) { $this->db->query('INSERT INTO location (game_id,sector_id,location_type_id) values(' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber($this->getSectorID()) . ',' . $this->db->escapeNumber($location->getTypeID()) . ')'); SmrLocation::getSectorLocations($this->getGameID(),$this->getSectorID(),true); @@ -680,7 +680,7 @@ class SmrSector { return count($this->getForces()) > 0; } - public function hasEnemyForces(AbstractSmrPlayer &$player=null) { + public function hasEnemyForces(AbstractSmrPlayer $player=null) { if($player == null || !$this->hasForces()) return false; $forces = $this->getForces(); @@ -691,7 +691,7 @@ class SmrSector { return false; } - public function &getEnemyForces(AbstractSmrPlayer &$player) { + public function &getEnemyForces(AbstractSmrPlayer $player) { $enemyForces = array(); if(!$this->hasForces()) return $enemyForces; @@ -715,7 +715,7 @@ class SmrSector { return false; } - public function hasFriendlyForces(AbstractSmrPlayer &$player=null) { + public function hasFriendlyForces(AbstractSmrPlayer $player=null) { if($player == null || !$this->hasForces()) return false; $forces = $this->getForces(); @@ -726,7 +726,7 @@ class SmrSector { return false; } - public function &getFriendlyForces(AbstractSmrPlayer &$player) { + public function &getFriendlyForces(AbstractSmrPlayer $player) { $friendlyForces = array(); if(!$this->hasForces()) return $friendlyForces; @@ -751,17 +751,17 @@ class SmrSector { return count($this->getPlayers()) > 0; } - public function &getOtherTraders(AbstractSmrPlayer &$player) { + public function &getOtherTraders(AbstractSmrPlayer $player) { $players = SmrPlayer::getSectorPlayers($this->getGameID(),$this->getSectorID()); //Do not use & because we unset something and only want that in what we return unset($players[$player->getAccountID()]); return $players; } - public function hasOtherTraders(AbstractSmrPlayer &$player) { + public function hasOtherTraders(AbstractSmrPlayer $player) { return count($this->getOtherTraders($player)) > 0; } - public function hasEnemyTraders(AbstractSmrPlayer &$player=null) { + public function hasEnemyTraders(AbstractSmrPlayer $player=null) { if($player == null || !$this->hasOtherTraders($player)) return false; $otherPlayers = $this->getOtherTraders($player); @@ -775,7 +775,7 @@ class SmrSector { return false; } - public function hasFriendlyTraders(AbstractSmrPlayer &$player=null) { + public function hasFriendlyTraders(AbstractSmrPlayer $player=null) { if($player == null || !$this->hasOtherTraders($player)) return false; $otherPlayers = $this->getOtherTraders($player); @@ -786,7 +786,7 @@ class SmrSector { return false; } - public function hasProtectedTraders(AbstractSmrPlayer &$player=null) { + public function hasProtectedTraders(AbstractSmrPlayer $player=null) { if($player == null || !$this->hasOtherTraders($player)) return false; $otherPlayers = $this->getOtherTraders($player); @@ -799,7 +799,7 @@ class SmrSector { return false; } - public function &getFightingTradersAgainstForces(AbstractSmrPlayer &$attackingPlayer, SmrForce &$defendingForces) { + public function &getFightingTradersAgainstForces(AbstractSmrPlayer $attackingPlayer, SmrForce $defendingForces) { $forceOwner = $defendingForces->getOwner(); if($attackingPlayer->forceNAPAlliance($forceOwner)) { throw new Exception('The trader has a force NAP.'); @@ -817,7 +817,7 @@ class SmrSector { return self::limitFightingTraders($fightingPlayers, $attackingPlayer, MAXIMUM_FORCES_FLEET_SIZE); } - public function &getFightingTradersAgainstPort(AbstractSmrPlayer &$attackingPlayer, SmrPort &$defendingPort) { + public function &getFightingTradersAgainstPort(AbstractSmrPlayer $attackingPlayer, SmrPort $defendingPort) { $fightingPlayers = array(); $alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(),$this->getSectorID(), array($attackingPlayer->getAllianceID())); if(count($alliancePlayers) > 0) @@ -830,7 +830,7 @@ class SmrSector { return self::limitFightingTraders($fightingPlayers, $attackingPlayer, MAXIMUM_PORT_FLEET_SIZE); } - public function &getFightingTradersAgainstPlanet(AbstractSmrPlayer &$attackingPlayer, SmrPlanet &$defendingPlanet) { + public function &getFightingTradersAgainstPlanet(AbstractSmrPlayer $attackingPlayer, SmrPlanet $defendingPlanet) { $fightingPlayers = array(); $alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(),$this->getSectorID(), array($attackingPlayer->getAllianceID())); if(count($alliancePlayers) > 0) { @@ -845,7 +845,7 @@ class SmrSector { return self::limitFightingTraders($fightingPlayers, $attackingPlayer, min($defendingPlanet->getMaxAttackers(),MAXIMUM_PLANET_FLEET_SIZE)); } - public function &getFightingTraders(AbstractSmrPlayer &$attackingPlayer, AbstractSmrPlayer &$defendingPlayer, $checkForCloak=false) { + public function &getFightingTraders(AbstractSmrPlayer $attackingPlayer, AbstractSmrPlayer $defendingPlayer, $checkForCloak=false) { if($attackingPlayer->traderNAPAlliance($defendingPlayer)) throw new Exception('These traders are NAPed.'); $fightingPlayers = array('Attackers' => array(), 'Defenders' => array()); @@ -874,7 +874,7 @@ class SmrSector { return $fightingPlayers; } - public static function &limitFightingTraders(array &$fightingPlayers, AbstractSmrPlayer &$keepPlayer, $maximumFleetSize) { + public static function &limitFightingTraders(array &$fightingPlayers, AbstractSmrPlayer $keepPlayer, $maximumFleetSize) { // Cap fleets to the required size $fleet_size = count($fightingPlayers); if($fleet_size > $maximumFleetSize) { @@ -889,7 +889,7 @@ class SmrSector { return $fightingPlayers; } - public function &getPotentialFightingTraders(AbstractSmrPlayer &$attackingPlayer) { + public function &getPotentialFightingTraders(AbstractSmrPlayer $attackingPlayer) { $fightingPlayers = array(); $alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(),$this->getSectorID(), array($attackingPlayer->getAllianceID())); if(count($alliancePlayers) > 0) @@ -921,15 +921,15 @@ class SmrSector { $this->setBattles($this->battles+$amount); } - function equals(SmrSector &$otherSector) { - return $otherSector->getSectorID()==$this->getSectorID()&&$otherSector->getGameID()==$this->getGameID(); + function equals(SmrSector $otherSector) { + return $otherSector->getSectorID()==$this->getSectorID() && $otherSector->getGameID()==$this->getGameID(); } - function isLinkedSector(SmrSector &$otherSector) { + function isLinkedSector(SmrSector $otherSector) { return $otherSector->getGameID()==$this->getGameID() && $this->isLinked($otherSector->getSectorID()); } - public function isVisited(AbstractSmrPlayer &$player=null) { + public function isVisited(AbstractSmrPlayer $player=null) { if($player===null) return true; if(!isset($this->visited[$player->getAccountID()])) { @@ -955,7 +955,7 @@ class SmrSector { return Globals::getSectorScanHREF($this->getSectorID()); } - public function hasX(/*Object*/ &$x, AbstractSmrPlayer &$player=null) { + public function hasX(/*Object*/ $x, AbstractSmrPlayer $player=null) { if($x instanceof SmrSector) { return $this->equals($x); } diff --git a/lib/Default/SmrShip.class.inc b/lib/Default/SmrShip.class.inc index 34c780894..d3e0ab067 100644 --- a/lib/Default/SmrShip.class.inc +++ b/lib/Default/SmrShip.class.inc @@ -32,7 +32,7 @@ class SmrShip extends AbstractSmrShip { } } - public static function &getShip(AbstractSmrPlayer &$player,$forceUpdate = false) { + public static function &getShip(AbstractSmrPlayer $player,$forceUpdate = false) { if($forceUpdate || !isset(self::$CACHE_SHIPS[$player->getGameID()][$player->getAccountID()])) { $s = new SmrShip($player); self::$CACHE_SHIPS[$player->getGameID()][$player->getAccountID()] = $s; @@ -40,7 +40,7 @@ class SmrShip extends AbstractSmrShip { return self::$CACHE_SHIPS[$player->getGameID()][$player->getAccountID()]; } - protected function __construct(AbstractSmrPlayer &$player) { + protected function __construct(AbstractSmrPlayer $player) { parent::__construct($player); $this->db = new SmrMySqlDatabase(); diff --git a/lib/Default/SmrWeapon.class.inc b/lib/Default/SmrWeapon.class.inc index df4e827e3..8b2a362ef 100644 --- a/lib/Default/SmrWeapon.class.inc +++ b/lib/Default/SmrWeapon.class.inc @@ -93,19 +93,19 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $this->buyerRestriction; } - protected function &getWeightedRandomForPlayer(AbstractSmrPlayer &$player) { + protected function &getWeightedRandomForPlayer(AbstractSmrPlayer $player) { return WeightedRandom::getWeightedRandomForPlayer($player,'Weapon',$this->getWeaponTypeID()); } - protected function checkMiss(AbstractSmrPlayer &$player, $percent) { + protected function checkMiss(AbstractSmrPlayer $player, $percent) { return $this->getWeightedRandomForPlayer($player)->percentFailed($percent); } - public static function getPlayerLevelAccuracyMod(AbstractSmrPlayer &$player) { + public static function getPlayerLevelAccuracyMod(AbstractSmrPlayer $player) { return ($player->getLevelID()*$player->getLevelID()/60+$player->getLevelID()/2+2) / 100; } - public function getModifiedAccuracy(AbstractSmrPlayer &$weaponPlayer) { + public function getModifiedAccuracy(AbstractSmrPlayer $weaponPlayer) { $modifiedAccuracy = $this->getBaseAccuracy(); $modifiedAccuracy += $this->getBaseAccuracy() * ($weaponPlayer->getStat('Accuracy') * ACCURACY_STAT_FACTOR)/100; $modifiedAccuracy += $this->getBaseAccuracy() * self::getPlayerLevelAccuracyMod($weaponPlayer); @@ -114,24 +114,24 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $modifiedAccuracy; } - public function getModifiedAccuracyAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function getModifiedAccuracyAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { $modifiedAccuracy = $this->getModifiedAccuracy($weaponPlayer); return $modifiedAccuracy; } - public function getModifiedAccuracyAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function getModifiedAccuracyAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { $modifiedAccuracy = $this->getModifiedAccuracy($weaponPlayer); $modifiedAccuracy -= $this->getBaseAccuracy() * $port->getLevel()/50; return $modifiedAccuracy; } - public function getModifiedAccuracyAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function getModifiedAccuracyAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { $modifiedAccuracy = $this->getModifiedAccuracy($weaponPlayer); $modifiedAccuracy -= $this->getBaseAccuracy() * $planet->getLevel()/350; return $modifiedAccuracy; } - public function getModifiedAccuracyAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function getModifiedAccuracyAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { $modifiedAccuracy = $this->getModifiedAccuracy($weaponPlayer); $modifiedAccuracy -= $this->getBaseAccuracy() * self::getPlayerLevelAccuracyMod($targetPlayer) / 2; if ($targetPlayer->isGadgetEquipped('Increased Maneuverability')) @@ -146,30 +146,30 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $modifiedAccuracy; } - public function getModifiedPortAccuracy(SmrPort &$port) { + public function getModifiedPortAccuracy(SmrPort $port) { $modifiedAccuracy = $this->getBaseAccuracy(); return $modifiedAccuracy; } - public function getModifiedPortAccuracyAgainstPlayer(SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { + public function getModifiedPortAccuracyAgainstPlayer(SmrPort $port, AbstractSmrPlayer $targetPlayer) { $modifiedAccuracy = $this->getModifiedPortAccuracy($port); $modifiedAccuracy -= $this->getBaseAccuracy() * self::getPlayerLevelAccuracyMod($targetPlayer); return $modifiedAccuracy; } - public function getModifiedPlanetAccuracy(SmrPlanet &$planet) { + public function getModifiedPlanetAccuracy(SmrPlanet $planet) { $modifiedAccuracy = $this->getBaseAccuracy(); $modifiedAccuracy += $planet->getLevel() / 2; return $modifiedAccuracy; } - public function getModifiedPlanetAccuracyAgainstPlayer(SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { + public function getModifiedPlanetAccuracyAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { $modifiedAccuracy = $this->getModifiedPlanetAccuracy($planet); $modifiedAccuracy -= $this->getBaseAccuracy() * self::getPlayerLevelAccuracyMod($targetPlayer); return $modifiedAccuracy; } - public function &getModifiedDamage(AbstractSmrPlayer &$weaponPlayer) { + public function &getModifiedDamage(AbstractSmrPlayer $weaponPlayer) { $damage = $this->getDamage(); //do they have the weapon damage gadget? if($weaponPlayer->isGadgetEquipped('Increased Weapon Damage')) { @@ -184,7 +184,7 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { + public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { if(!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); $damage =& $this->getModifiedDamage($weaponPlayer); @@ -196,7 +196,7 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { + public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { if(!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); $damage =& $this->getModifiedDamage($weaponPlayer); @@ -208,7 +208,7 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet) { + public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { if(!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); $damage =& $this->getModifiedDamage($weaponPlayer); @@ -224,12 +224,12 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedForceDamageAgainstPlayer(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer) { $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; } - public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculating any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -243,7 +243,7 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedPortDamageAgainstPlayer(SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPortDamageAgainstPlayer(SmrPort $port, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculating any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -252,7 +252,7 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { + public function &getModifiedPlanetDamageAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { if(!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculating any damage mods. $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); return $return; @@ -261,8 +261,8 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $damage; } - public function &shootForces(AbstractSmrPlayer &$weaponPlayer, SmrForce &$forces) { - $return = array('Weapon' => &$this, 'TargetForces' => &$forces); + public function &shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { + $return = array('Weapon' => $this, 'TargetForces' => $forces); if($this->checkMiss($weaponPlayer, $this->getModifiedAccuracyAgainstForces($weaponPlayer,$forces))) { //Check if we miss $return['Hit'] = false; return $return; @@ -271,8 +271,8 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $this->doPlayerDamageToForce($return,$weaponPlayer, $forces); } - public function &shootPort(AbstractSmrPlayer &$weaponPlayer, SmrPort &$port) { - $return = array('Weapon' => &$this, 'TargetPort' => &$port); + public function &shootPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { + $return = array('Weapon' => $this, 'TargetPort' => $port); if($this->checkMiss($weaponPlayer, $this->getModifiedAccuracyAgainstPort($weaponPlayer,$port))) { //Check if we miss $return['Hit'] = false; return $return; @@ -281,8 +281,8 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $this->doPlayerDamageToPort($return,$weaponPlayer, $port); } - public function &shootPlanet(AbstractSmrPlayer &$weaponPlayer, SmrPlanet &$planet, $delayed) { - $return = array('Weapon' => &$this, 'TargetPlanet' => &$planet); + public function &shootPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet, $delayed) { + $return = array('Weapon' => $this, 'TargetPlanet' => $planet); if($this->checkMiss($weaponPlayer, $this->getModifiedAccuracyAgainstPlanet($weaponPlayer,$planet))) { //Check if we miss $return['Hit'] = false; return $return; @@ -291,8 +291,8 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $this->doPlayerDamageToPlanet($return,$weaponPlayer, $planet, $delayed); } - public function &shootPlayer(AbstractSmrPlayer &$weaponPlayer, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer); + public function &shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer); if($this->checkMiss($weaponPlayer, $this->getModifiedAccuracyAgainstPlayer($weaponPlayer,$targetPlayer))) { //Check if we miss $return['Hit'] = false; return $return; @@ -301,13 +301,13 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $this->doPlayerDamageToPlayer($return,$weaponPlayer, $targetPlayer); } - public function &shootPlayerAsForce(SmrForce &$forces, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer, 'Hit' => false); + public function &shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => false); return $return; } - public function &shootPlayerAsPort(SmrPort &$port, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer); + public function &shootPlayerAsPort(SmrPort $port, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer); if($this->checkMiss($targetPlayer, $this->getModifiedPortAccuracyAgainstPlayer($port,$targetPlayer))) { //Check if the port misses, weight based upon the player being shot at. $return['Hit'] = false; return $return; @@ -316,8 +316,8 @@ class SmrWeapon extends AbstractSmrCombatWeapon { return $this->doPortDamageToPlayer($return,$port, $targetPlayer); } - public function &shootPlayerAsPlanet(SmrPlanet &$planet, AbstractSmrPlayer &$targetPlayer) { - $return = array('Weapon' => &$this, 'TargetPlayer' => &$targetPlayer); + public function &shootPlayerAsPlanet(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer) { + $return = array('Weapon' => $this, 'TargetPlayer' => $targetPlayer); if($this->checkMiss($targetPlayer, $this->getModifiedPlanetAccuracyAgainstPlayer($planet,$targetPlayer))) { //Check if the planet misses, weight based upon the player being shot at. $return['Hit'] = false; return $return; diff --git a/lib/Default/Template.class.inc b/lib/Default/Template.class.inc index f19bdad9e..24bfb2911 100644 --- a/lib/Default/Template.class.inc +++ b/lib/Default/Template.class.inc @@ -281,7 +281,7 @@ class Template { } } - protected function &convertHtmlToAjaxXml(&$str,$returnXml) { + protected function &convertHtmlToAjaxXml($str,$returnXml) { if(empty($str)) { return ''; } diff --git a/lib/Default/WeightedRandom.class.inc b/lib/Default/WeightedRandom.class.inc index 386e36534..82aa10bfb 100644 --- a/lib/Default/WeightedRandom.class.inc +++ b/lib/Default/WeightedRandom.class.inc @@ -22,15 +22,15 @@ class WeightedRandom { return self::$CACHE_RANDOMS[$gameID][$accountID][$type][$typeID]; } - public static function &getWeightedRandomForPlayer(AbstractSmrPlayer &$player, $type, $typeID, $forceUpdate = false) { + public static function &getWeightedRandomForPlayer(AbstractSmrPlayer $player, $type, $typeID, $forceUpdate = false) { return self::getWeightedRandom($player->getGameID(), $player->getAccountID(), $type, $typeID, $forceUpdate); } public static function saveWeightedRandoms() { - foreach(self::$CACHE_RANDOMS as &$gameRandoms) { - foreach($gameRandoms as &$accountRandoms) { - foreach($accountRandoms as &$typeRandoms) { - foreach($typeRandoms as &$random) { + foreach(self::$CACHE_RANDOMS as $gameRandoms) { + foreach($gameRandoms as $accountRandoms) { + foreach($accountRandoms as $typeRandoms) { + foreach($typeRandoms as $random) { $random->update(); } } @@ -102,4 +102,4 @@ class WeightedRandom { } } } -?> \ No newline at end of file +?>