Consider all referenced channels instead of the used ones.

This commit is contained in:
zardoru
2015-02-05 23:04:33 -03:00
parent b78f1bcfd8
commit 597a17dd30
+14 -14
View File
@@ -195,6 +195,7 @@ public:
BMSObjects objects; BMSObjects objects;
BMSHeaders headers; BMSHeaders headers;
BMSMeasures measures; BMSMeasures measures;
map<int, bool> referencedTracks;
void TidyUpData(); void TidyUpData();
}; };
@@ -404,7 +405,7 @@ struct bmsCommandTree
evaluateNode(&root, headersOut, linesOut); evaluateNode(&root, headersOut, linesOut);
} }
void doStatement(RString statement) void doStatement(RString statement, map<int, bool> &referencedTracks)
{ {
line++; line++;
@@ -499,7 +500,14 @@ struct bmsCommandTree
('0' <= statement[5] && statement[5] <= '9') && ('0' <= statement[5] && statement[5] <= '9') &&
statement[6] == ':') statement[6] == ':')
{ {
int channel = atoi(statement.substr(4, 2).c_str());
currentNode->ChannelCommands.push_back(statement); currentNode->ChannelCommands.push_back(statement);
if ((11 <= channel && channel <= 19) || (21 <= channel && channel <= 29))
{
referencedTracks[channel] = true;
}
} }
else else
{ {
@@ -535,7 +543,7 @@ bool BMSChart::Load( const RString &chartPath )
StripCrnl(line); StripCrnl(line);
Tree.doStatement(line); Tree.doStatement(line, referencedTracks);
} }
vector<RString> lines; vector<RString> lines;
@@ -797,7 +805,7 @@ class BMSChartReader {
map<RString, int> mapValueToKeysoundIndex; map<RString, int> mapValueToKeysoundIndex;
public: public:
BMSChartReader( BMSChart *chart, Steps *steps, BMSSong *song ); BMSChartReader(BMSChart *chart, Steps *steps, BMSSong *song);
bool Read(); bool Read();
Steps *GetSteps(); Steps *GetSteps();
@@ -808,11 +816,12 @@ public:
}; };
BMSChartReader::BMSChartReader( BMSChart *chart, Steps *steps, BMSSong *bmsSong ) BMSChartReader::BMSChartReader(BMSChart *chart, Steps *steps, BMSSong *bmsSong)
{ {
this->in = chart; this->in = chart;
this->out = steps; this->out = steps;
this->song = bmsSong; this->song = bmsSong;
this->nonEmptyTracks = chart->referencedTracks;
} }
bool BMSChartReader::Read() bool BMSChartReader::Read()
@@ -903,18 +912,9 @@ void BMSChartReader::ReadHeaders()
void BMSChartReader::CalculateStepsType() void BMSChartReader::CalculateStepsType()
{ {
for( unsigned i = 0; i < in->objects.size(); i ++ )
{
BMSObject &obj = in->objects[i];
int channel = obj.channel;
if( (11 <= channel && channel <= 19) || (21 <= channel && channel <= 29) )
{
nonEmptyTracks[channel] = true;
}
}
nonEmptyTracksCount = nonEmptyTracks.size(); nonEmptyTracksCount = nonEmptyTracks.size();
out->m_StepsType = DetermineStepsType(); out->m_StepsType = DetermineStepsType();
out->m_StepsTypeStr = GAMEMAN->GetStepsTypeInfo(out->m_StepsType).szName;
} }
enum BmsRawChannel enum BmsRawChannel