| 
                                                        @@ -305,7 +305,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    305
                                                                                                                                                                                                 | 
                                                             			//et compare la liste des batiments qu'il faut pour construire le batiment  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    306
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    306
                                                                                                                                                                                                 | 
                                                             			//a ceux qui sont deja construit dans la base  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    307
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    307
                                                                                                                                                                                                 | 
                                                             			//si tous les batments qu'il faut son batis on autorise la construction du batiment  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    308
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			for ($i = 0 ; $i < $c_all_batiment ; $i++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    308
                                                                                                                                                                                                 | 
                                                            +			for ($i = 0; $i < $c_all_batiment; $i++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    309
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    309
                                                                                                                                                                                                 | 
                                                             				if (!in_array($all_batiment[$i], $batiment_construit)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    310
                                                                                                                                                                                                 | 
                                                             					$query = $dbc1->select("pour_construire") | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    311
                                                                                                                                                                                                 | 
                                                             						->select("temps_construction") | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -340,7 +340,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    340
                                                                                                                                                                                                 | 
                                                             						  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    341
                                                                                                                                                                                                 | 
                                                             						//test si tous les batiments sont construits et on le niveau nécéssaire  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    342
                                                                                                                                                                                                 | 
                                                             						$c_pour_construire = count($pour_construire);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						for ($j = 0 ; $j < count($c_pour_construire) ; $j++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    343
                                                                                                                                                                                                 | 
                                                            +						for ($j = 0; $j < count($c_pour_construire); $j++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    344
                                                                                                                                                                                                 | 
                                                             							if (in_array($pour_construire[$j][1], $batiment_construit)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    345
                                                                                                                                                                                                 | 
                                                             								if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    346
                                                                                                                                                                                                 | 
                                                             									$ok_construction = true;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -418,8 +418,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    418
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    418
                                                                                                                                                                                                 | 
                                                             					$finx_batiment = $taille_batiment[0]+$posx_batiment;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    419
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    419
                                                                                                                                                                                                 | 
                                                             					$finy_batiment = $taille_batiment[1]+$posy_batiment;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    420
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    420
                                                                                                                                                                                                 | 
                                                             					  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    421
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					for ($i = $posy ; $i < $finy ; $i++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    422
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						for ($j = $posx ; $j < $finx ; $j++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    421
                                                                                                                                                                                                 | 
                                                            +					for ($i = $posy; $i < $finy; $i++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    422
                                                                                                                                                                                                 | 
                                                            +						for ($j = $posx; $j < $finx; $j++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    423
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    423
                                                                                                                                                                                                 | 
                                                             							if ((($posx++ >= $posx_batiment) && ($posx++ <= $finx_batiment)) && (($posy++ >= $posy_batiment) && ($posy++ <= $finy_batiment))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    424
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    424
                                                                                                                                                                                                 | 
                                                             								FlashMessage::setFlash("Un batiment est déjà présent à cet emplacement, merci d'en choisir un autre"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    425
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    425
                                                                                                                                                                                                 | 
                                                             								return false;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -549,7 +549,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    549
                                                                                                                                                                                                 | 
                                                             						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    550
                                                                                                                                                                                                 | 
                                                             						->get();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    551
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					if ((is_array($query)) && (count($query) > 0)){ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    552
                                                                                                                                                                                                 | 
                                                            +					if ((is_array($query)) && (count($query) > 0)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    553
                                                                                                                                                                                                 | 
                                                             						foreach ($query as $obj) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    554
                                                                                                                                                                                                 | 
                                                             							$this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    555
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -601,7 +601,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    601
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    602
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    603
                                                                                                                                                                                                 | 
                                                             				//si pas assez de ressource  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				if (($ressource["eau"]["class"] || $ressource["electricite"]["class"] ||$ressource["fer"]["class"] || $ressource["fuel"]["class"]) == "rouge") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    604
                                                                                                                                                                                                 | 
                                                            +				if (($ressource["eau"]["class"] || $ressource["electricite"]["class"] || $ressource["fer"]["class"] || $ressource["fuel"]["class"]) == "rouge") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    605
                                                                                                                                                                                                 | 
                                                             					FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    606
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    606
                                                                                                                                                                                                 | 
                                                             					return false;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    607
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    607
                                                                                                                                                                                                 | 
                                                             				}  |