Esempio n. 1
0
function getPlotDistanceOld(SmrSector &$sector, SmrSector &$target)
{
    $plotter = new Course_Plotter();
    $plotter->set_course($sector->getSectorID(), $target->getSectorID(), $sector->getGameID());
    $plotter->plot();
    $return = $plotter->plotted_course[0];
    $plotter->Course_Plotter_Destructor();
    unset($plotter);
    return $return;
}
Esempio n. 2
0
function getGoodDistanceOld(SmrSector &$sector, $goodID, $transaction)
{
    // if we buy a good we're looking for the nearest sector that sells that good
    if ($transaction == 'Buy') {
        $neg_transaction = 'Sell';
    } elseif ($transaction == 'Sell') {
        $neg_transaction = 'Buy';
    }
    // initialize the queue. all sectors we have to visit are in here
    $sector_queue = array();
    // keeps the distance to the start sector
    $sector_distance = array();
    // putting start sector in queue
    array_push($sector_queue, $sector->getSectorID());
    // it has a null distance
    $sector_distance[$sector->getSectorID()] = 0;
    $good_distance = 0;
    while (sizeof($sector_queue) > 0) {
        // get current sector and
        $curr_sector_id = array_shift($sector_queue);
        // get the distance for this sector from the start sector
        $distance = $sector_distance[$curr_sector_id];
        // create a new sector object
        $curr_sector =& SmrSector::getSector($sector->getGameID(), $curr_sector_id);
        // does the current sector buy/sell the good we're looking for?
        if ($good_distance != 0) {
            if ($curr_sector->hasPort() && $curr_sector->getPort()->hasGood($goodID, $neg_transaction) && $distance < $good_distance) {
                $good_distance = $distance;
            }
        } else {
            if ($curr_sector->hasPort() && $curr_sector->getPort()->hasGood($goodID, $neg_transaction)) {
                $good_distance = $distance;
            }
        }
        // if we already found a port that buy or sell our product we don't need
        // to go further than this one.
        if ($good_distance != 0 && $good_distance <= $distance) {
            continue;
        }
        // enqueue all neighbours
        if ($curr_sector->getLinkUp() > 0 && (!isset($sector_distance[$curr_sector->getLinkUp()]) || $sector_distance[$curr_sector->getLinkUp()] > $distance + 1)) {
            array_push($sector_queue, $curr_sector->getLinkUp());
            $sector_distance[$curr_sector->getLinkUp()] = $distance + 1;
        }
        if ($curr_sector->getLinkDown() > 0 && (!isset($sector_distance[$curr_sector->getLinkDown()]) || $sector_distance[$curr_sector->getLinkDown()] > $distance + 1)) {
            array_push($sector_queue, $curr_sector->getLinkDown());
            $sector_distance[$curr_sector->getLinkDown()] = $distance + 1;
        }
        if ($curr_sector->getLinkLeft() > 0 && (!isset($sector_distance[$curr_sector->getLinkLeft()]) || $sector_distance[$curr_sector->getLinkLeft()] > $distance + 1)) {
            array_push($sector_queue, $curr_sector->getLinkLeft());
            $sector_distance[$curr_sector->getLinkLeft()] = $distance + 1;
        }
        if ($curr_sector->getLinkRight() > 0 && (!isset($sector_distance[$curr_sector->getLinkRight()]) || $sector_distance[$curr_sector->getLinkRight()] > $distance + 1)) {
            array_push($sector_queue, $curr_sector->getLinkRight());
            $sector_distance[$curr_sector->getLinkRight()] = $distance + 1;
        }
        if ($curr_sector->getWarp() > 0 && (!isset($sector_distance[$curr_sector->getWarp()]) || $sector_distance[$curr_sector->getWarp()] > $distance + 5)) {
            array_push($sector_queue, $curr_sector->getWarp());
            $sector_distance[$curr_sector->getWarp()] = $distance + 5;
        }
    }
    $container['good_distance'] = $good_distance;
    return $good_distance;
}
Esempio n. 3
0
         $topLeft =& $player->getSector();
     }
     if (!$galaxy->contains($topLeft->getSectorID())) {
         $topLeft =& SmrSector::getSector($player->getGameID(), $galaxy->getStartSector());
     } else {
         $template->assign('FocusSector', $topLeft->getSectorID());
         //go left then up
         for ($i = 0; $i < floor($galaxy->getWidth() / 2); $i++) {
             $topLeft =& $topLeft->getNeighbourSector('Left');
         }
         for ($i = 0; $i < floor($galaxy->getHeight() / 2); $i++) {
             $topLeft =& $topLeft->getNeighbourSector('Up');
         }
     }
 } else {
     $topLeft =& SmrSector::getSector($player->getGameID(), $galaxy->getStartSector());
 }
 $mapSectors = array();
 $leftMostSec =& $topLeft;
 for ($i = 0; $i < $galaxy->getHeight(); $i++) {
     $mapSectors[$i] = array();
     //new row
     if ($i != 0) {
         $leftMostSec =& $leftMostSec->getNeighbourSector('Down');
     }
     //get left most sector for this row
     $thisSec =& $leftMostSec;
     //iterate through the columns
     for ($j = 0; $j < $galaxy->getWidth(); $j++) {
         //new sector
         if ($j != 0) {
Esempio n. 4
0
<?php

$sector =& $player->getSector();
if (!$sector->isLinked($var['target_sector']) && $sector->getSectorID() != $var['target_sector']) {
    create_error('You cannot scan a sector you are not linked to.');
}
// initialize vars
$scanSector =& SmrSector::getSector($player->getGameID(), $var['target_sector']);
$template->assign('PageTopic', 'Sector Scan of #' . $scanSector->getSectorID() . ' (' . $scanSector->getGalaxyName() . ')');
$friendly_forces = 0;
$enemy_forces = 0;
$friendly_vessel = 0;
$enemy_vessel = 0;
// iterate over all forces in the target sector
$scanSectorAllForces =& $scanSector->getForces();
foreach ($scanSectorAllForces as &$scanSectorForces) {
    // decide if it's a friendly or enemy stack
    if ($player->sameAlliance($scanSectorForces->getOwner())) {
        $friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs();
    } else {
        $enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs();
    }
}
unset($scanSectorForces);
$scanSectorPlayers =& $scanSector->getOtherTraders($player);
foreach ($scanSectorPlayers as &$scanSectorPlayer) {
    $scanSectorShip =& $scanSectorPlayer->getShip();
    // he's a friend if he's in our alliance (and we are not in a 0 alliance
    if ($player->traderMAPAlliance($scanSectorPlayer)) {
        $friendly_vessel += $scanSectorShip->getAttackRating();
    } else {
<?php

$sector =& SmrSector::getSector($var['game_id'], $var['sector_id']);
$container = $var;
$container['url'] = '1.6/universe_create_save_processing.php';
$container['body'] = '1.6/universe_create_sectors.php';
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= '<table class="create"><tr><td class="center';
if (!$sector->hasLinkUp()) {
    $PHP_OUTPUT .= ' border_top';
}
if (!$sector->hasLinkDown()) {
    $PHP_OUTPUT .= ' border_bottom';
}
if (!$sector->hasLinkLeft()) {
    $PHP_OUTPUT .= ' border_left';
}
if (!$sector->hasLinkRight()) {
    $PHP_OUTPUT .= ' border_right';
}
$PHP_OUTPUT .= '"><table><tr><td width="5%">&nbsp;</td><td width="90%" class="center"><input type="checkbox" name="up" value="up"';
if ($sector->hasLinkUp()) {
    $PHP_OUTPUT .= ' checked';
}
$PHP_OUTPUT .= '></td><td width="5%">&nbsp;</td></tr>';
$PHP_OUTPUT .= '<tr><td width="5%" class="center"><input type="checkbox" name="left" value="left"';
if ($sector->hasLinkLeft()) {
    $PHP_OUTPUT .= ' checked';
}
$PHP_OUTPUT .= '></td><td width="90%" class="center">';
$PHP_OUTPUT .= 'Sector: ' . $sector->getSectorID() . '<br /><br />';
Esempio n. 6
0
$container['max_rank'] = $max_rank;
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= '<p><input type="number" name="min_rank" value="' . $min_rank . '" size="3" id="InputFields" class="center">&nbsp;-&nbsp;<input type="number" name="max_rank" value="' . $max_rank . '" size="3" id="InputFields" class="center">&nbsp;';
$PHP_OUTPUT .= create_submit('Show');
$PHP_OUTPUT .= '</p></form>';
$PHP_OUTPUT .= '<table class="standard" width="95%">';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th>Rank</th>';
$PHP_OUTPUT .= '<th>Sector</th>';
$PHP_OUTPUT .= '<th>Battles</th>';
$PHP_OUTPUT .= '</tr>';
$db->query('SELECT * FROM sector WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY battles DESC, sector_id LIMIT ' . ($min_rank - 1) . ', ' . ($max_rank - $min_rank + 1));
$rank = $min_rank - 1;
while ($db->nextRecord()) {
    // get current player
    $curr_sector =& SmrSector::getSector($player->getGameID(), $db->getField('sector_id'));
    // increase rank counter
    $rank++;
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<td valign="top" class="center';
    if ($player->getSectorID() == $curr_sector->getSectorID()) {
        $PHP_OUTPUT .= ' bold';
    }
    $PHP_OUTPUT .= '">' . $rank . '</td>';
    $PHP_OUTPUT .= '<td valign="top" class="center';
    if ($player->getSectorID() == $curr_sector->getSectorID()) {
        $PHP_OUTPUT .= ' bold';
    }
    $PHP_OUTPUT .= '">' . $curr_sector->getSectorID() . '</td>';
    $PHP_OUTPUT .= '<td valign="top" class="center';
    if ($player->getSectorID() == $curr_sector->getSectorID()) {
    create_error('Hmmmm...if ' . $player->getSectorID() . '=' . $target . ' then that means...YOU\'RE ALREADY THERE! *cough*you\'re real smart*cough*');
}
if ($sector->hasForces()) {
    $sectorForces =& $sector->getForces();
    foreach ($sectorForces as &$forces) {
        if ($forces->hasMines() && !$player->forceNAPAlliance($forces->getOwner())) {
            create_error('You cant jump when there are unfriendly forces in the sector!');
        }
    }
    unset($forces);
}
if (!SmrGalaxy::getGalaxyContaining($player->getGameID(), $target)) {
    create_error('The target sector doesn\'t exist!');
}
// create sector object for target sector
$targetSector =& SmrSector::getSector($player->getGameID(), $target);
require_once get_file_loc('Plotter.class.inc');
$path =& Plotter::findDistanceToX($targetSector, $player->getSector(), true);
if ($path === false) {
    create_error('Unable to plot from ' . $start . ' to ' . $target . '.');
}
// send scout msg
$sector->leavingSector($player, MOVEMENT_JUMP);
// Move the user around
// TODO: (Must be done while holding both sector locks)
$distance = $path->getRelativeDistance();
$turnsToJump = max(TURNS_JUMP_MINIMUM, round($distance * TURNS_PER_JUMP_DISTANCE));
// check for turns
if ($player->getTurns() < $turnsToJump) {
    create_error('You don\'t have enough turns for that jump!');
}
<?php

require_once get_file_loc('SmrSector.class.inc');
$sector =& SmrSector::getSector(SmrSession::$game_id, $player->getSectorID(), SmrSession::$account_id);
require_once get_file_loc('smr_force.inc');
if ($player->getNewbieTurns() > 0) {
    create_error('You are under newbie protection!');
}
//turns are taken b4 player fires.
$forces = new SMR_FORCE($owner_id, $player->getSectorID(), $player->getGameID());
if ($forces->mines == 0) {
    create_error('No mines in sector! You should never be see this! Why are you looking at this! STOP! NOW! GO AWAY! PLEASE!!! STOP READING THIS NOW!!! PLEASE!!!');
}
// delete plotted course
$player->deletePlottedCourse();
// send message if scouts are present
if ($forces->scout_drones > 0) {
    $message = 'Your forces in sector ' . $forces->sector_id . ' are being attacked by ' . $player->getPlayerName();
    $player->sendMessage($forces->owner_id, $SCOUTMSG, $db->escape_string($message, false));
    //insert into ticker
    $db->query('SELECT * FROM player_has_ticker WHERE account_id = ' . $owner_id . ' AND game_id = ' . $player->getGameID() . ' AND type = \'scout\'');
    if ($db->next_record()) {
        $db->query('SELECT * FROM player_has_ticker WHERE account_id = ' . $player->getAccountID() . ' AND type = \'block\'');
        if (!$db->next_record()) {
            $db->query('UPDATE player_has_ticker SET recent = ' . $db->escape_string($message, false) . ', time = ' . TIME . ' WHERE account_id = ' . $owner_id . ' AND game_id = ' . $player->getGameID());
        }
    }
}
$force_msg = array();
$container = array();
$container['url'] = 'skeleton.php';
<?php

require_once get_file_loc('SmrGalaxy.class.inc');
if (!isset($var['game_id'])) {
    SmrSession::updateVar('game_id', $_REQUEST['game_id']);
}
if (!isset($var['gal_on'])) {
    SmrSession::updateVar('gal_on', 1);
}
//generate sector array
$galaxy =& SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']);
$galaxies =& SmrGalaxy::getGameGalaxies($var['game_id']);
$topLeft =& SmrSector::getSector($var['game_id'], $galaxy->getStartSector());
$mapSectors = array();
$leftMostSec =& $topLeft;
for ($i = 0; $i < $galaxy->getHeight(); $i++) {
    $mapSectors[$i] = array();
    //new row
    if ($i != 0) {
        $leftMostSec =& $leftMostSec->getNeighbourSector('Down');
    }
    //get left most sector for this row
    $thisSec =& $leftMostSec;
    //iterate through the columns
    for ($j = 0; $j < $galaxy->getWidth(); $j++) {
        //new sector
        if ($j != 0) {
            $thisSec =& $thisSec->getNeighbourSector('Right');
        }
        $mapSectors[$i][$j] =& $thisSec;
    }
Esempio n. 10
0
$PHP_OUTPUT .= '</td><td style="padding:0px;vertical-align:top;width:32em">';
// get the array back
$full = implode(' - ', $path->getPath());
// throw start sector away
// it's useless for the route
$path->removeStart();
// now get the sector we are going to but don't remove it (sector_move_processing does it)
$next_sector = $path->getNextOnPath();
if ($sector->isLinked($next_sector)) {
    // save this to db (if we still have something
    if ($path->getTotalSectors() > 0) {
        $player->setPlottedCourse($path);
    }
    //$PHP_OUTPUT.=create_echo_form($container);
    if (!$player->isLandedOnPlanet()) {
        $nextSector =& SmrSector::getSector($player->getGameID(), $path->getNextOnPath(), $player->getAccountID());
        $PHP_OUTPUT .= '<table class="nobord" width="100%">
			<tr>
				<td class="top right">
					<div class="buttonA">
						<a class="buttonA" href="' . $nextSector->getCurrentSectorHREF() . '">&nbsp; Follow Course (' . $path->getNextOnPath() . ') &nbsp;</a>
					</div>
				</td>
			</tr>';
        if ($ship->hasScanner()) {
            $PHP_OUTPUT .= '<tr>
				<td class="top right">
					<div class="buttonA">
						<a class="buttonA" href="' . $nextSector->getScanSectorHREF() . '">&nbsp; Scan Course (' . $path->getNextOnPath() . ') &nbsp;</a>
					</div>
				</td>
Esempio n. 11
0
function &findRoutes(&$player)
{
    debug('Finding Routes');
    $galaxies =& SmrGalaxy::getGameGalaxies($player->getGameID());
    $tradeGoods = array(GOOD_NOTHING => false);
    $goods =& Globals::getGoods();
    foreach ($goods as $goodID => &$good) {
        if ($player->meetsAlignmentRestriction($good['AlignRestriction'])) {
            $tradeGoods[$goodID] = true;
        } else {
            $tradeGoods[$goodID] = false;
        }
    }
    unset($good);
    $tradeRaces = array();
    $races =& Globals::getRaces();
    foreach ($races as $raceID => &$race) {
        $tradeRaces[$raceID] = false;
    }
    unset($race);
    $tradeRaces[$player->getRaceID()] = true;
    $galaxy =& $player->getSector()->getGalaxy();
    $maxNumberOfPorts = 2;
    $routesForPort = -1;
    $numberOfRoutes = 1000;
    $maxDistance = 15;
    $startSectorID = $galaxy->getStartSector();
    $endSectorID = $galaxy->getEndSector();
    $db = new SmrMySqlDatabase();
    $db->query('SELECT routes FROM route_cache WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND max_ports=' . $db->escapeNumber($maxNumberOfPorts) . ' AND goods_allowed=' . $db->escapeObject($tradeGoods) . ' AND races_allowed=' . $db->escapeObject($tradeRaces) . ' AND start_sector_id=' . $db->escapeNumber($startSectorID) . ' AND end_sector_id=' . $db->escapeNumber($endSectorID) . ' AND routes_for_port=' . $db->escapeNumber($routesForPort) . ' AND max_distance=' . $db->escapeNumber($maxDistance));
    if ($db->nextRecord()) {
        $routes = unserialize(gzuncompress($db->getField('routes')));
        debug('Using Cached Routes: #' . count($routes));
        return $routes;
    } else {
        debug('Generating Routes');
        $allSectors = array();
        foreach ($galaxies as &$galaxy) {
            $allSectors += $galaxy->getSectors();
            //Merge arrays
        }
        unset($galaxy);
        $distances =& Plotter::calculatePortToPortDistances($allSectors, $maxDistance, $startSectorID, $endSectorID);
        if ($maxNumberOfPorts == 1) {
            $allRoutes = RouteGenerator::generateOneWayRoutes($allSectors, $distances, $tradeGoods, $tradeRaces, $routesForPort);
        } else {
            $allRoutes = RouteGenerator::generateMultiPortRoutes($maxNumberOfPorts, $allSectors, $tradeGoods, $tradeRaces, $distances, $routesForPort, $numberOfRoutes);
        }
        unset($distances);
        $allRoutes =& $allRoutes[RouteGenerator::EXP_ROUTE];
        $routesMerged = array();
        foreach ($allRoutes as $multi => &$routesByMulti) {
            $routesMerged += $routesByMulti;
            //Merge arrays
        }
        unset($routesByMulti);
        unset($allSectors);
        SmrPort::clearCache();
        SmrSector::clearCache();
        $db->query('INSERT INTO route_cache ' . '(game_id, max_ports, goods_allowed, races_allowed, start_sector_id, end_sector_id, routes_for_port, max_distance, routes)' . ' VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($maxNumberOfPorts) . ', ' . $db->escapeObject($tradeGoods) . ', ' . $db->escapeObject($tradeRaces) . ', ' . $db->escapeNumber($startSectorID) . ', ' . $db->escapeNumber($endSectorID) . ', ' . $db->escapeNumber($routesForPort) . ', ' . $db->escapeNumber($maxDistance) . ', ' . $db->escapeObject($routesMerged, true) . ')');
        debug('Found Routes: #' . count($routesMerged));
        return $routesMerged;
    }
}
Esempio n. 12
0
foreach ($galaxies as &$galaxy) {
    if ($galaxy->contains($start)) {
        $startExists = true;
    }
    if ($galaxy->contains($target)) {
        $targetExists = true;
    }
}
unset($galaxy);
if ($startExists === false || $targetExists === false) {
    create_error('The sectors have to exist!');
}
$account->log(LOG_TYPE_MOVEMENT, 'Player plots to ' . $target . '.', $player->getSectorID());
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'course_plot_result.php';
require_once get_file_loc('Plotter.class.inc');
$path =& Plotter::findDistanceToX(SmrSector::getSector($player->getGameID(), max($target, $start)), SmrSector::getSector($player->getGameID(), min($target, $start)), true);
if ($path === false) {
    create_error('Unable to plot from ' . $start . ' to ' . $target . '.');
}
if ($start > $target) {
    //We always plot lowest to highest, so reverse if need be.
    $path->reversePath();
}
$container['Distance'] = serialize($path);
$path->removeStart();
if ($sector->isLinked($path->getNextOnPath()) && $path->getTotalSectors() > 0) {
    $player->setPlottedCourse($path);
}
forward($container);
<?php

require_once get_file_loc('SmrGalaxy.class.inc');
//universe_create_locations.php
$container = $var;
$container['url'] = '1.6/universe_create_save_processing.php';
$container['body'] = '1.6/universe_create_sectors.php';
$PHP_OUTPUT .= create_echo_form($container);
//get totals
//$totalLocs[5] = 0;
//$totalLocs[6] = 0;
$locations =& SmrLocation::getAllLocations();
$galSectors =& SmrSector::getGalaxySectors($var['game_id'], $var['gal_on']);
foreach ($galSectors as &$sector) {
    $sectorLocations =& $sector->getLocations();
    foreach ($sectorLocations as &$sectorLocation) {
        $totalLocs[$sectorLocation->getTypeID()]++;
    }
    unset($sectorLocation);
}
unset($sector);
$galaxy =& SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']);
$PHP_OUTPUT .= 'Working on Galaxy : ' . $galaxy->getName() . ' (' . $galaxy->getGalaxyID() . ')<br />';
$PHP_OUTPUT .= '<table class="standard">';
foreach ($locations as &$location) {
    //	if (isset($loc_array['Do Not List']) && $loc_array['Do Not List']) continue;
    $extra = '<span class="small"><br />';
    if ($location->isWeaponSold()) {
        //$extra = '<table class="nobord right">';
        $weaponsSold =& $location->getWeaponsSold();
        foreach ($weaponsSold as &$weapon) {
function addLocationToSector(SmrLocation &$location, SmrSector &$sector)
{
    $fedBeacon =& SmrLocation::getLocation(LOCATION_TYPE_FEDERAL_BEACON);
    //	if ($loc_id > 1 && $loc_id < 10) {
    //		//get max loc #s for each type
    //		$max = array(0,0,0,0,0,0,0,0,0,0);
    //		foreach ($LOCATIONS as $id => $array) {
    //			//skip fed beacon and "Random Bank Location" and such
    //			if ($id >= 100) $type = floor($id / 100);
    //			else continue;
    //			//determine a range of this type of location (ie banks are 501-504)
    //			if ($id > $max[$type]) $max[$type] = $id;
    //		}
    //
    //		//we need to insert random banks,ship shops, etc
    //		$min = $loc_id * 100 + 1; //smallest ID
    //		$max_s = $max[$loc_id]; //largest ID
    //		$loc_id = mt_rand($min, $max_s); //get rand id
    //		while (in_array($loc_id,$SPECIAL) || in_array($loc_id, $updateLoc[$sector])) $loc_id = mt_rand($min, $max_s); //check if this is an allowed id
    //	}
    if ($sector->hasLocation($location->getTypeID())) {
        return false;
    }
    $sector->addLocation($location);
    //insert the location
    if ($location->isHQ()) {
        //only playable races have extra locations to add
        //Racial/Fed
        $linkedLocations =& $location->getLinkedLocations();
        foreach ($linkedLocations as &$linkedLocation) {
            $sector->addLocation($linkedLocation);
            if ($linkedLocation->isFed()) {
                $fedBeacon =& $linkedLocation;
            }
        }
        unset($linkedLocation);
        //add Beacons to all surrounding areas (up to 2 sectors out)
        if (!$sector->offersFederalProtection()) {
            $sector->addLocation($fedBeacon);
        }
        //add beacon to this sector
        $visitedSectors = array();
        $links = array('Up', 'Right', 'Down', 'Left');
        $fedSectors = array(&$sector);
        $tempFedSectors = array();
        for ($i = 0; $i < DEFAULT_FED_RADIUS; $i++) {
            foreach ($fedSectors as &$fedSector) {
                foreach ($links as $link) {
                    if ($fedSector->hasLink($link) && !isset($visitedSectors[$fedSector->getLink($link)])) {
                        $linkSector =& $sector->getLinkSector($link);
                        if (!$linkSector->offersFederalProtection()) {
                            $linkSector->addLocation($fedBeacon);
                        }
                        //add beacon to this sector
                        $tempFedSectors[] =& $linkSector;
                        $visitedSectors[$fedSector->getLink($link)] = true;
                    }
                }
            }
            $fedSectors =& $tempFedSectors;
            $tempFedSectors = array();
        }
    }
    return true;
}