コード例 #1
0
        error_log(__FILE__ . '::' . __LINE__ . " Query selection failed: (" . $db->get_db()->errno . ") " . $db->get_db()->error);
        break;
    }
    while ($row = $rs->fetch_assoc()) {
        if (isset($port_place_types[$row['type']])) {
            $port_places[$row['record_id']] = $row;
            $port_place_count++;
        }
    }
    if ($port_place_count <= 0) {
        $return_codes[] = 1057;
        break;
    }
    // Now find out what goods we can add to a port
    include_once 'inc/start_goods.php';
    if ($spacegame['start_good_count'] <= 0) {
        $return_codes[] = 1058;
        break;
    }
    $demand_start_amount = -PORT_LIMIT;
    $supply_start_amount = PORT_LIMIT;
    include_once 'inc/galaxy.php';
    // Add each port and goods to the database.
    foreach ($port_places as $id => $row) {
        if (!insert_port($row['caption'], $row['system'], $row['x'], $row['y'], $port_place_types[$row['type']] + PLACE_TYPE_SUPPLY_OFFSET, $port_place_types[$row['type']] + PLACE_TYPE_DEMAND_OFFSET, $row['type'], false)) {
            $return_codes[] = 1074;
            break 2;
        }
    }
    update_distances();
} while (false);
コード例 #2
0
            $over_a_port_carrier = true;
            $port_carrier = $place;
        }
    }
    if ($port_already_here) {
        $return_codes[] = 1072;
        break;
    }
    if (!$over_a_port_carrier) {
        $return_codes[] = 1073;
        break;
    }
    // Remove a cargo entry
    if (!($st = $db->get_db()->prepare("update player_cargo set amount = amount - 1 where record_id = ? and amount = ?"))) {
        error_log(__FILE__ . '::' . __LINE__ . " Prepare failed: (" . $db->get_db()->errno . ") " . $db->get_db()->error);
        $return_codes[] = 1006;
        break;
    }
    $st->bind_param("ii", $cargo_id, $tech['amount']);
    if (!$st->execute()) {
        $return_codes[] = 1006;
        error_log(__FILE__ . '::' . __LINE__ . " Query execution failed: (" . $db->get_db()->errno . ") " . $db->get_db()->error);
        break;
    }
    // Alright, let us deploy the port.
    if (!insert_port($port_carrier['caption'], $port_carrier['system'], $port_carrier['x'], $port_carrier['y'], 3, 3, $port_carrier['place_type'])) {
        $return_codes[] = 1074;
        break;
    }
    $return_codes[] = 1076;
} while (false);