Пример #1
0
function production()
{
    // Orbital Start
    $sth = mysql_query("select * from o_production where time=1 and pos=1");
    if (!$sth) {
        echo "Database failure!\n";
        return 0;
    }
    while ($orbital = mysql_fetch_array($sth)) {
        $sth1 = mysql_query("insert into constructions (pid,prod_id,type) values ('" . $orbital["planet_id"] . "','" . $orbital["prod_id"] . "',1)");
        if (!$sth1) {
            echo "Database failure!";
        }
        $sth1 = mysql_query("select uid from planets where id=" . $orbital["planet_id"]);
        if (!$sth1) {
            echo "Datasbe failure!";
        }
        list($uid) = mysql_fetch_row($sth1);
        $sth1 = mysql_query("select name from production where prod_id=" . $orbital["prod_id"]);
        if (!$sth1) {
            echo "Database failure!";
        }
        $blub = mysql_fetch_array($sth1);
        $planetname = get_planetname($orbital["planet_id"]);
        ticker($uid, "*lproduction.php?act=build&pid=" . $orbital["planet_id"] . "*" . $planetname . ": " . $blub["name"] . " in orbit constructed.", "w");
        $sth1 = mysql_query("delete from o_production where planet_id='" . $orbital["planet_id"] . "' and prod_id='" . $orbital["prod_id"] . "'");
        if (!$sth1) {
            echo "Database failure!";
            return 0;
        }
        $sth1 = mysql_query("select typ from production where prod_id=" . $orbital["prod_id"] . " and typ='R'");
        if (mysql_num_rows($sth1) > 0) {
            $sth1 = mysql_query("select uid from planets where id=" . $orbital["planet_id"]);
            list($uid) = mysql_fetch_array($sth1);
            $sth1 = mysql_query("delete from tradestations where uid={$uid}");
            $sth1 = mysql_query("insert into tradestations (metal,energy,mopgas,erkunum,gortium,susebloom,uid,pid) values ('0','0','0','0','0','0','{$uid}','" . $orbital["planet_id"] . "')");
        }
        $sth1 = mysql_query("select prod_id from production where prod_id='" . $orbital["prod_id"] . "' and special='S'");
        if (!$sth1) {
            echo "Database failure!";
        }
        if (mysql_num_rows($sth1) > 0) {
            $sth1 = mysql_query("select sid from planets where id=" . $orbital["planet_id"]);
            if (!$sth1) {
                echo "Database failure!";
            }
            $sid = mysql_fetch_row($sth1);
            $sth1 = mysql_query("select * from jumpgatevalues where prod_id=" . $orbital["prod_id"]);
            if (!$sth1) {
                echo "Databaser failure!";
            }
            if (mysql_num_rows($sth1) > 0) {
                $password = crypt(md5(uniqid(mt_rand())));
                $sth1 = mysql_query("insert into jumpgates (prod_id,password,sid,pid) values ('" . $orbital["prod_id"] . "','" . $password . "','" . $sid[0] . "','" . $orbital["planet_id"] . "')");
                if (!$sth1) {
                    echo "Dtasabser failuert!";
                }
                $sth1 = mysql_query("select uid from planets where id=" . $orbital["planet_id"]);
                if (!$sth1) {
                    echo "Dtasber faileu8r!";
                }
                $uid = mysql_fetch_row($sth1);
                mail_to_uid($uid[0], "Password for your jumpgate in system " . $sid[0], $password);
            }
        }
    }
    $sth = mysql_query("update o_production set time=time-'1' where time>1 and pos=1");
    if (!$sth) {
        echo "Database failure!";
        return 0;
    }
    $sth = mysql_query("select distinct p1.planet_id from o_production as p1 left join o_production as p2 on p2.pos=1 and p2.planet_id=p1.planet_id where p1.pos!=1 and p2.pos is NULL");
    if (!$sth) {
        echo "Database failure!";
    }
    while ($pids = mysql_fetch_row($sth)) {
        $next_prod_id = next_in_queue(0, $pids[0]);
        if ($next_prod_id) {
            $uid = get_uid_by_pid($pids[0]);
            if (has_ressources($uid, $next_prod_id)) {
                $sth1 = mysql_query("update o_production set pos=1 where planet_id=" . $pids[0] . " and prod_id={$next_prod_id}");
                $sth1 = mysql_query("select metal,energy,mopgas,erkunum,gortium,susebloom from production where prod_id={$next_prod_id}");
                list($metal, $energy, $mopgas, $erkunum, $gortium, $susebloom) = mysql_fetch_row($sth1);
                $sth1 = mysql_query("update ressources set metal=metal-{$metal},energy=energy-{$energy},mopgas=mopgas-{$mopgas},erkunum=erkunum-{$erkunum},gortium=gortium-{$gortium},susebloom=susebloom-{$susebloom} where uid={$uid}");
            }
        }
    }
    // Orbital Ende
    // Planet production
    $sth = mysql_query("select * from p_production where time=1 and pos=1");
    if (!$sth) {
        echo "Database failure!\n";
        return 0;
    }
    while ($buildings = mysql_fetch_array($sth)) {
        $sth1 = mysql_query("select uid,name from planets where id=" . $buildings["planet_id"]);
        if (!$sth1) {
            echo "Database failure!";
        }
        $uid = mysql_fetch_array($sth1);
        if ($uid["name"] == "Unnamed") {
            $uid["name"] = get_planetname($buildings["planet_id"]);
        }
        $sth1 = mysql_query("select name from production where prod_id=" . $buildings["prod_id"]);
        // Schilde einbauen
        list($value, $shield) = dselect("CONV(SUBSTRING(special FROM 2),10,10), shield", "shipvalues", "special LIKE 'H%' AND prod_id=" . $buildings["prod_id"]);
        if ($value) {
            $janne = mysql_query("REPLACE INTO planetary_shields (pid, prod_id, value, max_value, regeneration, \n        regeneration_bonus) VALUES (" . $buildings["planet_id"] . ", " . $buildings["prod_id"] . ", {$shield}, {$shield},\n          {$value}, 0)");
        }
        if (!$sth1) {
            echo "Database failure!";
        }
        $blub = mysql_fetch_array($sth1);
        ticker($uid["uid"], "*lproduction.php?act=build&pid=" . $buildings["planet_id"] . "*" . $uid["name"] . ": " . $blub["name"] . " constructed.", "w");
        $sth1 = mysql_query("insert into constructions (pid,prod_id,type) values ('" . $buildings["planet_id"] . "','" . $buildings["prod_id"] . "',0)");
        if (!$sth1) {
            echo "Database failure! (CREATING BUILDING ON PLANET)";
        }
        $sth1 = mysql_query("delete from p_production where planet_id='" . $buildings["planet_id"] . "' and prod_id='" . $buildings["prod_id"] . "'");
        if (!$sth1) {
            echo "Database failure! (DELETING PLANETAR PRODUCTION)";
        }
    }
    $sth = mysql_query("update p_production set time=time-'1' where time>1 and pos=1");
    if (!$sth) {
        echo "Database failure!";
        return 0;
    }
    $sth = mysql_query("select distinct p1.planet_id from p_production as p1 left join p_production as p2 on p2.pos=1 and p2.planet_id=p1.planet_id where p1.pos!=1 and p2.pos is NULL");
    if (!$sth) {
        echo "Database failure!";
    }
    while ($pids = mysql_fetch_row($sth)) {
        $next_prod_id = next_in_queue(1, $pids[0]);
        if ($next_prod_id) {
            $uid = get_uid_by_pid($pids[0]);
            if (has_ressources($uid, $next_prod_id)) {
                $sth1 = mysql_query("update p_production set pos=1 where planet_id=" . $pids[0] . " and prod_id={$next_prod_id}");
                $sth1 = mysql_query("select metal,energy,mopgas,erkunum,gortium,susebloom from production where prod_id={$next_prod_id}");
                list($metal, $energy, $mopgas, $erkunum, $gortium, $susebloom) = mysql_fetch_row($sth1);
                $sth1 = mysql_query("update ressources set metal=metal-{$metal},energy=energy-{$energy},mopgas=mopgas-{$mopgas},erkunum=erkunum-{$erkunum},gortium=gortium-{$gortium},susebloom=susebloom-{$susebloom} where uid={$uid}");
            }
        }
    }
    // Planetar Ende
    // Fleet Production Start
    $uids = array();
    $sth = mysql_query("select s.planet_id,s.prod_id,s.count,s.time,s.priority,\nr.uid,r.metal as rmetal,r.energy as renergy,r.mopgas as rmopgas,r.erkunum as rerkunum,r.gortium as rgortium,r.susebloom as rsusebloom,\npl.id,p.metal,p.energy,p.mopgas,p.erkunum,p.gortium,p.susebloom,\nsum(ps.tonnage) as slots,\nsv.tonnage,\np.com_time\nfrom s_production s,planets pl,production p,ressources r,production_slots ps,constructions c,shipvalues sv where s.planet_id=pl.id\nand s.prod_id=p.prod_id\nand p.prod_id=sv.prod_id\nand ps.prod_id=c.prod_id\nand c.pid=pl.id\nand r.uid=pl.uid\ngroup by s.planet_id,s.prod_id,s.time\norder by pl.uid,s.priority DESC,s.time DESC");
    if (!$sth) {
        echo "ERR::GET S_PRODUCTION";
    } else {
        while ($data = mysql_fetch_assoc($sth)) {
            if (!$uids[$data["uid"]]) {
                $uids[$data["uid"]] = array("production_slots" => $data["slots"], "ressources" => array("metal" => $data["rmetal"], "energy" => $data["renergy"], "mopgas" => $data["rmopgas"], "erkunum" => $data["rerkunum"], "gortium" => $data["rgortium"], "susebloom" => $data["rsusebloom"]));
            }
            // mop: maximale anzahl der produzierbaren schiffe ermitteln (durch slots limitiert)
            $prod_count = floor($uids[$data["uid"]]["production_slots"] / $data["tonnage"]);
            $real_count = min($data["count"], $prod_count);
            if ($real_count > 0) {
                // mop: jetzt koenen uns nur noch die ressourcen aufhalten
                foreach (array("metal", "energy", "mopgas", "erkunum", "gortium", "susebloom") as $res) {
                    if ($data[$res]) {
                        $real_count = min($real_count, floor($uids[$data["uid"]]["ressources"][$res] / ceil($data[$res] / $data["com_time"])));
                    }
                }
                if ($real_count > 0) {
                    // mop: alle schiffe produzierbar?
                    if ($real_count == $data["count"]) {
                        // mop: alles easy
                        $sth1 = mysql_query("update s_production s,ressources r set s.time=s.time+1,\n                r.metal=r.metal-" . ceil($real_count * $data["metal"] / $data["com_time"]) . ",\n                r.energy=r.energy-" . ceil($real_count * $data["energy"] / $data["com_time"]) . ",\n                r.mopgas=r.mopgas-" . ceil($real_count * $data["mopgas"] / $data["com_time"]) . ",\n                r.erkunum=r.erkunum-" . ceil($real_count * $data["erkunum"] / $data["com_time"]) . ",\n                r.gortium=r.gortium-" . ceil($real_count * $data["gortium"] / $data["com_time"]) . ",\n                r.susebloom=r.susebloom-" . ceil($real_count * $data["susebloom"] / $data["com_time"]) . "\n                where s.prod_id=" . $data["prod_id"] . " and s.time=" . $data["time"] . " and s.planet_id=" . $data["planet_id"] . " and r.uid=" . $data["uid"]);
                        if (!$sth1) {
                            echo "ERR::UPDATE S_PROD 1";
                        }
                    } else {
                        // mop: stress...aufsplitten
                        $sth1 = mysql_query("insert into s_production set prod_id=" . $data["prod_id"] . ",planet_id=" . $data["planet_id"] . ",count=" . $real_count . ",time=" . ($data["time"] + 1) . ",priority=" . $data["priority"] . " on duplicate key update count=count+" . $real_count . ",priority=" . $data["priority"]);
                        if (!$sth1) {
                            echo "ERR::INSERT SPLIT S_PROD";
                        }
                        // mop: update des rests und der ressourcen
                        $sth1 = mysql_query("update s_production s,ressources r set s.count=s.count-" . $real_count . ",\n                r.metal=r.metal-" . ceil($real_count * $data["metal"] / $data["com_time"]) . ",\n                r.energy=r.energy-" . ceil($real_count * $data["energy"] / $data["com_time"]) . ",\n                r.mopgas=r.mopgas-" . ceil($real_count * $data["mopgas"] / $data["com_time"]) . ",\n                r.erkunum=r.erkunum-" . ceil($real_count * $data["erkunum"] / $data["com_time"]) . ",\n                r.gortium=r.gortium-" . ceil($real_count * $data["gortium"] / $data["com_time"]) . ",\n                r.susebloom=r.susebloom-" . ceil($real_count * $data["susebloom"] / $data["com_time"]) . "\n                where s.prod_id=" . $data["prod_id"] . " and s.time=" . $data["time"] . " and s.planet_id=" . $data["planet_id"] . " and r.uid=" . $data["uid"]);
                        if (!$sth1) {
                            echo "ERR::UPDATE REST S_PROD";
                        }
                    }
                    $uids[$data["uid"]]["production_slots"] -= $real_count * $data["tonnage"];
                    foreach (array("metal", "energy", "mopgas", "erkunum", "gortium", "susebloom") as $res) {
                        $uids[$data["uid"]]["ressources"][$res] -= ceil($real_count * $data[$res] / $data["com_time"]);
                    }
                }
            }
        }
    }
    // mop: rundungsfehler fuer die dinger, die jetzt fertig werden ausgleichen
    $fragments = array();
    foreach (array("metal", "energy", "mopgas", "erkunum", "gortium", "susebloom") as $res) {
        $fragments[] = "r." . $res . "=r." . $res . "+ceil(p." . $res . "*s.count/p.com_time)*p.com_time-p." . $res . "*s.count";
    }
    $sth = mysql_query("update s_production s,production p,planets pl,ressources r set " . implode($fragments, ",") . " where r.uid=pl.uid and pl.id=s.planet_id and s.prod_id=p.prod_id and p.com_time-s.time=0");
    if (!$sth) {
        echo "ERR::CORRECT CEILINGS\n";
    }
    $sth = mysql_query("select * from s_production sp,production p where p.com_time-sp.time=0 and sp.prod_id=p.prod_id");
    if (!$sth) {
        echo "Database failure!\n";
        return 0;
    }
    while ($ships = mysql_fetch_assoc($sth)) {
        $sth1 = mysql_query("select uid,name from planets where id=" . $ships["planet_id"]);
        if (!$sth1) {
            echo "Datasbe failure!";
        }
        $uid = mysql_fetch_assoc($sth1);
        ticker($uid["uid"], "*lproduction.php?pid=" . $ships["planet_id"] . "*" . $uid["name"] . ": " . $ships["count"] . " " . $ships["name"] . "(s) produced.", "w");
        $sth1 = mysql_query("select sid from planets where id=" . $ships["planet_id"]);
        if (!$sth1) {
            echo "Dtabase failuer!";
        }
        $system = mysql_fetch_array($sth1);
        $fids = get_fids_by_pid($ships["planet_id"], $uid["uid"]);
        // Keine Flotte auf dem Planet?
        if (!$fids) {
            $new_fleet = new fleet();
            $new_fleet->add_ships_arr(array($ships["prod_id"] => array($ships["count"], 0)));
            $new_fleet->uid = $uid["uid"];
            $new_fleet->pid = $ships["planet_id"];
            $new_fleet->sid = $system["sid"];
            $new_fleet->create_fleet();
        } else {
            $prod_id_in_fid = false;
            for ($i = 0; $i <= sizeof($fids) - 1; $i++) {
                $fleet = new fleet($fids[$i]);
                if ($fleet->ships[$ships["prod_id"]]) {
                    $prod_id_in_fid =& $fleet;
                    // Das is ne referenz :) Irgendwann musste ich die einfach mal benutzen:)
                    break;
                }
            }
            if ($prod_id_in_fid) {
                $prod_id_in_fid->ships[$ships["prod_id"]][0] += $ships["count"];
                $prod_id_in_fid->update_prod_id($ships["prod_id"]);
            } else {
                $fleet->add_ships_arr(array($ships["prod_id"] => array($ships["count"], 0)));
                if (!$fleet->update_prod_id($ships["prod_id"])) {
                    echo "Error assigning new prod id to fleet " . $fleet->fid . "\n";
                }
            }
        }
        $sth1 = mysql_query("delete from s_production where planet_id='" . $ships["planet_id"] . "' and prod_id='" . $ships["prod_id"] . "' and count='" . $ships["count"] . "' and time=" . $ships["time"]);
        if (!$sth1) {
            echo "Dtaabase failuer!";
        }
    }
    // Fleet Ende
    // Infantery Production Start
    $sth = mysql_query("select * from i_production where time=1");
    if (!$sth) {
        echo "Database failure!\n";
        return 0;
    }
    while ($soldiers = mysql_fetch_array($sth)) {
        $sth1 = mysql_query("select uid,name from planets where id=" . $soldiers["planet_id"]);
        if (!$sth1) {
            echo "Datasbe failure!";
        }
        $uid = mysql_fetch_array($sth1);
        $sth1 = mysql_query("select name from production where prod_id=" . $soldiers["prod_id"]);
        if (!$sth1) {
            echo "Database failure!";
        }
        $blub = mysql_fetch_array($sth1);
        ticker($uid["uid"], "*lproduction.php?pid=" . $soldiers["planet_id"] . "*" . $uid["name"] . ": " . $soldiers["count"] . " " . $blub["name"] . "(s) produced.", "w");
        $sth1 = mysql_query("select prod_id from infantery where prod_id=" . $soldiers["prod_id"] . " and pid=" . $soldiers["planet_id"]);
        if (!$sth1) {
            echo "Dazsu failu!";
        }
        if (mysql_num_rows($sth1) == 0) {
            $sth1 = mysql_query("insert into infantery (prod_id,pid,count,uid) values ('" . $soldiers["prod_id"] . "','" . $soldiers["planet_id"] . "','" . $soldiers["count"] . "','" . $uid[0] . "')");
            if (!$sth1) {
                echo "Database failuerfleet!";
            }
        } else {
            $sth1 = mysql_query("update infantery set count=count+" . $soldiers["count"] . " where pid='" . $soldiers["planet_id"] . "' and prod_id='" . $soldiers["prod_id"] . "' and uid='" . $uid["uid"] . "' limit 1");
            if (!$sth1) {
                echo "Database failure!";
            }
        }
        $sth1 = mysql_query("delete from i_production where planet_id='" . $soldiers["planet_id"] . "' and prod_id='" . $soldiers["prod_id"] . "' and count='" . $soldiers["count"] . "' and time=1");
        if (!$sth1) {
            echo "Dtaabase failuer!";
        }
    }
    $sth = mysql_query("select * from infbattle" . $soldier["planet_id"]);
    if ($sth) {
        $sth = mysql_query("insert into infbattle" . $soldier["planet_id"] . " (prod_id,count,initiative,side) values ('" . $soldier["prod_id"] . "','" . $soldier["count"] . "','0','0')");
    }
    $sth = mysql_query("update i_production set time=time-'1' where time>1");
    if (!$sth) {
        echo "Database failure!";
        //      return 0;
    }
    // Infantery Ende
}
Пример #2
0
function fleet_info()
{
    global $pid;
    global $uid;
    global $skin;
    $sth = mysql_query("select uid from planets where id={$pid} and uid={$uid}");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    if (mysql_num_rows($sth) == 0) {
        show_error("Databaser failure!");
        return 0;
    }
    $fids = get_fids_by_pid($pid, $uid);
    if (!$fids) {
        show_message("You have no fleet on this planet");
    } else {
        table_start("center", "500");
        table_head_text(array("Ships in orbit"), "3");
        table_text_open("head");
        for ($i = 0; $i < sizeof($fids); $i++) {
            $fleet = new fleet($fids[$i]);
            table_text_open("head");
            table_text_design($fleet->name, "80", "", "", "head");
            table_text_design("Name", "300", "center", "", "smallhead");
            table_text_design("Count", "100", "center", "", "smallhead");
            table_text_close();
            while (list($prod_id, $ships_arr) = each($fleet->ships)) {
                $sth = mysql_query("select manual from production where prod_id={$prod_id}");
                if (!$sth) {
                    show_error("Database failure!");
                    return 0;
                }
                $manual = mysql_fetch_array($sth);
                table_text_open("text", "center");
                table_text_design("<a href='" . $manual["manual"] . "' target=\"_blank\"><img src='arts/" . get_pic($prod_id) . "' border='0' alt='" . get_description($prod_id) . "' align='center'></a><br><a href=\"" . $PHP_SELF . "?act=print_ship_info&prod_id=" . $prod_id . "\">Info</a>", "80", "", "", "text");
                table_text_design(get_name_by_prod_id($prod_id), "300", "", "", "text");
                table_text_design($ships_arr[0], "100", "", "", "text");
                table_text_close();
            }
        }
        table_end();
    }
    $sth3 = mysql_query("select * from s_production as sp,production as p where sp.planet_id='" . $pid . "' and p.prod_id=sp.prod_id order by sp.time,sp.prod_id");
    table_start("center", "500");
    fleet($sth3);
    table_end();
}
Пример #3
0
 $p_type = $planets[$j]["type"];
 //get_planets_type($planets[$j]);
 $its_name = addslashes($planets[$j]["name"]);
 //get_planetname($planets[$j]);
 // $its_class  = get_style($p_uid);
 if ($p_uid > 0) {
     $its_class = get_uids_relation($uid, $p_uid, 1);
     $its_relation = strtolower(substr($its_class, 5));
     $its_class .= "Outline";
 } else {
     $its_class = "colorNoneOutline";
     $its_relation = "none";
 }
 $its_radius = get_radius($p_type);
 if (!$fog_mode) {
     $its_fleets = get_fids_by_pid($planets[$j]["id"]);
 }
 if ($p_type != "G") {
     $its_image = "<image onmouseover=\"updateStatusText('" . $its_name . "');\" onmouseout=\"updateStatusText(' ');\" xlink:href=\"arts/" . $p_type . "_small.gif\" width=\"" . $its_radius * 2 . "\" height=\"" . $its_radius * 2 . "\" x=\"" . (($j + 2) * $abstand - $its_radius) . "\" y=\"" . -$its_radius . "\"/>\n";
 } else {
     $its_image = "<image onmouseover=\"updateStatusText('" . $its_name . "');\" onmouseout=\"updateStatusText(' ');\" xlink:href=\"arts/" . $p_type . "_small.gif\" width=\"" . $its_radius * 4 . "\" height=\"" . $its_radius * 4 . "\" x=\"" . (($j + 2) * $abstand - $its_radius * 2) . "\" y=\"" . -$its_radius * 2 . "\"/>\n";
 }
 // speziell wegen den Ringen der Gas Giganten Klasse
 echo "<g>\n";
 /************************
    - neue Function bei click auf planeten:
    - clickOnPlanet(evt, 'planet')
    - old: echo("<g onclick=\"showInfo(evt, 'planet');\" id=\"p".$planets[$j]."\">\n");
    -
    ************************/
 echo "<g onclick=\"clickOnPlanet(evt);\" id=\"p" . $planets[$j]["id"] . "\" cursor=\"pointer\" type=\"" . $p_type . "\" relation=\"" . $its_relation . "\" rhint=\"" . ($j + 2) * $abstand . "\">\n";
