Skip to content

Commit 2315785

Browse files
committed
Fix percent parameters not being interpreted correctly
1 parent 895af98 commit 2315785

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Beatmap/src/BeatmapFromKSH.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,12 @@ struct MultiParamRange
198198
static MultiParam ParseParam(const String &in)
199199
{
200200
MultiParam ret;
201-
if (in.find('.') != -1)
201+
if (in.find("%") != -1)
202202
{
203203
ret.type = MultiParam::Float;
204-
sscanf(*in, "%f", &ret.fval);
204+
int percentage = 0;
205+
sscanf(*in, "%i", &percentage);
206+
ret.fval = percentage / 100.0;
205207
}
206208
else if (in.find('/') != -1)
207209
{
@@ -215,12 +217,10 @@ static MultiParam ParseParam(const String &in)
215217
ret.type = MultiParam::Samples;
216218
sscanf(*in, "%i", &ret.ival);
217219
}
218-
else if (in.find("%") != -1)
220+
else if (in.find('.') != -1)
219221
{
220222
ret.type = MultiParam::Float;
221-
int percentage = 0;
222-
sscanf(*in, "%i", &percentage);
223-
ret.fval = percentage / 100.0;
223+
sscanf(*in, "%f", &ret.fval);
224224
}
225225
else
226226
{
@@ -236,7 +236,7 @@ AudioEffect ParseCustomEffect(const KShootEffectDefinition &def, Vector<String>
236236
bool typeSet = false;
237237

238238
Map<String, MultiParamRange> params;
239-
for (auto s : def.parameters)
239+
for (const auto& s : def.parameters)
240240
{
241241
// This one is easy
242242
if (s.first == "type")

0 commit comments

Comments
 (0)