@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | * @param $case_depart |
| 401 | 401 | * @param $nom_batiment |
| 402 | 402 | * @param $nom_batiment_sql |
| 403 | - * @return bool |
|
| 403 | + * @return false|null |
|
| 404 | 404 | * fonction qui test si un il y a la place de construire un batiment en fonction de sa case ou il a été laché en x et y |
| 405 | 405 | * et en fonction de sa taille et du positionnement des autres batiments |
| 406 | 406 | */ |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | /** |
| 484 | 484 | * @param $nom_batiment_sql |
| 485 | - * @param $niveau |
|
| 485 | + * @param integer $niveau |
|
| 486 | 486 | * @return array |
| 487 | 487 | * recuperation des ressources nécéssaire pour construire le batiment |
| 488 | 488 | */ |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | public function getRessourceConstruire() { |
| 48 | 48 | return $this->ressource_construire; |
| 49 | 49 | } |
| 50 | - public function getInfoBatiment(){ |
|
| 50 | + public function getInfoBatiment() { |
|
| 51 | 51 | return $this->info_batiment; |
| 52 | 52 | } |
| 53 | - public function getInfoBatimentNext(){ |
|
| 53 | + public function getInfoBatimentNext() { |
|
| 54 | 54 | return $this->info_batiment_next; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if ((is_array($query)) && (count($query) > 0)) { |
| 87 | 87 | foreach ($query as $obj) { |
| 88 | 88 | if ($obj->construction == 1) { |
| 89 | - return $obj->niveau-1; |
|
| 89 | + return $obj->niveau - 1; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $obj->niveau; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if ($niveau > 0) { |
| 149 | 149 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
| 150 | 150 | |
| 151 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 151 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 152 | 152 | foreach ($query as $obj) { |
| 153 | 153 | return $obj->stockage; |
| 154 | 154 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $this->niveau_batiment = $this->niveau_batiment + 1; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
| 190 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
| 191 | 191 | } |
| 192 | 192 | else { |
| 193 | 193 | $query = $dbc1->select("nom_table") |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | $id_batiment = $obj->ID_batiment; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ($this->date_fin_construction-$today <= 0) { |
|
| 255 | + if ($this->date_fin_construction - $today <= 0) { |
|
| 256 | 256 | $this->setTerminerConstruction($id_batiment); |
| 257 | 257 | } |
| 258 | 258 | else { |
| 259 | 259 | Bataille::setValues([ |
| 260 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
| 260 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
| 261 | 261 | "nom_batiment_construction" => $this->nom_batiment_construction |
| 262 | 262 | ]); |
| 263 | 263 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | //et compare la liste des batiments qu'il faut pour construire le batiment |
| 307 | 307 | //a ceux qui sont deja construit dans la base |
| 308 | 308 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
| 309 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
| 309 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
| 310 | 310 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
| 311 | 311 | $query = $dbc1->select("pour_construire") |
| 312 | 312 | ->select("temps_construction") |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | else if (count($pour_construire) > 1) { |
| 350 | 350 | $ok_construction = false; |
| 351 | 351 | //test si tous les batiments sont construits et on le niveau nécéssaire |
| 352 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
| 352 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
| 353 | 353 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
| 354 | 354 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
| 355 | 355 | $ok_construction = true; |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | $case_depart = explode(",", $case_depart); |
| 417 | 417 | $posx = $case_depart[0]; |
| 418 | 418 | $posy = $case_depart[1]; |
| 419 | - $finx = $width_batiment+$posx; |
|
| 420 | - $finy = $height_batiment+$posy; |
|
| 419 | + $finx = $width_batiment + $posx; |
|
| 420 | + $finy = $height_batiment + $posy; |
|
| 421 | 421 | |
| 422 | 422 | //récupération de tous les batiments |
| 423 | 423 | $query = $dbc->select("posx") |
@@ -433,11 +433,11 @@ discard block |
||
| 433 | 433 | $posx_batiment = $obj->posx; |
| 434 | 434 | $posy_batiment = $obj->posy; |
| 435 | 435 | |
| 436 | - $finx_batiment = $taille_batiment[0]+$posx_batiment; |
|
| 437 | - $finy_batiment = $taille_batiment[1]+$posy_batiment; |
|
| 436 | + $finx_batiment = $taille_batiment[0] + $posx_batiment; |
|
| 437 | + $finy_batiment = $taille_batiment[1] + $posy_batiment; |
|
| 438 | 438 | |
| 439 | - for ($i=$posy ; $i<$finy ; $i++) { |
|
| 440 | - for ($j=$posx ; $j<$finx ; $j++) { |
|
| 439 | + for ($i = $posy; $i < $finy; $i++) { |
|
| 440 | + for ($j = $posx; $j < $finx; $j++) { |
|
| 441 | 441 | if ((($posx++ >= $posx_batiment) && ($posx++ <= $finx_batiment)) && (($posy++ >= $posy_batiment) && ($posy++ <= $finy_batiment))) { |
| 442 | 442 | FlashMessage::setFlash("Un batiment est déjà présent à cet emplacement, merci d'en choisir un autre"); |
| 443 | 443 | return false; |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
| 490 | 490 | $dbc1 = Bataille::getDb(); |
| 491 | 491 | |
| 492 | - $niveau = $niveau+1; |
|
| 492 | + $niveau = $niveau + 1; |
|
| 493 | 493 | |
| 494 | 494 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
| 495 | 495 | |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | private function getTestBatimentConstruction($nom_batiment) { |
| 524 | 524 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
| 525 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
| 525 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | return [$nom_batiment, false]; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $dbc1 = Bataille::getDb(); |
| 537 | 537 | |
| 538 | 538 | //récupération du temps et des ressources pour construire |
| 539 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
| 539 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
| 540 | 540 | |
| 541 | 541 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
| 542 | 542 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
| 558 | 558 | ->get(); |
| 559 | 559 | |
| 560 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 560 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 561 | 561 | foreach ($query as $obj) { |
| 562 | 562 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 563 | 563 | } |
@@ -566,10 +566,10 @@ discard block |
||
| 566 | 566 | //récupération de la phrase pour le niveau suivant |
| 567 | 567 | $query = $dbc1->select($xml->$nom_batiment_sql->champ) |
| 568 | 568 | ->from($this->nom_batiment_sql) |
| 569 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
| 569 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
| 570 | 570 | ->get(); |
| 571 | 571 | |
| 572 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 572 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 573 | 573 | foreach ($query as $obj) { |
| 574 | 574 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 575 | 575 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | $query = $dbc1->select("ressource_construire") |
| 631 | 631 | ->select("temps_construction") |
| 632 | 632 | ->from($this->nom_batiment_sql) |
| 633 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
| 633 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
| 634 | 634 | ->get(); |
| 635 | 635 | |
| 636 | 636 | foreach ($query as $obj) { |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | //on insere la construction dans la table batiment si new batiment |
| 642 | 642 | if ($un_batiment == 0) { |
| 643 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
| 643 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
| 644 | 644 | ->insert("nom_batiment", $nom_batiment) |
| 645 | 645 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
| 646 | 646 | ->insert("posx", intval($posx)) |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $this->id_batiment = $dbc->lastInsertId(); |
| 654 | 654 | } |
| 655 | 655 | else { |
| 656 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
| 656 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
| 657 | 657 | ->update("construction", 1) |
| 658 | 658 | ->from("_bataille_batiment") |
| 659 | 659 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | $today = Bataille::getToday(); |
| 668 | 668 | |
| 669 | 669 | //date de la fin de la construction en seconde |
| 670 | - $fin_construction = $today+$temps_construction; |
|
| 670 | + $fin_construction = $today + $temps_construction; |
|
| 671 | 671 | |
| 672 | 672 | $dbc->insert("date_fin", $fin_construction) |
| 673 | 673 | ->insert("ID_base", Bataille::getIdBase()) |