From 08c071958ee9a479de724c774d4025aea6411c80 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Thu, 22 Feb 2018 17:23:40 -0800 Subject: [PATCH] SmrForce: remove improper internal references See #317. --- lib/Default/SmrForce.class.inc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Default/SmrForce.class.inc b/lib/Default/SmrForce.class.inc index 51800367a..d9fb1643e 100644 --- a/lib/Default/SmrForce.class.inc +++ b/lib/Default/SmrForce.class.inc @@ -42,9 +42,9 @@ class SmrForce { } public static function saveForces() { - foreach(self::$CACHE_FORCES as &$gameForces) { - foreach($gameForces as &$gameSectorForces) { - foreach($gameSectorForces as &$forces) { + foreach(self::$CACHE_FORCES as $gameForces) { + foreach($gameForces as $gameSectorForces) { + foreach($gameSectorForces as $forces) { $forces->update(); } } @@ -59,21 +59,21 @@ class SmrForce { $forces = array(); while($db->nextRecord()) { $ownerID = $db->getInt('owner_id'); - $forces[$ownerID] =& self::getForce($db->getRow(), $sectorID, $ownerID, $forceUpdate); + $forces[$ownerID] = self::getForce($db->getRow(), $sectorID, $ownerID, $forceUpdate); } - self::$CACHE_SECTOR_FORCES[$gameID][$sectorID] =& $forces; + self::$CACHE_SECTOR_FORCES[$gameID][$sectorID] = $forces; } return self::$CACHE_SECTOR_FORCES[$gameID][$sectorID]; } - public static function &getForce(&$gameIDOrResultArray, $sectorID, $ownerID, $forceUpdate = false) { + public static function &getForce($gameIDOrResultArray, $sectorID, $ownerID, $forceUpdate = false) { $gameID = is_array($gameIDOrResultArray) ? $gameIDOrResultArray['game_id'] : $gameIDOrResultArray; if($forceUpdate || !isset(self::$CACHE_FORCES[$gameID][$sectorID][$ownerID])) { self::tidyUpForces(SmrGalaxy::getGalaxyContaining($gameID,$sectorID)); $p = new SmrForce($gameIDOrResultArray, $sectorID, $ownerID); - self::$CACHE_FORCES[$gameID][$sectorID][$ownerID] =& $p; + self::$CACHE_FORCES[$gameID][$sectorID][$ownerID] = $p; } return self::$CACHE_FORCES[$gameID][$sectorID][$ownerID]; } @@ -93,10 +93,10 @@ class SmrForce { } } - protected function __construct(&$gameIDOrResultArray, $sectorID, $ownerID) { + protected function __construct($gameIDOrResultArray, $sectorID, $ownerID) { $this->db = new SmrMySqlDatabase(); if (is_array($gameIDOrResultArray)) { - $result =& $gameIDOrResultArray; + $result = $gameIDOrResultArray; $this->gameID = $result['game_id']; } else { $this->db->query('SELECT * FROM sector_has_forces @@ -355,7 +355,7 @@ class SmrForce { if(!$this->hasSDs() && !$skipCheck) { return; } - $owner =& $this->getOwner(); + $owner = $this->getOwner(); if(!$playerPinging->sameAlliance($owner)) { $playerPinging->sendMessage($owner->getAccountID(), MSG_SCOUT, $pingMessage,false); }