Parsing out clock %clk comments

This commit is contained in:
DHTMLGoodies
2017-01-30 13:42:28 +01:00
parent d17e42e7da
commit 5505a28b1d
5 changed files with 68 additions and 1 deletions

View File

@@ -45,6 +45,15 @@ class MoveBuilder {
return;
}
$index = count($this->moveReferences[$this->pointer])-1;
if(strstr($comment,'[%clk' )){
$clk = preg_replace('/\[%clk[^0-9]*?([0-9\:]+?)[\]]/si', '$1', $comment);
$comment = str_replace('[%clk ' . $clk . ']', '', $comment);
$this->moveReferences[$this->pointer][$index][CHESS_JSON::MOVE_CLOCK] = $clk;
}
if(empty($comment))return;
$this->moveReferences[$this->pointer][$index][CHESS_JSON::MOVE_COMMENT] = $comment;
}