Skip to content

Commit

Permalink
Fix percent parameters not being interpreted correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ASleepyCat committed May 12, 2021
1 parent 895af98 commit 2315785
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Beatmap/src/BeatmapFromKSH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,12 @@ struct MultiParamRange
static MultiParam ParseParam(const String &in)
{
MultiParam ret;
if (in.find('.') != -1)
if (in.find("%") != -1)
{
ret.type = MultiParam::Float;
sscanf(*in, "%f", &ret.fval);
int percentage = 0;
sscanf(*in, "%i", &percentage);
ret.fval = percentage / 100.0;
}
else if (in.find('/') != -1)
{
Expand All @@ -215,12 +217,10 @@ static MultiParam ParseParam(const String &in)
ret.type = MultiParam::Samples;
sscanf(*in, "%i", &ret.ival);
}
else if (in.find("%") != -1)
else if (in.find('.') != -1)
{
ret.type = MultiParam::Float;
int percentage = 0;
sscanf(*in, "%i", &percentage);
ret.fval = percentage / 100.0;
sscanf(*in, "%f", &ret.fval);
}
else
{
Expand All @@ -236,7 +236,7 @@ AudioEffect ParseCustomEffect(const KShootEffectDefinition &def, Vector<String>
bool typeSet = false;

Map<String, MultiParamRange> params;
for (auto s : def.parameters)
for (const auto& s : def.parameters)
{
// This one is easy
if (s.first == "type")
Expand Down

0 comments on commit 2315785

Please sign in to comment.