@@ -99,97 +99,123 @@ std::vector<ChartSection> ParseSectionsFromChart(const char *contents)
99
99
return sections;
100
100
}
101
101
102
- std::map<int , int >
103
- ParseTimeSignaturesFromChartSections (std::vector<ChartSection> sections)
102
+ std::map<int , int > ParseTimeSignaturesFromChartSection (ChartSection section)
104
103
{
105
104
auto timeSignatures = std::map<int , int >();
106
105
106
+ for (auto &line : section.lines )
107
+ {
108
+ if (line.second .front () == ToString (TypeCode::TimeSignatureMarker))
109
+ {
110
+ timeSignatures.insert (
111
+ {std::stoi (line.first ), std::stoi (line.second .at (1 ))});
112
+ }
113
+ }
114
+
115
+ return timeSignatures;
116
+ }
117
+
118
+ std::map<int , int >
119
+ ParseTimeSignaturesFromChartSections (std::vector<ChartSection> sections)
120
+ {
107
121
for (auto §ion : sections)
108
122
{
109
123
if (section.name == ToString (NamedSection::SyncTrack))
110
124
{
111
- for (auto &line : section.lines )
112
- {
113
- if (line.second .front () ==
114
- ToString (TypeCode::TimeSignatureMarker))
115
- {
116
- timeSignatures.insert (
117
- {std::stoi (line.first ), std::stoi (line.second .at (1 ))});
118
- }
119
- }
125
+ return ParseTimeSignaturesFromChartSection (section);
120
126
}
121
127
}
122
128
123
- return timeSignatures ;
129
+ return std::map< int , int >() ;
124
130
}
125
131
126
- std::map<int , int > ParseBpmFromChartSections (std::vector< ChartSection> sections )
132
+ std::map<int , int > ParseBpmFromChartSection ( ChartSection section )
127
133
{
128
134
auto bpm = std::map<int , int >();
129
135
136
+ for (auto &line : section.lines )
137
+ {
138
+ if (line.second .front () == ToString (TypeCode::BPM_Marker))
139
+ {
140
+ bpm.insert ({std::stoi (line.first ), std::stoi (line.second .at (1 ))});
141
+ }
142
+ }
143
+
144
+ return bpm;
145
+ }
146
+
147
+ std::map<int , int > ParseBpmFromChartSections (std::vector<ChartSection> sections)
148
+ {
130
149
for (auto §ion : sections)
131
150
{
132
151
if (section.name == ToString (NamedSection::SyncTrack))
133
152
{
134
- for (auto &line : section.lines )
135
- {
136
- if (line.second .front () == ToString (TypeCode::BPM_Marker))
137
- {
138
- bpm.insert (
139
- {std::stoi (line.first ), std::stoi (line.second .at (1 ))});
140
- }
141
- }
153
+ return ParseBpmFromChartSection (section);
142
154
}
143
155
}
144
156
145
- return bpm;
157
+ return std::map<int , int >();
158
+ }
159
+
160
+ std::vector<Note> ParseNotesFromChartSection (ChartSection section)
161
+ {
162
+ auto notes = std::vector<Note>();
163
+
164
+ for (auto &line : section.lines )
165
+ {
166
+ if (line.second .front () == ToString (TypeCode::NoteMarker))
167
+ {
168
+ notes.push_back ({std::stoi (line.first ),
169
+ std::stoi (line.second .at (1 )),
170
+ std::stoi (line.second .at (2 ))});
171
+ }
172
+ }
173
+
174
+ return notes;
146
175
}
147
176
148
177
std::vector<Note>
149
178
ParseNotesFromChartSections (std::vector<ChartSection> sections,
150
179
Difficulty difficulty)
151
180
{
152
- auto notes = std::vector<Note>();
153
-
154
181
for (auto §ion : sections)
155
182
{
156
183
if (section.name == ToString (difficulty) + " Single" )
157
184
{
158
- for (auto &line : section.lines )
159
- {
160
- if (line.second .front () == ToString (TypeCode::NoteMarker))
161
- {
162
- notes.push_back ({std::stoi (line.first ),
163
- std::stoi (line.second .at (1 )),
164
- std::stoi (line.second .at (2 ))});
165
- }
166
- }
185
+ return ParseNotesFromChartSection (section);
167
186
}
168
187
}
169
188
170
- return notes ;
189
+ return std::vector<Note>() ;
171
190
}
172
191
173
- std::map<int , std::string>
174
- ParseLyricsFromChartSections (std::vector<ChartSection> sections)
192
+ std::map<int , std::string> ParseLyricsFromChartSection (ChartSection section)
175
193
{
176
194
auto lyrics = std::map<int , std::string>();
177
195
196
+ for (auto &line : section.lines )
197
+ {
198
+ if (line.second .back ().rfind (" lyric" , 0 ) == 0 )
199
+ {
200
+ lyrics.insert ({std::stoi (line.first ), line.second .at (1 )});
201
+ }
202
+ }
203
+
204
+ return lyrics;
205
+ }
206
+
207
+ std::map<int , std::string>
208
+ ParseLyricsFromChartSections (std::vector<ChartSection> sections)
209
+ {
178
210
for (auto §ion : sections)
179
211
{
180
212
if (section.name == ToString (NamedSection::Events))
181
213
{
182
- for (auto &line : section.lines )
183
- {
184
- if (line.second .back ().rfind (" lyric" , 0 ) == 0 )
185
- {
186
- lyrics.insert ({std::stoi (line.first ), line.second .at (1 )});
187
- }
188
- }
214
+ return ParseLyricsFromChartSection (section);
189
215
}
190
216
}
191
217
192
- return lyrics ;
218
+ return std::map< int , std::string>() ;
193
219
}
194
220
195
221
} // namespace RhythmGameUtilities
0 commit comments