$ship_count++;
 }
 if ($ship_count <= 0) {
     $return_codes[] = 1209;
     break;
 }
 $tech_goods = array();
 $rs = $db->get_db()->query('select * from goods where tech > 0');
 $rs->data_seek(0);
 while ($row = $rs->fetch_assoc()) {
     $tech_goods[$row['record_id']] = $row;
 }
 $time = PAGE_START_TIME;
 $number = 100;
 $star_count = 0;
 $stars = build_star_map(GALAXY_SIZE, $seed, $star_count);
 $system_ids = array();
 for ($star_i = 0; $star_i < $star_count; $star_i++) {
     $star = $stars[$star_i];
     $race = $star['race'];
     $x = 500 + $star['x'];
     $y = 500 + $star['y'];
     $protected = $star['protected'] ? 1 : 0;
     $radius = $star['size'];
     $name = $star['protected'] ? $star['name'] : $race_list[$star['race']] . ' ' . $number;
     $number += mt_rand(1, 3);
     $stars[$star_i]['name'] = $name;
     if (!($st = $db->get_db()->prepare("insert into systems (caption, x, y, radius, protected, race) values (?,?,?,?,?,?)"))) {
         error_log(__FILE__ . '::' . __LINE__ . " Prepare failed: (" . $db->get_db()->errno . ") " . $db->get_db()->error);
         $return_codes[] = 1006;
         break;
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/page.php';
include_once 'inc/galaxy.php';
if (!get_user_field(USER_ID, 'admin', 'system')) {
    header('Location: viewport.php?rc=1030');
    die;
}
$galaxy_size = GALAXY_SIZE;
$seed = time();
if (isset($_REQUEST['seed']) && is_numeric($_REQUEST['seed'])) {
    $seed = $_REQUEST['seed'];
}
$star_count = 0;
$stars = build_star_map($galaxy_size, $seed, $star_count);
$races = array();
$races[0]['count'] = 0;
$races[1]['count'] = 0;
$races[2]['count'] = 0;
$races[3]['count'] = 0;
for ($i = 0; $i < count($stars); $i++) {
    $races[$stars[$i]['race']]['count'] += 1;
}
$warps = generate_warps($stars, $star_count);
header('Content-type: image/png');
$i_hnd = imagecreatetruecolor($galaxy_size, $galaxy_size) or die('Cannot Initialize new GD image stream');
$races[0]['color'] = imagecolorallocate($i_hnd, 255, 255, 255);
$races[1]['color'] = imagecolorallocate($i_hnd, 128, 255, 128);
$races[2]['color'] = imagecolorallocate($i_hnd, 255, 128, 128);
$races[3]['color'] = imagecolorallocate($i_hnd, 128, 128, 255);