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;
}