/** * This comes from the XXXX303.dat file ($data) * As far as I know, the format of this file is: * round number, match number, player 1 number, player 2 number, player 1 wins, player 2 wins, draws * * match number is 0 when there wasn't a Nth match that round */ function dci3makematches($event, $data, $regmap) { $event = new Event($_POST['name']); $result = array(); $lines = explode_dcir_lines($data); foreach ($lines as $line) { $table = explode(",", $line); $roundnum = $table[0]; $matchnum = $table[1]; $playeranum = $table[2]; $playerbnum = $table[3]; $playerawins = $table[4]; $playerbwins = $table[5]; if ($matchnum == 0) { continue; } if ($playerawins > $playerbwins) { $res = 'A'; } else { if ($playerawins < $playerbwins) { $res = 'B'; } else { $res = 'D'; } } $event->addMatch($regmap[$playeranum], $regmap[$playerbnum], $roundnum, $res, $playerawins, $playerbwins); } $event->assignTropiesFromMatches(); }