Max747
-
6 juil. 2021 à 13:08
NHenry
Messages postés15083Date d'inscriptionvendredi 14 mars 2003StatutModérateurDernière intervention19 septembre 2023
-
7 juil. 2021 à 23:18
Bonjour,
Sur mon site de jeu d'échecs j'ai ce message warning qui survient lorsque la partie débute et qu'aucun mouvement de pièces n'est pas encore effectué:
Warning: count(): Parameter must be an array or an object that implements Countable in /customers/6/0/9/jeuxechecs.fr/httpd.www/echecs/includes/gui.inc.php on line 431
Cette ligne 431 correspond à celle ci dessous:
for ($i = 0; $i < (count($movesArray) - 1); $i++)
Faisant partie de la fonction ci dessous:
function getMovesCoordinate( )
{
global $movesArray;
$moves = array( );
for ($i = 0; $i < (count($movesArray) - 1); $i++)
{
$move = $movesArray[$i + 1];
// clear out all of the vars
$piece = $sqFrom = $sqTo = $mid = $pro = $chk = '';
colrow2til($move['fromCol'],$move['fromRow'],$sqFrom);
colrow2til($move['toCol'],$move['toRow'],$sqTo);
$mid = isset($move['captSq']) ? 'x' : '-';
$pro = isset($move['promo']) ? '=' . strtolower($move['promo']) : '';
if ( isset($move['check']) )
{
if ('check' == $move['check'])
$chk = '+';
elseif ('mate' == $move['check'])
$chk = '#';
}
// if it's a castle move
if (isset($move['extra']) && 'ep' != $move['extra'])
$moves[floor($i / 2)][$i % 2] = $move['extra'] . $chk; // just display the castle notation
elseif (isset($move['extra']) && 'ep' == $move['extra']) // it's an en passant move
$moves[floor($i / 2)][$i % 2] = $sqFrom . $mid . $sqTo . 'ep' . $chk; // display it
else // it's a normal move
$moves[floor($i / 2)][$i % 2] = $sqFrom . $mid . $sqTo . $pro . $chk; // display it
}
return $moves;
}
Que puis je ajouter ou modifier pour faire en sorte que ce message warning n'apparaisse plus?