function decreaseShipAmount($num) {
		if ($this->old_amount == 0) {
			$this->old_amount = $this->amount;
		}
		$this->lost_this_tick += $num;
		$this->amount -= $num;
		appendPlayerLog($this->player_id, 'Decreasing ships in SHIP OBJ. num ='.$num, '');
	}
						$table[playerfleet_ships].player_id, $table[playerfleet_ships].fleet_id, $table[playerfleet].target_id
						FROM `$table[ships]` 
						INNER JOIN $table[playerfleet_ships] ON $table[ships].id = $table[playerfleet_ships].ship_id
						INNER JOIN $table[playerfleet] ON $table[playerfleet].id = $table[playerfleet_ships].fleet_id
						WHERE $table[playerfleet_ships].fleet_id = '$rec_findreturning[id]'
						ORDER BY $table[ships].traveltime DESC";
		$res_findtraveltime = mysql_query($sql_findtraveltime);
		$num_findtraveltime = @mysql_num_rows($res_findtraveltime);
		if ($num_findtraveltime > 0) {
			$rec_findtraveltime = mysql_fetch_assoc($res_findtraveltime);
			$slowest_traveltime = $rec_findtraveltime['traveltime'];
		}
		if ($slowest_traveltime > 0) {
			if (($current - $rec_findreturning['sent_tick']) > $slowest_traveltime) { $eta = $slowest_traveltime; }
			else { $eta = $current - $rec_findreturning['sent_tick']; }
		} else {
			$eta = $current - $rec_findreturning['sent_tick'];
		}
		$target_xyz = getXYZ($rec_findtraveltime['target_id']);
		$player_xyz = getXYZ($rec_findtraveltime['player_id']);
		$eta_bonus = 0;
		if (($target_xyz[0] == $player_xyz[0]) && ($target_xyz[1] == $player_xyz[1])) { $eta_bonus = 10; }
		elseif ($target_xyz[0] == $player_xyz[0]) { $eta_bonus = 5; }
		$eta -= $eta_bonus;
		$action_start = $current + $eta;
		$sql_fleethome = "UPDATE $table[playerfleet] SET `target_id` = '$rec_findreturning[player_id]', `action` = 'home', `action_start` = '$action_start', `action_time` = '0' WHERE `id` = '$rec_findreturning[id]'";
		mysql_query($sql_fleethome) or die(mysql_error());
		appendPlayerLog($rec_findreturning['player_id'], 'Found fleet which should already be returning home (id: '.$rec_findreturning['id'].'). Sending it home now..', '');
	}
}
?>
			if ($ship_id == $current_ship_id) {
				$player_id = $scd[$j]->player_id;
				$fleet_id = $scd[$j]->fleet_id;

				$new_amount = $scd[$j]->getAmount();
				$lost_ships = $scd[$j]->getLostShips();
				$old_amount = $scd[$j]->getOldAmount();

				if ($lost_ships > 0) {
					$sql_updship1 = "UPDATE $table[playerunit] SET `amount` = `amount` - '$lost_ships' WHERE `unit_id` = '$ship_id' AND `player_id` = '$player_id'";
					appendPlayerLog($player_id, 'Updating ship('.$ship_id.') total amount (dec. with: '.$lost_ships.'). Updated because they where lost in battle (as defender).', '');
					mysql_query($sql_updship1) or die(mysql_error());
				}
				if ($new_amount <> $old_amount) {
					$sql_updship2 = "UPDATE $table[playerfleet_ships] SET `amount` = '$new_amount' WHERE `ship_id` = '$ship_id' AND `player_id` = '$player_id' AND `fleet_id` = '$fleet_id'";
					appendPlayerLog($player_id, 'Updating ship('.$ship_id.') fleet amount (new amount: '.$new_amount.'). Updated because they where lost in battle (as defender).', '');
					mysql_query($sql_updship2) or die(mysql_error());
				}
			}
		}
	}

	$asteroid_report = getARHtmlStart();

	$asteroid_report .= getARHtml('Steel', $p['roid_steel'], ($p['roid_steel'] - $new['roid_steel']));
	$asteroid_report .= getARHtml('Crystal', $p['roid_crystal'], ($p['roid_crystal'] - $new['roid_crystal']));
	$asteroid_report .= getARHtml('Erbium', $p['roid_erbium'], ($p['roid_erbium'] - $new['roid_erbium']));
	$asteroid_report .= getARHtml('Unused', $p['roid_unused'], ($p['roid_unused'] - $new['roid_unused']));
	$ar_total = $p['roid_steel'] + $p['roid_crystal'] + $p['roid_erbium'] + $p['roid_unused'];
	$ar_totalnew = $new['roid_steel'] + $new['roid_crystal'] + $new['roid_erbium'] + $new['roid_unused'];
	$asteroid_report .= getARHtml('Total', $ar_total, ($ar_total - $ar_totalnew));