From 99887a7feb06ff234f9e667cbaedf1c7d35604f2 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Tue, 31 Dec 2019 11:30:44 -0800 Subject: [PATCH] Remove function return-by-reference See #317. We have incrementally removed most usages of functions returning by reference; therefore, we can now remove the ability to return by reference for most functions. --- lib/Default/AbstractSmrAccount.class.php | 6 +-- lib/Default/AbstractSmrLocation.class.php | 14 +++---- lib/Default/AbstractSmrPlayer.class.php | 12 +++--- lib/Default/AbstractSmrPort.class.php | 20 +++++----- lib/Default/AbstractSmrShip.class.php | 14 +++---- lib/Default/ChessGame.class.php | 8 ++-- lib/Default/Council.class.php | 2 +- lib/Default/Distance.class.php | 2 +- lib/Default/DummyPlayer.class.php | 2 +- lib/Default/DummyShip.class.php | 4 +- lib/Default/Globals.class.php | 14 +++---- lib/Default/Plotter.class.php | 6 +-- lib/Default/Rankings.class.php | 4 +- lib/Default/SmrAlliance.class.php | 6 +-- lib/Default/SmrForce.class.php | 10 ++--- lib/Default/SmrGalaxy.class.php | 10 ++--- lib/Default/SmrGame.class.php | 4 +- lib/Default/SmrPlanet.class.php | 14 +++---- lib/Default/SmrPlayer.class.php | 16 ++++---- lib/Default/SmrSector.class.php | 48 +++++++++++------------ lib/Default/SmrShip.class.php | 2 +- lib/Default/SmrWeapon.class.php | 6 +-- lib/Default/Template.class.php | 2 +- lib/Default/WeightedRandom.class.php | 4 +- lib/Default/message.functions.inc | 2 +- lib/Hunter Wars/SmrLocation.class.php | 2 +- 26 files changed, 117 insertions(+), 117 deletions(-) diff --git a/lib/Default/AbstractSmrAccount.class.php b/lib/Default/AbstractSmrAccount.class.php index 3fe229e94..9903285c6 100644 --- a/lib/Default/AbstractSmrAccount.class.php +++ b/lib/Default/AbstractSmrAccount.class.php @@ -88,7 +88,7 @@ public static function getDefaultHotkeys() { return self::DEFAULT_HOTKEYS; } - public static function &getAccount($accountID,$forceUpdate = false) { + public static function getAccount($accountID,$forceUpdate = false) { if($forceUpdate || !isset(self::$CACHE_ACCOUNTS[$accountID])) { self::$CACHE_ACCOUNTS[$accountID] = new SmrAccount($accountID); } @@ -416,7 +416,7 @@ public function getScore() { return $this->score; } - public function &getIndividualScores(SmrPlayer $player = null) { + public function getIndividualScores(SmrPlayer $player = null) { $gameID=0; if($player!=null) $gameID = $player->getGameID(); @@ -462,7 +462,7 @@ public function hasReferrer() { return $this->referrerID>0; } - public function &getReferrer() { + public function getReferrer() { return SmrAccount::getAccount($this->getReferrerID()); } diff --git a/lib/Default/AbstractSmrLocation.class.php b/lib/Default/AbstractSmrLocation.class.php index 9e9f17ab9..5ad9017f9 100644 --- a/lib/Default/AbstractSmrLocation.class.php +++ b/lib/Default/AbstractSmrLocation.class.php @@ -28,7 +28,7 @@ public static function clearCache() { self::$CACHE_SECTOR_LOCATIONS = []; } - public static function &getAllLocations($forceUpdate = false) { + public static function getAllLocations($forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_ALL_LOCATIONS)) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM location_type ORDER BY location_type_id'); @@ -60,7 +60,7 @@ public static function getGalaxyLocations($gameID, $galaxyID, $forceUpdate = fal return $galaxyLocations; } - public static function &getSectorLocations($gameID, $sectorID, $forceUpdate = false) { + public static function getSectorLocations($gameID, $sectorID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_SECTOR_LOCATIONS[$gameID][$sectorID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM location JOIN location_type USING (location_type_id) WHERE sector_id = ' . $db->escapeNumber($sectorID) . ' AND game_id=' . $db->escapeNumber($gameID)); @@ -74,7 +74,7 @@ public static function &getSectorLocations($gameID, $sectorID, $forceUpdate = fa return self::$CACHE_SECTOR_LOCATIONS[$gameID][$sectorID]; } - public static function &getLocation($locationTypeID, $forceUpdate = false, $db = null) { + public static function getLocation($locationTypeID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_LOCATIONS[$locationTypeID])) { self::$CACHE_LOCATIONS[$locationTypeID] = new SmrLocation($locationTypeID, $db); } @@ -249,7 +249,7 @@ public function setUG($bool) { } } - public function &getHardwareSold() { + public function getHardwareSold() { if (!isset($this->hardwareSold)) { $this->hardwareSold = array(); $this->db->query('SELECT hardware_type_id FROM location_sells_hardware WHERE ' . $this->SQL); @@ -285,7 +285,7 @@ public function removeHardwareSold($hardwareTypeID) { unset($this->hardwareSold[$hardwareTypeID]); } - public function &getShipsSold() { + public function getShipsSold() { if (!isset($this->shipsSold)) { $this->shipsSold = array(); $this->db->query('SELECT * FROM location_sells_ships WHERE ' . $this->SQL); @@ -320,7 +320,7 @@ public function removeShipSold($shipTypeID) { unset($this->shipsSold[$shipTypeID]); } - public function &getWeaponsSold() { + public function getWeaponsSold() { if (!isset($this->weaponsSold)) { $this->weaponsSold = array(); $this->db->query('SELECT * FROM location_sells_weapons JOIN weapon_type USING (weapon_type_id) WHERE ' . $this->SQL); @@ -354,7 +354,7 @@ public function removeWeaponSold($weaponTypeID) { unset($this->weaponsSold[$weaponTypeID]); } - public function &getLinkedLocations() { + public function getLinkedLocations() { $linkedLocations = array(); if ($this->isHQ()) { if ($this->getTypeID() == LOCATION_TYPE_FEDERAL_HQ) { diff --git a/lib/Default/AbstractSmrPlayer.class.php b/lib/Default/AbstractSmrPlayer.class.php index dc19baf48..c627863f6 100644 --- a/lib/Default/AbstractSmrPlayer.class.php +++ b/lib/Default/AbstractSmrPlayer.class.php @@ -64,7 +64,7 @@ public function getGameID() { return $this->gameID; } - public function &getGame() { + public function getGame() { return SmrGame::getGame($this->gameID); } @@ -106,11 +106,11 @@ public function getPlanet() { } } - public function &getSectorPlanet() { + public function getSectorPlanet() { return SmrPlanet::getPlanet($this->getGameID(), $this->getSectorID()); } - public function &getSectorPort() { + public function getSectorPort() { return SmrPort::getPort($this->getGameID(), $this->getSectorID()); } @@ -118,7 +118,7 @@ public function getSectorID() { return $this->sectorID; } - public function &getSector() { + public function getSector() { return SmrSector::getSector($this->getGameID(), $this->getSectorID()); } @@ -522,7 +522,7 @@ public function isAllianceLeader($forceUpdate = false) { return $this->getAccountID() == $this->getAlliance($forceUpdate)->getLeaderID(); } - public function &getAlliance($forceUpdate = false) { + public function getAlliance($forceUpdate = false) { return SmrAlliance::getAlliance($this->getAllianceID(), $this->getGameID(), $forceUpdate); } @@ -625,7 +625,7 @@ public function getRelation($raceID) { return $rels[$raceID]; } - abstract public function &getShip(); + abstract public function getShip(); public function &shootPlayer(AbstractSmrPlayer $targetPlayer) { return $this->getShip()->shootPlayer($targetPlayer); diff --git a/lib/Default/AbstractSmrPort.class.php b/lib/Default/AbstractSmrPort.class.php index a27b52fbb..03f926927 100644 --- a/lib/Default/AbstractSmrPort.class.php +++ b/lib/Default/AbstractSmrPort.class.php @@ -84,7 +84,7 @@ public static function getGalaxyPorts($gameID, $galaxyID, $forceUpdate = false) return $galaxyPorts; } - public static function &getPort($gameID, $sectorID, $forceUpdate = false, $db = null) { + public static function getPort($gameID, $sectorID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_PORTS[$gameID][$sectorID])) { self::$CACHE_PORTS[$gameID][$sectorID] = new SmrPort($gameID, $sectorID, $db); } @@ -104,7 +104,7 @@ public static function removePort($gameID, $sectorID) { unset(self::$CACHE_PORTS[$gameID][$sectorID]); } - public static function &createPort($gameID, $sectorID) { + public static function createPort($gameID, $sectorID) { if (!isset(self::$CACHE_PORTS[$gameID][$sectorID])) { $p = new SmrPort($gameID, $sectorID); self::$CACHE_PORTS[$gameID][$sectorID] = $p; @@ -263,25 +263,25 @@ public function getVisibleGoodsBought(AbstractSmrPlayer $player = null) { return $this->getVisibleGoods('Buy', $player); } - public function &getAllGoodIDs() { + public function getAllGoodIDs() { return $this->goodIDs['All']; } /** * Get IDs of goods that can be sold to the port */ - public function &getSoldGoodIDs() { + public function getSoldGoodIDs() { return $this->goodIDs['Sell']; } /** * Get IDs of goods that can be bought from the port */ - public function &getBoughtGoodIDs() { + public function getBoughtGoodIDs() { return $this->goodIDs['Buy']; } - public function &getGood($goodID) { + public function getGood($goodID) { if ($this->hasGood($goodID)) { return Globals::getGood($goodID); } else { @@ -795,7 +795,7 @@ public function getSectorID() { return $this->sectorID; } - public function &getSector() { + public function getSector() { return SmrSector::getSector($this->getGameID(), $this->getSectorID()); } @@ -866,7 +866,7 @@ public function getNumWeapons() { return $this->getLevel() + 3; } - public function &getWeapons() { + public function getWeapons() { $weapons = array(); for ($i = 0; $i < $this->getNumWeapons(); ++$i) { $weapons[$i] = SmrWeapon::getWeapon(WEAPON_PORT_TURRET); @@ -1093,7 +1093,7 @@ public function addCachePorts(array $accountIDs) { } return false; } - public static function &getCachedPort($gameID, $sectorID, $accountID, $forceUpdate = false) { + public static function getCachedPort($gameID, $sectorID, $accountID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_CACHED_PORTS[$gameID][$sectorID][$accountID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT visited, port_info @@ -1275,7 +1275,7 @@ protected function doArmourDamage($damage) { return $actualDamage; } - protected function &getAttackersToCredit() { + protected function getAttackersToCredit() { //get all players involved for HoF $attackers = array(); $this->db->query('SELECT account_id FROM player_attacks_port WHERE ' . $this->SQL . ' AND time > ' . $this->db->escapeNumber(TIME - self::TIME_TO_CREDIT_RAID)); diff --git a/lib/Default/AbstractSmrShip.class.php b/lib/Default/AbstractSmrShip.class.php index 3f740b7c4..7c66c73ea 100644 --- a/lib/Default/AbstractSmrShip.class.php +++ b/lib/Default/AbstractSmrShip.class.php @@ -29,7 +29,7 @@ abstract class AbstractSmrShip { protected $hasChangedCargo = false; protected $hasChangedHardware = array(); - public static function &getBaseShip($gameTypeID, $shipTypeID, $forceUpdate = false) { + public static function getBaseShip($gameTypeID, $shipTypeID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID])) { // determine ship $db = new SmrMySqlDatabase(); @@ -42,7 +42,7 @@ public static function &getBaseShip($gameTypeID, $shipTypeID, $forceUpdate = fal return self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID]; } - protected static function &buildBaseShip(MySqlDatabase $db) { + protected static function buildBaseShip(MySqlDatabase $db) { $ship = array(); $ship['Type'] = 'Ship'; $ship['Name'] = $db->getField('ship_name'); @@ -114,7 +114,7 @@ protected static function &buildBaseShip(MySqlDatabase $db) { return $ship; } - public static function &getAllBaseShips($gameTypeID, $forceUpdate = false) { + public static function getAllBaseShips($gameTypeID, $forceUpdate = false) { // determine ship $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM ship_type ORDER BY ship_type_id ASC'); //TODO add game type id @@ -249,7 +249,7 @@ public function getCDsHigh() : int { return $this->getCDsLow() + 100; } - public function &addWeapon($weaponTypeID) { + public function addWeapon($weaponTypeID) { if ($this->hasOpenWeaponSlots() && $this->hasRemainingPower()) { $weapon = SmrWeapon::getWeapon($weaponTypeID); if ($this->getRemainingPower() >= $weapon->getPowerLevel()) { @@ -431,7 +431,7 @@ public function getIllusionDefense() { return $this->illusionShip['Defense']; } - public function &getPlayer() { + public function getPlayer() { return $this->player; } @@ -735,7 +735,7 @@ public function setCargoHolds($amount) { $this->setHardware(HARDWARE_CARGO, $amount); } - public function &getCargo($goodID = false) { + public function getCargo($goodID = false) { if ($goodID !== false) { if (isset($this->cargo[$goodID])) return $this->cargo[$goodID]; @@ -813,7 +813,7 @@ public function hasWeapons() { return $this->getNumWeapons() > 0; } - public function &getWeapons() { + public function getWeapons() { return $this->weapons; } diff --git a/lib/Default/ChessGame.class.php b/lib/Default/ChessGame.class.php index 92b485c1a..8e9554311 100644 --- a/lib/Default/ChessGame.class.php +++ b/lib/Default/ChessGame.class.php @@ -25,7 +25,7 @@ class ChessGame { private $lastMove = null; - public static function &getNPCMoveGames($forceUpdate = false) { + public static function getNPCMoveGames($forceUpdate = false) { $db = new SmrMySqlDatabase(); $db->query('SELECT chess_game_id FROM npc_logins @@ -42,7 +42,7 @@ public static function &getNPCMoveGames($forceUpdate = false) { return $games; } - public static function &getOngoingPlayerGames(AbstractSmrPlayer $player) { + public static function getOngoingPlayerGames(AbstractSmrPlayer $player) { $db = new SmrMySqlDatabase(); $db->query('SELECT chess_game_id FROM chess_game WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND (black_id = ' . $db->escapeNumber($player->getAccountID()) . ' OR white_id = ' . $db->escapeNumber($player->getAccountID()) . ') AND (end_time > ' . TIME . ' OR end_time IS NULL);'); $games = array(); @@ -52,7 +52,7 @@ public static function &getOngoingPlayerGames(AbstractSmrPlayer $player) { return $games; } - public static function &getAccountGames($accountID) { + public static function getAccountGames($accountID) { $db = new SmrMySqlDatabase(); $db->query('SELECT chess_game_id FROM chess_game WHERE black_id = ' . $db->escapeNumber($accountID) . ' OR white_id = ' . $db->escapeNumber($accountID) . ';'); $games = array(); @@ -62,7 +62,7 @@ public static function &getAccountGames($accountID) { return $games; } - public static function &getChessGame($chessGameID,$forceUpdate = false) { + public static function getChessGame($chessGameID,$forceUpdate = false) { if($forceUpdate || !isset(self::$CACHE_CHESS_GAMES[$chessGameID])) { self::$CACHE_CHESS_GAMES[$chessGameID] = new ChessGame($chessGameID); } diff --git a/lib/Default/Council.class.php b/lib/Default/Council.class.php index 0e8738173..45cc47b13 100644 --- a/lib/Default/Council.class.php +++ b/lib/Default/Council.class.php @@ -17,7 +17,7 @@ protected static function initialiseDatabase() { /** * Returns an array of Account ID's of the Council for this race. */ - public static function &getRaceCouncil($gameID, $raceID) { + public static function getRaceCouncil($gameID, $raceID) { if (!isset(self::$COUNCILS[$gameID][$raceID])) { self::initialiseDatabase(); self::$COUNCILS[$gameID][$raceID] = array(); diff --git a/lib/Default/Distance.class.php b/lib/Default/Distance.class.php index d6bd5d743..3780af4d1 100644 --- a/lib/Default/Distance.class.php +++ b/lib/Default/Distance.class.php @@ -51,7 +51,7 @@ public function getEndSectorID() { return $this->path[count($this->path) - 1]; } - public function &getEndSector() { + public function getEndSector() { return SmrSector::getSector($this->gameID, $this->getEndSectorID()); } diff --git a/lib/Default/DummyPlayer.class.php b/lib/Default/DummyPlayer.class.php index da7f6d92b..93215fc74 100644 --- a/lib/Default/DummyPlayer.class.php +++ b/lib/Default/DummyPlayer.class.php @@ -67,7 +67,7 @@ public function &killPlayerByPort(SmrPort $port) { public function &killPlayerByPlanet(SmrPlanet $planet) { } - public function &getShip() { + public function getShip() { return DummyShip::getCachedDummyShip($this); } diff --git a/lib/Default/DummyShip.class.php b/lib/Default/DummyShip.class.php index 4db9f084a..522748323 100644 --- a/lib/Default/DummyShip.class.php +++ b/lib/Default/DummyShip.class.php @@ -62,7 +62,7 @@ public function cacheDummyShip() { 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 @@ -80,7 +80,7 @@ public static function &getCachedDummyShip(AbstractSmrPlayer $player) { return self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()]; } - public static function &getDummyShipNames() { + public static function getDummyShipNames() { $db = new SmrMySqlDatabase(); $db->query('SELECT id FROM cached_dummys WHERE type = \'DummyShip\''); diff --git a/lib/Default/Globals.class.php b/lib/Default/Globals.class.php index a97846490..2e183d98c 100644 --- a/lib/Default/Globals.class.php +++ b/lib/Default/Globals.class.php @@ -38,7 +38,7 @@ public static function canAccessPage($pageName, AbstractSmrPlayer $player, array } } - public static function &getHiddenPlayers() { + public static function getHiddenPlayers() { if (self::$HIDDEN_PLAYERS == null) { self::initialiseDatabase(); self::$db->query('SELECT account_id FROM hidden_players'); @@ -60,7 +60,7 @@ public static function getGalacticPostEditorIDs($gameID) { return $editorIDs; } - public static function &getLevelRequirements() { + public static function getLevelRequirements() { if (self::$LEVEL_REQUIREMENTS == null) { self::initialiseDatabase(); self::$LEVEL_REQUIREMENTS = array(); @@ -77,7 +77,7 @@ public static function &getLevelRequirements() { return self::$LEVEL_REQUIREMENTS; } - public static function &getRaces() { + public static function getRaces() { if (self::$RACES == null) { self::initialiseDatabase(); self::$RACES = array(); @@ -128,7 +128,7 @@ public static function getColouredRaceName($raceID, $relations, $linked = true) return $raceName; } - public static function &getGoods() { + public static function getGoods() { if (self::$GOODS == null) { self::initialiseDatabase(); self::$GOODS = array(); @@ -150,7 +150,7 @@ public static function &getGoods() { } return self::$GOODS; } - public static function &getGood($goodID) { + public static function getGood($goodID) { return Globals::getGoods()[$goodID]; } public static function getGoodName($goodID) { @@ -160,7 +160,7 @@ public static function getGoodName($goodID) { return Globals::getGoods()[$goodID]['Name']; } - public static function &getHardwareTypes($hardwareTypeID = false) { + public static function getHardwareTypes($hardwareTypeID = false) { if (self::$HARDWARE_TYPES == null) { self::initialiseDatabase(); self::$HARDWARE_TYPES = array(); @@ -217,7 +217,7 @@ public static function isFeatureRequestOpen() { return self::$FEATURE_REQUEST_OPEN; } - public static function &getRaceRelations($gameID, $raceID) { + public static function getRaceRelations($gameID, $raceID) { if (!isset(self::$RACE_RELATIONS[$gameID])) { self::$RACE_RELATIONS[$gameID] = array(); } diff --git a/lib/Default/Plotter.class.php b/lib/Default/Plotter.class.php index 35e8fa8a3..51da6ea9e 100644 --- a/lib/Default/Plotter.class.php +++ b/lib/Default/Plotter.class.php @@ -83,7 +83,7 @@ public static function findReversiblePathToX($x, SmrSector $sector, $useFirst, A * 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; @@ -168,7 +168,7 @@ public static function &findDistanceToX($x, SmrSector $sector, $useFirst, Abstra 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) { if ($sec !== null) { @@ -182,7 +182,7 @@ public static function &calculatePortToPortDistances(array $sectors, $distanceLi 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); } } diff --git a/lib/Default/Rankings.class.php b/lib/Default/Rankings.class.php index d6c4cfdca..569ca958d 100644 --- a/lib/Default/Rankings.class.php +++ b/lib/Default/Rankings.class.php @@ -3,7 +3,7 @@ class Rankings { private function __construct() {} - public static function &collectAllianceRankings(SmrMySqlDatabase $db, AbstractSmrPlayer $player, $rank) { + public static function collectAllianceRankings(SmrMySqlDatabase $db, AbstractSmrPlayer $player, $rank) { $rankings = array(); while ($db->nextRecord()) { // increase rank counter @@ -27,7 +27,7 @@ public static function &collectAllianceRankings(SmrMySqlDatabase $db, AbstractSm return $rankings; } - public static function &collectRankings(SmrMySqlDatabase $db, AbstractSmrPlayer $player, $rank) { + public static function collectRankings(SmrMySqlDatabase $db, AbstractSmrPlayer $player, $rank) { $rankings = array(); while ($db->nextRecord()) { // increase rank counter diff --git a/lib/Default/SmrAlliance.class.php b/lib/Default/SmrAlliance.class.php index b77e9f042..c14fd216c 100644 --- a/lib/Default/SmrAlliance.class.php +++ b/lib/Default/SmrAlliance.class.php @@ -25,7 +25,7 @@ class SmrAlliance { protected $memberList; protected $seedlist; - public static function &getAlliance($allianceID, $gameID, $forceUpdate = false) { + public static function getAlliance($allianceID, $gameID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_ALLIANCES[$gameID][$allianceID])) { self::$CACHE_ALLIANCES[$gameID][$allianceID] = new SmrAlliance($allianceID, $gameID); } @@ -42,7 +42,7 @@ public static function getAllianceByDiscordChannel($channel, $forceUpdate = fals } } - public static function &getAllianceByIrcChannel($channel, $forceUpdate = false) { + public static function getAllianceByIrcChannel($channel, $forceUpdate = false) { $db = new SmrMySqlDatabase(); $db->query('SELECT alliance_id, game_id FROM irc_alliance_has_channel WHERE channel = ' . $db->escapeString($channel) . ' LIMIT 1'); if ($db->nextRecord()) { @@ -174,7 +174,7 @@ public function getLeaderID() { return $this->leaderID; } - public function &getLeader() { + public function getLeader() { return SmrPlayer::getPlayer($this->getLeaderID(), $this->getGameID()); } diff --git a/lib/Default/SmrForce.class.php b/lib/Default/SmrForce.class.php index 95a7e9609..7d6792604 100644 --- a/lib/Default/SmrForce.class.php +++ b/lib/Default/SmrForce.class.php @@ -71,7 +71,7 @@ public static function getGalaxyForces($gameID, $galaxyID, $forceUpdate = false) return $galaxyForces; } - public static function &getSectorForces($gameID, $sectorID, $forceUpdate = false) { + public static function getSectorForces($gameID, $sectorID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_SECTOR_FORCES[$gameID][$sectorID])) { self::tidyUpForces(SmrGalaxy::getGalaxyContaining($gameID, $sectorID)); $db = new SmrMySqlDatabase(); @@ -86,7 +86,7 @@ public static function &getSectorForces($gameID, $sectorID, $forceUpdate = false return self::$CACHE_SECTOR_FORCES[$gameID][$sectorID]; } - public static function &getForce($gameID, $sectorID, $ownerID, $forceUpdate = false, $db = null) { + public static function getForce($gameID, $sectorID, $ownerID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_FORCES[$gameID][$sectorID][$ownerID])) { self::tidyUpForces(SmrGalaxy::getGalaxyContaining($gameID, $sectorID)); $p = new SmrForce($gameID, $sectorID, $ownerID, $db); @@ -334,7 +334,7 @@ public function getGameID() { return $this->gameID; } - public function &getSector() { + public function getSector() { return SmrSector::getSector($this->getGameID(), $this->getSectorID()); } @@ -352,11 +352,11 @@ public function ping($pingMessage, AbstractSmrPlayer $playerPinging, $skipCheck } } - public function &getGalaxy() { + public function getGalaxy() { return SmrGalaxy::getGalaxyContaining($this->getGameID(), $this->getSectorID()); } - public function &getOwner() { + public function getOwner() { return SmrPlayer::getPlayer($this->getOwnerID(), $this->getGameID()); } diff --git a/lib/Default/SmrGalaxy.class.php b/lib/Default/SmrGalaxy.class.php index b5391da41..4677808ee 100644 --- a/lib/Default/SmrGalaxy.class.php +++ b/lib/Default/SmrGalaxy.class.php @@ -21,7 +21,7 @@ class SmrGalaxy { protected $hasChanged = false; protected $isNew = false; - public static function &getGameGalaxies($gameID, $forceUpdate = false) { + public static function getGameGalaxies($gameID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_GAME_GALAXIES[$gameID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM game_galaxy WHERE game_id = ' . $db->escapeNumber($gameID) . ' ORDER BY galaxy_id ASC'); @@ -35,7 +35,7 @@ public static function &getGameGalaxies($gameID, $forceUpdate = false) { return self::$CACHE_GAME_GALAXIES[$gameID]; } - public static function &getGalaxy($gameID, $galaxyID, $forceUpdate = false, $db = null) { + public static function getGalaxy($gameID, $galaxyID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_GALAXIES[$gameID][$galaxyID])) { $g = new SmrGalaxy($gameID, $galaxyID, false, $db); self::$CACHE_GALAXIES[$gameID][$galaxyID] = $g; @@ -51,7 +51,7 @@ public static function saveGalaxies() { } } - public static function &createGalaxy($gameID, $galaxyID) { + public static function createGalaxy($gameID, $galaxyID) { if (!isset(self::$CACHE_GALAXIES[$gameID][$galaxyID])) { $g = new SmrGalaxy($gameID, $galaxyID, true); self::$CACHE_GALAXIES[$gameID][$galaxyID] = $g; @@ -178,7 +178,7 @@ public function getSize() { return $this->getHeight() * $this->getWidth(); } - public function &getSectors() { + public function getSectors() { return SmrSector::getGalaxySectors($this->getGameID(), $this->getGalaxyID()); } @@ -334,7 +334,7 @@ public function contains($sectorID) { return $sectorID >= $this->getStartSector() && $sectorID <= $this->getEndSector(); } - public static function &getGalaxyContaining($gameID, $sectorID) { + public static function getGalaxyContaining($gameID, $sectorID) { return SmrSector::getSector($gameID, $sectorID)->getGalaxy(); } diff --git a/lib/Default/SmrGame.class.php b/lib/Default/SmrGame.class.php index 50382d2d3..0521c1d40 100644 --- a/lib/Default/SmrGame.class.php +++ b/lib/Default/SmrGame.class.php @@ -46,7 +46,7 @@ class SmrGame { self::GAME_TYPE_NEWBIE => 'Newbie', ]; - public static function &getGame($gameID, $forceUpdate = false) { + public static function getGame($gameID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_GAMES[$gameID])) { $g = new SmrGame($gameID); self::$CACHE_GAMES[$gameID] = $g; @@ -60,7 +60,7 @@ public static function saveGames() { } } - public static function &createGame($gameID) { + public static function createGame($gameID) { if (!isset(self::$CACHE_GAMES[$gameID])) { $g = new SmrGame($gameID, true); self::$CACHE_GAMES[$gameID] = $g; diff --git a/lib/Default/SmrPlanet.class.php b/lib/Default/SmrPlanet.class.php index abe66aa57..20c73f41f 100644 --- a/lib/Default/SmrPlanet.class.php +++ b/lib/Default/SmrPlanet.class.php @@ -81,14 +81,14 @@ public static function getGalaxyPlanets($gameID, $galaxyID, $forceUpdate = false return $galaxyPlanets; } - public static function &getPlanet($gameID, $sectorID, $forceUpdate = false, $db = null) { + public static function getPlanet($gameID, $sectorID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_PLANETS[$gameID][$sectorID])) { self::$CACHE_PLANETS[$gameID][$sectorID] = new SmrPlanet($gameID, $sectorID, $db); } return self::$CACHE_PLANETS[$gameID][$sectorID]; } - public static function &createPlanet($gameID, $sectorID, $type = 1) { + public static function createPlanet($gameID, $sectorID, $type = 1) { if (!self::getPlanet($gameID, $sectorID)->exists()) { $minTime = SmrGame::getGame($gameID)->getStartTime(); $inhabitableTime = $minTime + pow(mt_rand(45, 85), 3); @@ -225,7 +225,7 @@ public function getSectorID() { return $this->sectorID; } - public function &getGalaxy() { + public function getGalaxy() { return SmrGalaxy::getGalaxyContaining($this->getGameID(), $this->getSectorID()); } @@ -245,7 +245,7 @@ public function setOwnerID($claimerID) { $this->hasChanged = true; } - public function &getOwner() { + public function getOwner() { return SmrPlayer::getPlayer($this->getOwnerID(), $this->getGameID()); } @@ -1083,7 +1083,7 @@ public function attackedBy(AbstractSmrPlayer $trigger, array $attackers) { - public function &getPlayers() { + public function getPlayers() { return SmrPlayer::getPlanetPlayers($this->getGameID(), $this->getSectorID()); } @@ -1095,7 +1095,7 @@ public function hasPlayers() { 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; @@ -1127,7 +1127,7 @@ public function hasFriendlyTraders(AbstractSmrPlayer $player) { return false; } - public function &getWeapons() { + public function getWeapons() { $weapons = $this->getMountedWeapons(); for ($i = 0; $i < $this->getBuilding(PLANET_TURRET); ++$i) { $weapons[] = SmrWeapon::getWeapon(WEAPON_PLANET_TURRET); diff --git a/lib/Default/SmrPlayer.class.php b/lib/Default/SmrPlayer.class.php index 0a2b7749a..ed6bb9755 100644 --- a/lib/Default/SmrPlayer.class.php +++ b/lib/Default/SmrPlayer.class.php @@ -55,7 +55,7 @@ public static function savePlayers() { } } - public static function &getSectorPlayersByAlliances($gameID, $sectorID, array $allianceIDs, $forceUpdate = false) { + public static function getSectorPlayersByAlliances($gameID, $sectorID, array $allianceIDs, $forceUpdate = false) { $players = self::getSectorPlayers($gameID, $sectorID, $forceUpdate); // Don't use & as we do an unset foreach ($players as $accountID => $player) { if (!in_array($player->getAllianceID(), $allianceIDs)) @@ -87,7 +87,7 @@ public static function getGalaxyPlayers($gameID, $galaxyID, $forceUpdate = false return $galaxyPlayers; } - public static function &getSectorPlayers($gameID, $sectorID, $forceUpdate = false) { + public static function getSectorPlayers($gameID, $sectorID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_SECTOR_PLAYERS[$gameID][$sectorID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM player WHERE sector_id = ' . $db->escapeNumber($sectorID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' AND land_on_planet = ' . $db->escapeBoolean(false) . ' AND (last_cpl_action > ' . $db->escapeNumber(TIME - TIME_BEFORE_INACTIVE) . ' OR newbie_turns = 0) AND account_id NOT IN (' . $db->escapeArray(Globals::getHiddenPlayers()) . ') ORDER BY last_cpl_action DESC'); @@ -101,7 +101,7 @@ public static function &getSectorPlayers($gameID, $sectorID, $forceUpdate = fals return self::$CACHE_SECTOR_PLAYERS[$gameID][$sectorID]; } - public static function &getPlanetPlayers($gameID, $sectorID, $forceUpdate = false) { + public static function getPlanetPlayers($gameID, $sectorID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_PLANET_PLAYERS[$gameID][$sectorID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM player WHERE sector_id = ' . $db->escapeNumber($sectorID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' AND land_on_planet = ' . $db->escapeBoolean(true) . ' AND account_id NOT IN (' . $db->escapeArray(Globals::getHiddenPlayers()) . ') ORDER BY last_cpl_action DESC'); @@ -115,7 +115,7 @@ public static function &getPlanetPlayers($gameID, $sectorID, $forceUpdate = fals return self::$CACHE_PLANET_PLAYERS[$gameID][$sectorID]; } - public static function &getAlliancePlayers($gameID, $allianceID, $forceUpdate = false) { + public static function getAlliancePlayers($gameID, $allianceID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_ALLIANCE_PLAYERS[$gameID][$allianceID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM player WHERE alliance_id = ' . $db->escapeNumber($allianceID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' ORDER BY experience DESC'); @@ -129,14 +129,14 @@ public static function &getAlliancePlayers($gameID, $allianceID, $forceUpdate = return self::$CACHE_ALLIANCE_PLAYERS[$gameID][$allianceID]; } - public static function &getPlayer($accountID, $gameID, $forceUpdate = false, $db = null) { + public static function getPlayer($accountID, $gameID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_PLAYERS[$gameID][$accountID])) { self::$CACHE_PLAYERS[$gameID][$accountID] = new SmrPlayer($gameID, $accountID, $db); } return self::$CACHE_PLAYERS[$gameID][$accountID]; } - public static function &getPlayerByPlayerID($playerID, $gameID, $forceUpdate = false) { + public static function getPlayerByPlayerID($playerID, $gameID, $forceUpdate = false) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND player_id = ' . $db->escapeNumber($playerID) . ' LIMIT 1'); if ($db->nextRecord()) { @@ -270,11 +270,11 @@ public function getSharingPlayers($forceUpdate = false) { return $results; } - public function &getShip($forceUpdate = false) { + public function getShip($forceUpdate = false) { return SmrShip::getShip($this, $forceUpdate); } - public function &getAccount() { + public function getAccount() { return SmrAccount::getAccount($this->getAccountID()); } diff --git a/lib/Default/SmrSector.class.php b/lib/Default/SmrSector.class.php index cf060343e..093bf1a1b 100644 --- a/lib/Default/SmrSector.class.php +++ b/lib/Default/SmrSector.class.php @@ -35,7 +35,7 @@ public static function sectorExists($gameID, $sectorID) { } } - public static function &getGalaxySectors($gameID, $galaxyID, $forceUpdate = false) { + public static function getGalaxySectors($gameID, $galaxyID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_GALAXY_SECTORS[$gameID][$galaxyID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM sector WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND galaxy_id=' . $db->escapeNumber($galaxyID) . ' ORDER BY sector_id ASC'); @@ -49,7 +49,7 @@ public static function &getGalaxySectors($gameID, $galaxyID, $forceUpdate = fals return self::$CACHE_GALAXY_SECTORS[$gameID][$galaxyID]; } - public static function &getLocationSectors($gameID, $locationTypeID, $forceUpdate = false) { + public static function getLocationSectors($gameID, $locationTypeID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_LOCATION_SECTORS[$gameID][$locationTypeID])) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM location JOIN sector USING (game_id, sector_id) WHERE location_type_id = ' . $db->escapeNumber($locationTypeID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' ORDER BY sector_id ASC'); @@ -63,7 +63,7 @@ public static function &getLocationSectors($gameID, $locationTypeID, $forceUpdat return self::$CACHE_LOCATION_SECTORS[$gameID][$locationTypeID]; } - public static function &getSector($gameID, $sectorID, $forceUpdate = false, $db = null) { + public static function getSector($gameID, $sectorID, $forceUpdate = false, $db = null) { if (!isset(self::$CACHE_SECTORS[$gameID][$sectorID]) || $forceUpdate) { self::$CACHE_SECTORS[$gameID][$sectorID] = new SmrSector($gameID, $sectorID, false, $db); } @@ -84,7 +84,7 @@ public static function saveSectors() { } } - public static function &createSector($gameID, $sectorID) { + public static function createSector($gameID, $sectorID) { if (!isset(self::$CACHE_SECTORS[$gameID][$sectorID])) { $s = new SmrSector($gameID, $sectorID, true); self::$CACHE_SECTORS[$gameID][$sectorID] = $s; @@ -349,7 +349,7 @@ public function getNumberOfConnections() { return $links; } - public function &getGalaxy() { + public function getGalaxy() { return SmrGalaxy::getGalaxy($this->getGameID(), $this->getGalaxyID()); } @@ -396,7 +396,7 @@ public function getSectorDirection($sectorID) { return 'None'; } - public function &getNeighbourSector($dir) { + public function getNeighbourSector($dir) { return SmrSector::getSector($this->getGameID(), $this->getNeighbourID($dir)); } @@ -416,7 +416,7 @@ public function hasLink($name) { return $this->getLink($name) != 0; } - public function &getLinkSector($name) { + public function getLinkSector($name) { if ($this->hasLink($name)) return SmrSector::getSector($this->getGameID(), $this->getLink($name)); return false; @@ -535,7 +535,7 @@ public function getWarp() { return $this->warp; } - public function &getWarpSector() { + public function getWarpSector() { return SmrSector::getSector($this->getGameID(), $this->getWarp()); } @@ -601,11 +601,11 @@ public function hasPort() { return $this->getPort()->exists(); } - public function &getPort() { + public function getPort() { return SmrPort::getPort($this->getGameID(), $this->getSectorID()); } - public function &createPort() { + public function createPort() { return SmrPort::createPort($this->getGameID(), $this->getSectorID()); } @@ -617,7 +617,7 @@ 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; @@ -648,7 +648,7 @@ public function hasLocation($locationTypeID = false) { return false; } - public function &getLocations() { + public function getLocations() { return SmrLocation::getSectorLocations($this->getGameID(), $this->getSectorID()); } @@ -667,11 +667,11 @@ public function hasPlanet() { return $this->getPlanet()->exists(); } - public function &getPlanet() { + public function getPlanet() { return SmrPlanet::getPlanet($this->getGameID(), $this->getSectorID()); } - public function &createPlanet($type = 1) { + public function createPlanet($type = 1) { return SmrPlanet::createPlanet($this->getGameID(), $this->getSectorID(), $type); } @@ -712,7 +712,7 @@ public function hasEnemyForces(AbstractSmrPlayer $player = null) { return false; } - public function &getEnemyForces(AbstractSmrPlayer $player) { + public function getEnemyForces(AbstractSmrPlayer $player) { $enemyForces = array(); foreach ($this->getForces() as $force) { if (!$player->forceNAPAlliance($force->getOwner())) @@ -743,7 +743,7 @@ public function hasFriendlyForces(AbstractSmrPlayer $player = null) { return false; } - public function &getFriendlyForces(AbstractSmrPlayer $player) { + public function getFriendlyForces(AbstractSmrPlayer $player) { $friendlyForces = array(); foreach ($this->getForces() as $force) { if ($player->forceNAPAlliance($force->getOwner())) @@ -752,11 +752,11 @@ public function &getFriendlyForces(AbstractSmrPlayer $player) { return $friendlyForces; } - public function &getForces() { + public function getForces() { return SmrForce::getSectorForces($this->getGameID(), $this->getSectorID()); } - public function &getPlayers() { + public function getPlayers() { return SmrPlayer::getSectorPlayers($this->getGameID(), $this->getSectorID()); } @@ -764,7 +764,7 @@ public function hasPlayers() { 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; @@ -833,7 +833,7 @@ public function getFightingTradersAgainstForces(AbstractSmrPlayer $attackingPlay return array($attackingPlayer); } - 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())); foreach ($alliancePlayers as $accountID => $player) { @@ -846,7 +846,7 @@ public function &getFightingTradersAgainstPort(AbstractSmrPlayer $attackingPlaye 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) { @@ -861,7 +861,7 @@ public function &getFightingTradersAgainstPlanet(AbstractSmrPlayer $attackingPla 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()); @@ -890,7 +890,7 @@ public function &getFightingTraders(AbstractSmrPlayer $attackingPlayer, Abstract 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) { @@ -905,7 +905,7 @@ public static function &limitFightingTraders(array &$fightingPlayers, AbstractSm return $fightingPlayers; } - public function &getPotentialFightingTraders(AbstractSmrPlayer $attackingPlayer) { + public function getPotentialFightingTraders(AbstractSmrPlayer $attackingPlayer) { $fightingPlayers = array(); $alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(), $this->getSectorID(), array($attackingPlayer->getAllianceID())); foreach ($alliancePlayers as $accountID => $player) { diff --git a/lib/Default/SmrShip.class.php b/lib/Default/SmrShip.class.php index 75ea81537..8ad87ea45 100644 --- a/lib/Default/SmrShip.class.php +++ b/lib/Default/SmrShip.class.php @@ -26,7 +26,7 @@ public static function saveShips() { } } - 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; diff --git a/lib/Default/SmrWeapon.class.php b/lib/Default/SmrWeapon.class.php index e6aa739b3..3c15b9121 100644 --- a/lib/Default/SmrWeapon.class.php +++ b/lib/Default/SmrWeapon.class.php @@ -16,7 +16,7 @@ protected static function initialiseDatabase() { self::$db = new SmrMySqlDatabase(); } - public static function &getWeapon($weaponTypeID, $forceUpdate = false, $db = null) { + public static function getWeapon($weaponTypeID, $forceUpdate = false, $db = null) { if ($forceUpdate || !isset(self::$CACHE_WEAPONS[$weaponTypeID])) { $w = new SmrWeapon($weaponTypeID, $db); if ($w->exists()) @@ -27,7 +27,7 @@ public static function &getWeapon($weaponTypeID, $forceUpdate = false, $db = nul return self::$CACHE_WEAPONS[$weaponTypeID]; } - public static function &getAllWeapons($forceUpdate = false) { + public static function getAllWeapons($forceUpdate = false) { $db = new SmrMySqlDatabase(); $db->query('SELECT * FROM weapon_type'); $weapons = array(); @@ -100,7 +100,7 @@ public function getBuyerRestriction() { return $this->buyerRestriction; } - protected function &getWeightedRandomForPlayer(AbstractSmrPlayer $player) { + protected function getWeightedRandomForPlayer(AbstractSmrPlayer $player) { return WeightedRandom::getWeightedRandomForPlayer($player, 'Weapon', $this->getWeaponTypeID()); } diff --git a/lib/Default/Template.class.php b/lib/Default/Template.class.php index a4fad5e21..9f8450067 100644 --- a/lib/Default/Template.class.php +++ b/lib/Default/Template.class.php @@ -245,7 +245,7 @@ protected function addJavascriptSource($src) { array_push($this->jsSources, $src); } - protected function &convertHtmlToAjaxXml($str, $returnXml) { + protected function convertHtmlToAjaxXml($str, $returnXml) { if (empty($str)) { return ''; } diff --git a/lib/Default/WeightedRandom.class.php b/lib/Default/WeightedRandom.class.php index 8ff938f50..17a9ea819 100644 --- a/lib/Default/WeightedRandom.class.php +++ b/lib/Default/WeightedRandom.class.php @@ -25,14 +25,14 @@ class WeightedRandom { protected $hasChanged = false; - public static function &getWeightedRandom($gameID, $accountID, $type, $typeID, $forceUpdate = false) { + public static function getWeightedRandom($gameID, $accountID, $type, $typeID, $forceUpdate = false) { if ($forceUpdate || !isset(self::$CACHE_RANDOMS[$gameID][$accountID][$type][$typeID])) { self::$CACHE_RANDOMS[$gameID][$accountID][$type][$typeID] = new WeightedRandom($gameID, $accountID, $type, $typeID); } 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); } diff --git a/lib/Default/message.functions.inc b/lib/Default/message.functions.inc index f3aad2c3d..655d62c25 100644 --- a/lib/Default/message.functions.inc +++ b/lib/Default/message.functions.inc @@ -25,7 +25,7 @@ function getAdminBoxNames() { ]; } -function &getMessagePlayer($accountID, $gameID, $messageType = false) { +function getMessagePlayer($accountID, $gameID, $messageType = false) { if ($accountID == ACCOUNT_ID_PORT) $return = 'Port Defenses'; else if ($accountID == ACCOUNT_ID_ADMIN) diff --git a/lib/Hunter Wars/SmrLocation.class.php b/lib/Hunter Wars/SmrLocation.class.php index 309e7d5f6..5480990ef 100644 --- a/lib/Hunter Wars/SmrLocation.class.php +++ b/lib/Hunter Wars/SmrLocation.class.php @@ -2,7 +2,7 @@ class SmrLocation extends AbstractSmrLocation { - public function &getShipsSold() { + public function getShipsSold() { if (!isset($this->shipsSold)) { $this->shipsSold = array(); $this->db->query('SELECT * FROM location_sells_ships