src/ldObject.cc

changeset 762
d259256e1394
parent 757
8ab9fa53142b
child 764
335d929c673e
--- a/src/ldObject.cc	Thu May 01 14:26:10 2014 +0300
+++ b/src/ldObject.cc	Sat May 03 00:36:50 2014 +0300
@@ -445,15 +445,13 @@
 //
 String LDObject::describeObjects (const LDObjectList& objs)
 {
-	bool firstDetails = true;
-	String text = "";
+	String text;
 
 	if (objs.isEmpty())
 		return "nothing"; // :)
 
-	for (long i = 0; i < ENumTypes; ++i)
+	for (Type objType = EFirstType; objType < ENumTypes; ++objType)
 	{
-		Type objType = (Type) i;
 		int count = 0;
 
 		for (LDObject * obj : objs)
@@ -463,7 +461,7 @@
 		if (count == 0)
 			continue;
 
-		if (not firstDetails)
+		if (not text.isEmpty())
 			text += ", ";
 
 		String noun = format ("%1%2", typeName (objType), plural (count));
@@ -473,7 +471,6 @@
 			noun = "vertices";
 
 		text += format ("%1 %2", count, noun);
-		firstDetails = false;
 	}
 
 	return text;

mercurial