<?php
if(!defined('INDEX')) { header('Location: ../'); exit; }
$page = 'ressources';
$titre = 'Ressources';

if (isset($_POST['coeff_metal']) && isset($_POST['coeff_cs'])) {

	$planete->coeff_bat[0] = floor($_POST['coeff_metal'])/100;
	if (isset($_POST['coeff_cristal'])) $planete->coeff_bat[1] = floor($_POST['coeff_cristal'])/100;
	if (isset($_POST['coeff_hydrogene'])) $planete->coeff_bat[2] = floor($_POST['coeff_hydrogene'])/100;
	$planete->coeff_bat[3] = floor($_POST['coeff_cs'])/100;
	if (isset($_POST['coeff_ce'])) $planete->coeff_bat[4] = floor($_POST['coeff_ce'])/100;
	if (!in_array('coeff_bat', $planete->modif)) $planete->modif[] = 'coeff_bat';

	header('Location: ?p=ressources');
	exit;
}

$template->assign('nombat', $batiment);

$tablo = $planete->production(3600, true);

$template->assign('ressources_prod', $tablo[1]);
$template->assign('ressources_conso', $tablo[2]);
$template->assign('ressources_coef', $tablo[0]);
$template->assign('ressources_silo', array($planete->batiments[10], pow(2, $planete->batiments[10]) * 100000));
$template->assign('ressources_toto', array($tablo[1][2] - $tablo[2][3], '(0)'));

$template->assign('ressources_tab', array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100));
?>