Ejemplo n.º 1
0
        $planet->feld[$fid]->bau = $bauplan;
        $planet->feld[$fid]->aktiv = 1;
        $planet->feld[$fid]->rest_bauzeit = $bauplan->bauzeit;
        $planet->feld[$fid]->save();
        for ($i = 0; $i < sizeof($planet->frachtraum->fracht); $i++) {
            $planet->frachtraum->fracht[$i]->anzahl -= $bauplan->baukosten->fracht[$i + 1]->anzahl;
        }
        $planet->energie -= $bauplan->baukosten->fracht[0]->anzahl;
        $planet->frachtraum->save();
        mysql_query("update planeten set energie=" . $planet->energie . " where id = " . $planet->id);
        echo "<span class=\"success\">" . $bauplan->name . " wird jetzt gebaut und wird in " . $bauplan->bauzeit . " Ticks fertig sein!</span>";
        echo '<meta http-equiv="refresh" content="2; URL=planet.php?pid=' . $planet->id . '">';
    }
}
echo '<table class="liste"><tr><th>Bild</th><th>Name</th><th>Baukosten</th><th>Kosten pro Tick</th><th>Effekt pro Tick</th><th>Effekt</th><th>Bauzeit</th><th>Baubar auf</th></tr>';
$liste = Bauplan_Gebaude::getListe($planet->feld[$fid]->untergrund->id);
for ($k = 0; $k < sizeof($liste); $k++) {
    //get correct imgae index
    $t_index = -1;
    for ($i = 0; $i < sizeof($liste[$k]->untergrund); $i++) {
        if ($liste[$k]->untergrund[$i]->id == $planet->feld[$fid]->untergrund->id) {
            $t_index = $i;
        }
    }
    echo '<tr><td><a href="build.php?pid=' . $planet->id . '&fid=' . $fid . '&bauen=' . $liste[$k]->id . '">';
    echo '<img src="images/buildings/' . $liste[$k]->bild[$t_index] . '" border="0" />';
    echo '</a></td>';
    echo '<td>' . $liste[$k]->name . '</td>';
    echo '<td><table>';
    for ($i = 0; $i < sizeof($liste[$k]->baukosten->fracht); $i++) {
        if ($liste[$k]->baukosten->fracht[$i]->anzahl > 0) {