07-01-2011, 03:06 PM
<?php
function __CheckChantier() {
$this->Planete[$this->UtileID]['chantier'] = unserialize( $this->Planete[$this->UtileID]['chantier'] );
$this->Planete[$this->UtileID]['chantier_nombre'] = unserialize( $this->Planete[$this->UtileID]['chantier_nombre'] );
if( !empty( $this->Planete[$this->UtileID]['chantier'] ) ) {
$this->Planete[$this->UtileID]['chantier_temps'] += $this->LastUpdate[$this->UtileID];
Foreach( $this->Planete[$this->UtileID]['chantier'] as $Keys => $ID ) {
$Data = new DataConstruct( $ID, $this->Users, $this->Planete, $this->UtileID );
if( $Keys == 0 ) {
if( $this->Planete[$this->UtileID]['chantier_temps'] >= $Data->TimeSum ) {
$this->ElementConstr = floor( $this->Planete[$this->UtileID]['chantier_temps'] / $Data->TimeSum );
$this->ElementConstr = $this->ElementConstr > $this->Planete[$this->UtileID]['chantier_nombre'][$Keys] ? $this->Planete[$this->UtileID]['chantier_nombre'][$Keys] : $this->ElementConstr;
$this->Planete[$this->UtileID]['chantier_nombre'][$Keys] -= $this->ElementConstr;
$this->Planete[$this->UtileID]['chantier_temps'] -= $this->ElementConstr * $Data->TimeSum;
$this->Planete[$this->UtileID][$this->Batiment[$ID]['champ']] += $this->ElementConstr;
if( $this->Planete[$this->UtileID]['chantier_nombre'][$Keys] <= 0 ) {
array_shift( $this->Planete[$this->UtileID]['chantier'] );
array_shift( $this->Planete[$this->UtileID]['chantier_nombre'] );
}}}
$this->Upload[$this->UtileID] .= "`". $this->Batiment[$ID]['champ'] ."` = '". $this->Planete[$this->UtileID][$this->Batiment[$ID]['champ']] ."',";
}
$this->Upload[$this->UtileID] .= "`chantier` = '". serialize( $this->Planete[$this->UtileID]['chantier'] ) ."', `chantier_nombre` = '". serialize( $this->Planete[$this->UtileID]['chantier_nombre'] ) ."',";
} else {
$this->Planete[$this->UtileID]['chantier_temps'] = 0;
}
$this->Upload[$this->UtileID] .= "`chantier_temps` = '". $this->Planete[$this->UtileID]['chantier_temps'] ."',";
}
Honnêtement il manque beaucoup d'éléments pour pouvoir tester ou comprendre ce qu'il se passe.