From 48af948d8451571c43724be39ace3d3532ad1db4 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Tue, 16 Jan 2018 01:43:54 -0800 Subject: [PATCH] Remove createPort methods `SmrPort::createPort` is equivalent to `getPort`, so just remove it. We can also remove the wrapper with the same name from `SmrSector`. --- admin/Default/1.6/universe_create_save_processing.php | 9 ++------- lib/Default/SmrPort.class.inc | 8 -------- lib/Default/SmrSector.class.inc | 4 ---- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/admin/Default/1.6/universe_create_save_processing.php b/admin/Default/1.6/universe_create_save_processing.php index c659e7221..1b824a679 100644 --- a/admin/Default/1.6/universe_create_save_processing.php +++ b/admin/Default/1.6/universe_create_save_processing.php @@ -234,7 +234,7 @@ if($numRacePorts[$raceID]==0) unset($numRacePorts[$raceID]); - $port =& $galSector->createPort(); + $port =& $galSector->getPort(); $port->setRaceID($raceID); $port->upgradeToLevel($i); $port->setCreditsToDefault(); @@ -305,12 +305,7 @@ } //update port if ($_POST['port_level'] > 0) { - if(!$sector->hasPort()) { - $port =& $sector->createPort(); - } - else { - $port =& $sector->getPort(); - } + $port =& $sector->getPort(); if ($port->getLevel()!=$_POST['port_level']) { $port->upgradeToLevel($_POST['port_level']); $port->setCreditsToDefault(); diff --git a/lib/Default/SmrPort.class.inc b/lib/Default/SmrPort.class.inc index 1d21191f2..94c600fe8 100644 --- a/lib/Default/SmrPort.class.inc +++ b/lib/Default/SmrPort.class.inc @@ -89,14 +89,6 @@ class SmrPort { unset(self::$CACHE_PORTS[$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; - } - return self::$CACHE_PORTS[$gameID][$sectorID]; - } - public static function savePorts() { foreach(self::$CACHE_PORTS as &$gamePorts) { foreach($gamePorts as &$port) { diff --git a/lib/Default/SmrSector.class.inc b/lib/Default/SmrSector.class.inc index 1461eebe7..6502dff85 100644 --- a/lib/Default/SmrSector.class.inc +++ b/lib/Default/SmrSector.class.inc @@ -592,10 +592,6 @@ class SmrSector { return SmrPort::getPort($this->getGameID(),$this->getSectorID()); } - public function &createPort() { - return SmrPort::createPort($this->getGameID(),$this->getSectorID()); - } - public function removePort() { SmrPort::removePort($this->getGameID(),$this->getSectorID()); }