848 switch (num) |
848 switch (num) |
849 { |
849 { |
850 case 0: |
850 case 0: |
851 { |
851 { |
852 // Comment |
852 // Comment |
853 String comm = line.mid (line.indexOf ("0") + 1).simplified(); |
853 String commentText (line.mid (line.indexOf ("0") + 2)); |
|
854 String commentTextSimplified (commentText.simplified()); |
854 |
855 |
855 // Handle BFC statements |
856 // Handle BFC statements |
856 if (tokens.size() > 2 && tokens[1] == "BFC") |
857 if (tokens.size() > 2 && tokens[1] == "BFC") |
857 { |
858 { |
858 for (int i = 0; i < LDBFC::NumStatements; ++i) |
859 for (int i = 0; i < LDBFC::NumStatements; ++i) |
859 if (comm == format ("BFC %1", LDBFC::k_statementStrings [i])) |
860 if (commentTextSimplified == format ("BFC %1", LDBFC::k_statementStrings [i])) |
860 return new LDBFC ( (LDBFC::Statement) i); |
861 return new LDBFC ( (LDBFC::Statement) i); |
861 |
862 |
862 // MLCAD is notorious for stuffing these statements in parts it |
863 // MLCAD is notorious for stuffing these statements in parts it |
863 // creates. The above block only handles valid statements, so we |
864 // creates. The above block only handles valid statements, so we |
864 // need to handle MLCAD-style invertnext, clip and noclip separately. |
865 // need to handle MLCAD-style invertnext, clip and noclip separately. |
865 struct |
866 struct |
866 { |
867 { |
867 String a; |
868 String a; |
868 LDBFC::Statement b; |
869 LDBFC::Statement b; |
869 } BFCData[] = |
870 } BFCData[] = |
870 { |
871 { |
871 { "INVERTNEXT", LDBFC::InvertNext }, |
872 { "INVERTNEXT", LDBFC::InvertNext }, |
872 { "NOCLIP", LDBFC::NoClip }, |
873 { "NOCLIP", LDBFC::NoClip }, |
873 { "CLIP", LDBFC::Clip } |
874 { "CLIP", LDBFC::Clip } |
874 }; |
875 }; |
875 |
876 |
876 for (const auto& i : BFCData) |
877 for (const auto& i : BFCData) |
877 if (comm == "BFC CERTIFY " + i.a) |
878 if (commentTextSimplified == "BFC CERTIFY " + i.a) |
878 return new LDBFC (i.b); |
879 return new LDBFC (i.b); |
879 } |
880 } |
880 |
881 |
881 if (tokens.size() > 2 && tokens[1] == "!LDFORGE") |
882 if (tokens.size() > 2 && tokens[1] == "!LDFORGE") |
882 { |
883 { |