Пример #4
0
function transfer()
{
    global $uid;
    global $fleet;
    global $PHP_SELF;
    global $HTTP_REFFERRER;
    if (!is_array($fleet)) {
        show_error("You have to select a fleet and some ships in order to transfer!");
        return 0;
    }
    $i = 0;
    while (list($key, $value) = each($fleet)) {
        if ($value == "Y") {
            $fleets[$i] = new fleet($key);
            if (!$fleets[$i]->uid == $uid) {
                show_error("Hello! I'm your friend...Why are you trying such nasty things?");
                return 0;
            }
            if (!$pid) {
                $pid = $fleets[$i]->pid;
                $sid = $fleets[$i]->sid;
            } else {
                if ($fleets[$i]->pid != $pid || $fleets[$i]->sid != $sid) {
                    show_error("You may only select fleets which are at the same planet and system!");
                    return 0;
                }
            }
        }
        $i++;
    }
    $new_fleet = new fleet();
    echo "<form action=\"" . $PHP_SELF . "\" method=post>";
    for ($i = 0; $i < sizeof($fleets); $i++) {
        $temp_var = "fleet_" . $fleets[$i]->fid;
        global ${$temp_var};
        foreach ((array) ${$temp_var} as $key => $value) {
            // Überprüfen ob die werte ok sind (key=>prod_id, value=>count)
            if ($fleets[$i]->ships[$key] && $fleets[$i]->ships[$key][0] >= $value && (int) $value > 0) {
                // Das wird nachher ausgelesen um die flotten auch um den wert zu reduzieren
                $fleets[$i]->ships[$key][0] -= $value;
                $aff_fleets[] = $fleets[$i]->fid;
                $new_fleet->add_ships_arr(array($key => array($value, $fleets[$i]->ships[$key][1])));
            } elseif ($value == 0) {
                continue;
            } else {
                show_error("You entered a wrong shipcount for fleet " . $fleets[$i]->name . "!");
                return 0;
            }
            form_hidden("fleet_" . $fleets[$i]->fid . "[" . $key . "]", $value);
        }
    }
    $fids = get_fids_by_pid($pid, $uid, $sid);
    for ($i = 0; $i < sizeof($fleets); $i++) {
        // mop: was für nen toller hack
        if (in_array($fleets[$i]->fid, $fids)) {
            // mop: umdrehen, damit wir das unsetten können ohne das array komplett durchsuchen zu müssen
            $fids_tmp = array_flip($fids);
            unset($fids_tmp[$fleets[$i]->fid]);
            // mop: und wieder zurück
            $fids = array_flip($fids_tmp);
        }
        form_hidden("fid[" . $i . "]", $fleets[$i]->fid);
    }
    // mop: wenn fertig fidsarray neubauen
    $fids = array_values($fids);
    // mop: jetzt die ausgewählten flotten abwählen
    for ($i = 0; $i < sizeof($fids); $i++) {
        $trans_fleets[$i] = new fleet($fids[$i]);
    }
    if (sizeof($trans_fleets) == 0) {
        center_headline("You have no fleets you could transfer these ships to:)");
        go_back($_SERVER["PHP_SELF"]);
    } else {
        for ($i = 0; $i < sizeof($trans_fleets); $i++) {
            $head_array = "";
            $text_arr = "";
            $prod_arr = "";
            table_start("center", "80%");
            table_head_text(array("Fleet " . $trans_fleets[$i]->name), "20");
            $head_array[0] = "&nbsp;";
            $prod_arr[0] = "";
            $text_arr[0] = "<input type=radio name=\"fleet\" value=\"" . $trans_fleets[$i]->fid . "\">";
            reset($trans_fleets[$i]);
            while (list($prod_id, $ship_arr) = each($trans_fleets[$i]->ships)) {
                $head_array[] = get_name_by_prod_id($prod_id);
                $text_arr[] = $ship_arr[0];
            }
            $mission = $trans_fleets[$i]->get_mission();
            list($type, $location) = $trans_fleets[$i]->get_location();
            if ($type == 0) {
                $mission_text = $mission[0] . " ";
            } else {
                $mission_text = "On its way to " . $mission[1] . " ";
            }
            list($location_id, $location_type) = $location;
            if ($location_type == 0) {
                $mission_text .= "planet " . get_planetname($trans_fleets[$i]->pid);
                $location_text = "Planet " . get_planetname($trans_fleets[$i]->pid) . "(" . get_systemname($trans_fleets[$i]->sid) . ")";
            } else {
                $mission_text .= "system " . get_system_coords($trans_fleets[$i]->sid);
                $location_text = "System " . get_systemname($trans_fleets[$i]->sid);
            }
            table_text(array("&nbsp;"), "", "", "20", "head");
            table_text_open();
            table_text_design("Mission:", "50", "", "", "smallhead");
            table_text_design($mission_text, "", "", "19", "text");
            table_text_close();
            table_text($head_array, "", "", "", "smallhead");
            table_text($text_arr, "", "", "", "text");
            table_end();
            echo "<br><br>\n";
        }
        form_hidden("act", "transferab");
        echo "<center>\n";
        echo "<input type=submit value=\"Transfer\">";
        echo "</center>\n";
        echo "</form>";
    }
}