Gestion de l'affichage des veaisseaux maintenant qu'ils sont désiquilibrés

This commit is contained in:
Nigel Sheldon 2020-11-26 15:56:54 +01:00
parent f160876ccc
commit 81bf20f3b8
4 changed files with 23 additions and 11 deletions

View File

@ -586,9 +586,12 @@ class dSpatial implements Donnees
public static function needed($id, surface $planete, $print = false) public static function needed($id, surface $planete, $print = false, $race = NULL)
{ {
if ($planete->race == "humain") { if ($race == NULL) {
$race = $planete->race;
}
if ($race == "humain") {
$neededSpatial = $neededSpatial =
array( array(
array( array(

View File

@ -621,9 +621,12 @@ class dTerrestre implements Donnees
} }
public static function needed($id, surface $planete, $print = false) public static function needed($id, surface $planete, $print = false, $race = NULL)
{ {
if ($planete->race == "humain") { if ($race == NULL) {
$race = $planete->race;
}
if ($race == "humain") {
$neededTerrestre = array( $neededTerrestre = array(
array( array(
array('batiments', 7, 1) array('batiments', 7, 1)

View File

@ -28,6 +28,6 @@ $alli_batimentsVAR = array("centre", "port", "forge", "urgence", "propagande", "
$technologiesVAR = array("techno_indu", "techno_inge", "techno_inge2", "techno_poli", "techno_arme", "techno_defe", "techno_defe2", "techno_proj", "techno_expansion"); $technologiesVAR = array("techno_indu", "techno_inge", "techno_inge2", "techno_poli", "techno_arme", "techno_defe", "techno_defe2", "techno_proj", "techno_expansion");
$batimentsVAR = array("mine_m", "mine_c", "mine_h", "centrale_s", "centrale_f", "radar", "labo", "chantier_terrestre", "chantier_spatial", "caserne", "silo", "centre_info", "habitation", "arcologies", "bunker", "stations", "commercial", "loisir", "administration"); $batimentsVAR = array("mine_m", "mine_c", "mine_h", "centrale_s", "centrale_f", "radar", "labo", "chantier_terrestre", "chantier_spatial", "caserne", "silo", "centre_info", "habitation", "arcologies", "bunker", "stations", "commercial", "loisir", "administration");
$caserneVAR = array("soldat1", "soldat2", "soldat3", "soldat4", "sniper", "spartan", "medecin", "ingenieur", "soldat_lourd"); $caserneVAR = array("soldat1", "soldat2", "soldat3", "soldat4", "sniper", "spartan", "medecin", "ingenieur", "soldat_lourd");
$spatialVAR = array("vaisseau_1", "vaisseau_2", "vaisseau_3", "vaisseau_4", "vaisseau_5", "vaisseau_6", "vaisseau_7", "vaisseau_8", "vaisseau_9", "vaisseau_10", "vaisseau_11", "vaisseau_12", "vaisseau_13", "vaisseau_14"); $spatialVAR = array("vaisseau_1", "vaisseau_2", "vaisseau_3", "vaisseau_4", "vaisseau_5", "vaisseau_6", "vaisseau_7", "vaisseau_8", "vaisseau_9", "vaisseau_10", "vaisseau_11", "vaisseau_12", "vaisseau_13", "vaisseau_14", "vaisseau_15", "vaisseau_16", "vaisseau_17");
$terrestreVAR = array("vais_0", "vais_1", "vais_2", "vais_3", "vcl_1", "vcl_2", "vcl_3", "vcl_4", "def_1", "def_2", "def_3", "def_4", "def_5", "def_6", "def_7", "def_8"); $terrestreVAR = array("vais_0", "vais_1", "vais_2", "vais_3", "vcl_1", "vcl_2", "vcl_3", "vcl_4", "def_1", "def_2", "def_3", "def_4", "def_5", "def_6", "def_7", "def_8");
$coeffVAR = array("coeff_mine_m", "coeff_mine_c", "coeff_mine_h", "coeff_centrale_s", "coeff_centrale_f"); $coeffVAR = array("coeff_mine_m", "coeff_mine_c", "coeff_mine_h", "coeff_centrale_s", "coeff_centrale_f");

View File

@ -89,24 +89,30 @@ foreach ($planete->casernes as $id => $unite) {
$template->assign('caserne', $TEMP_liste); $template->assign('caserne', $TEMP_liste);
$TEMP_liste = array(); $TEMP_liste = array();
foreach ($planete->terrestres as $id => $unite) { $id = 1;
$max_unite = count($LANG[$race]["terrestre"]["noms_sing"]);
while ($id <= $max_unite) {
if (!empty($LANG[$race]["terrestre"]["noms_sing"][$id])) { if (!empty($LANG[$race]["terrestre"]["noms_sing"][$id])) {
$TEMP_liste[$id] = array( $TEMP_liste[$id] = array(
'niveau' => $unite, 'niveau' => $planete->terrestres[$id],
'etat' => dTerrestre::needed($id, $planete, true) 'etat' => dTerrestre::needed($id, $planete, true, $race)
); );
} }
$id++;
} }
$template->assign('unites', $TEMP_liste); $template->assign('unites', $TEMP_liste);
$TEMP_liste = array(); $TEMP_liste = array();
foreach ($planete->vaisseaux as $id => $unite) { $id = 1;
$max_unite = count($LANG[$race]["vaisseaux"]["noms_sing"]);
while ($id <= $max_unite) {
if (!empty($LANG[$race]["vaisseaux"]["noms_sing"][$id])) { if (!empty($LANG[$race]["vaisseaux"]["noms_sing"][$id])) {
$TEMP_liste[$id] = array( $TEMP_liste[$id] = array(
'niveau' => $unite, 'niveau' => $planete->vaisseaux[$id],
'etat' => dSpatial::needed($id, $planete, true) 'etat' => dSpatial::needed($id, $planete, true, $race)
); );
} }
$id++;
} }
$template->assign('vaisseaux', $TEMP_liste); $template->assign('vaisseaux', $TEMP_liste);