- simplified the code handling bfc statements a bit

Mon, 28 Apr 2014 17:59:20 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 28 Apr 2014 17:59:20 +0300
changeset 747
17a854ef4412
parent 746
893c43b337dd
child 748
8d4a9d03e246

- simplified the code handling bfc statements a bit

src/ldDocument.cc file | annotate | diff | comparison | revisions
--- a/src/ldDocument.cc	Mon Apr 28 17:56:51 2014 +0300
+++ b/src/ldDocument.cc	Mon Apr 28 17:59:20 2014 +0300
@@ -858,25 +858,17 @@
 				{
 					for (int i = 0; i < LDBFC::NumStatements; ++i)
 						if (commentTextSimplified == format ("BFC %1", LDBFC::k_statementStrings [i]))
-							return new LDBFC ( (LDBFC::Statement) i);
+							return new LDBFC ((LDBFC::Statement) i);
 
 					// MLCAD is notorious for stuffing these statements in parts it
 					// creates. The above block only handles valid statements, so we
 					// need to handle MLCAD-style invertnext, clip and noclip separately.
-					struct
-					{
-						String				a;
-						LDBFC::Statement	b;
-					} BFCData[] =
-					{
-						{ "INVERTNEXT", LDBFC::InvertNext },
-						{ "NOCLIP", LDBFC::NoClip },
-						{ "CLIP", LDBFC::Clip }
-					};
-
-					for (const auto& i : BFCData)
-						if (commentTextSimplified == "BFC CERTIFY " + i.a)
-							return new LDBFC (i.b);
+					if (commentTextSimplified == "BFC CERTIFY INVERTNEXT")
+						return new LDBFC (LDBFC::InvertNext);
+					elif (commentTextSimplified == "BFC CERTIFY CLIP")
+						return new LDBFC (LDBFC::Clip);
+					elif (commentTextSimplified == "BFC CERTIFY NOCLIP")
+						return new LDBFC (LDBFC::NoClip);
 				}
 
 				if (tokens.size() > 2 && tokens[1] == "!LDFORGE")

mercurial