diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/seq_compiler.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/seq_compiler.cc b/tools/seq_compiler.cc index a8a9795..8956c32 100644 --- a/tools/seq_compiler.cc +++ b/tools/seq_compiler.cc @@ -2,6 +2,7 @@ // It implements the sequence compiler tool. // Converts a text-based timeline description into C++ code. +#include <algorithm> #include <fstream> #include <iostream> #include <sstream> @@ -100,6 +101,20 @@ int main(int argc, char* argv[]) { } } + // Sort sequences by priority + std::sort(sequences.begin(), sequences.end(), + [](const SequenceEntry& a, const SequenceEntry& b) { + return std::stoi(a.priority) < std::stoi(b.priority); + }); + + // Sort effects within each sequence by priority + for (auto& seq : sequences) { + std::sort(seq.effects.begin(), seq.effects.end(), + [](const EffectEntry& a, const EffectEntry& b) { + return std::stoi(a.priority) < std::stoi(b.priority); + }); + } + std::ofstream out_file(argv[2]); if (!out_file.is_open()) { std::cerr << "Error: Could not open output file " << argv[2] << "\n"; |
