1
0
mirror of synced 2024-11-23 21:20:56 +01:00

parsers.py: Handle typos for data before first COURSE:

Fixes https://github.com/vivaria/tja2fumen/issues/70.
This commit is contained in:
Viv 2024-02-10 13:31:59 -05:00
parent 88ac7b7eac
commit d95175754d

View File

@ -5,6 +5,7 @@ Functions for parsing TJA files (.tja) and Fumen files (.bin)
import os
import re
import struct
import warnings
from copy import deepcopy
from typing import BinaryIO, Any, List, Dict, Tuple
@ -141,7 +142,11 @@ def split_tja_lines_into_courses(lines: List[str]) -> TJASong:
# Case 3: For other commands and data, simply copy as-is (parse later)
else:
parsed_tja.courses[current_course].data.append(line)
if current_course:
parsed_tja.courses[current_course].data.append(line)
else:
warnings.warn(f"Data encountered before first COURSE: "
f"'{line}' (Check for typos in TJA)")
# If a .tja has "STYLE: Double" but no "STYLE: Single", then it will be
# missing data for the "single player" chart. To fix this, we copy over