Index: cpp/frams/genetics/genman.cpp
===================================================================
--- cpp/frams/genetics/genman.cpp	(revision 145)
+++ cpp/frams/genetics/genman.cpp	(revision 168)
@@ -227,16 +227,16 @@
 Geno GenMan::Validate(const Geno& geny)
 {
-	char format=geny.getFormat();
-	GenoOperators *gf=getOper_f(format);
-	if (gf==NULL)
-		return Geno(SString::empty(),-1,SString::empty(),SString::sprintf("GENOPER_NOOPER: Validate(): don't know how to handle genetic format %c",format));
-	char *g2=strdup(geny.getGene()); //copy for validation
-	int res=gf->validate(g2);
-	SString sg2=g2;
+	char format = geny.getFormat();
+	GenoOperators *gf = getOper_f(format);
+	if (gf == NULL)
+		return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: Validate(): don't know how to handle genetic format %c", format));
+	char *g2 = strdup(geny.getGene()); //copy for validation
+	int res = gf->validate(g2);
+	SString sg2 = g2;
 	free(g2);
-	if (res==GENOPER_OK)
-		return Geno(sg2,format,geny.getName(),geny.getComment());
+	if (res == GENOPER_OK)
+		return Geno(sg2, format, geny.getName(), geny.getComment());
 	else
-		return Geno(SString::empty(),-1,SString::empty(),SString::sprintf("GENOPER_NOOPER: validate() for format %c returned invalid value",format));
+		return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: validate() for format %c returned invalid value", format));
 }
 
@@ -245,41 +245,45 @@
 	float chg; //how many changes
 	int method; //mutation method
-	char format=g.getFormat();
-	GenoOperators *gf=getOper_f(format);
-	if (gf==NULL)
-		return Geno(SString::empty(),-1,SString::empty(),SString::sprintf("GENOPER_NOOPER: Mutate(): don't know how to handle genetic format %c",format));
-	Geno gv=g;
-	bool canvalidate=true;
-	if (testValidity(gv,canvalidate)>0 && canvalidate==false)
-		return Geno("",-1,"","GENOPER_OPFAIL: Mutate(): cannot validate invalid source genotype");
-	bool ok=false;
-	int pcount=count;
+	char format = g.getFormat();
+	GenoOperators *gf = getOper_f(format);
+	if (gf == NULL)
+		return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: Mutate(): don't know how to handle genetic format %c", format));
+	Geno gv = g;
+	bool canvalidate = true;
+	if (testValidity(gv, canvalidate) > 0 && canvalidate == false)
+		return Geno("", -1, "", "GENOPER_OPFAIL: Mutate(): cannot validate invalid source genotype");
+	bool ok = false;
+	int pcount = count;
 	while (!ok)
 	{
-		char *gn=strdup(gv.getGene()); //copy for mutation
-		chg=0;
-		if (gf->mutate(gn,chg,method)==GENOPER_OK)
+		char *gn = strdup(gv.getGene()); //copy for mutation
+		chg = 0;
+		if (gf->mutate(gn, chg, method) == GENOPER_OK)
 		{
 			ErrorHandler eh(ErrorHandler::StoreFirstMessage); //mute testValidity()
-			Geno G(gn,gv.getFormat(),"","");
-			canvalidate=true;
-			int res=testValidity(G,canvalidate);
-			if (res==GENOPER_OK && canvalidate==false) {valid_m++; ok=true;} else
-				if (res>0 && canvalidate==false) invalid_m++; else
-				{validated_m++; ok=true;}
-				if (ok) gv=G;
-		} else failed_m++;
+			Geno G(gn, gv.getFormat(), "", "");
+			canvalidate = true;
+			int res = testValidity(G, canvalidate);
+			if (res == GENOPER_OK && canvalidate == false) { valid_m++; ok = true; }
+			else
+				if (res > 0 && canvalidate == false) invalid_m++; else
+				{
+					validated_m++; ok = true;
+				}
+			if (ok) gv = G;
+		}
+		else failed_m++;
 		free(gn);
 		count++;
-		if (!ok && (count-pcount>100))
-		{
-			FMprintf("GenMan","Mutate",2,"Tried 100x and failed: %s",(const char*)g.getGene());
-			return Geno("",-1,"","GENOPER_OPFAIL: Mutate() tried 100x and failed");
-		}
-	}
-	mutchg+=chg;
-	if (history) saveLink((const char*)g.getGene(),(const char*)gv.getGene(),chg);
+		if (!ok && (count - pcount > 100))
+		{
+			FMprintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", (const char*)g.getGene());
+			return Geno("", -1, "", "GENOPER_OPFAIL: Mutate() tried 100x and failed");
+		}
+	}
+	mutchg += chg;
+	if (history) saveLink((const char*)g.getGene(), (const char*)gv.getGene(), chg);
 	SString mutinfo;
-	if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'",100*chg,(const char*)g.getName()); else
+	if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'", 100 * chg, (const char*)g.getName()); else
 		if (extmutinfo == 1) mutinfo = SString::sprintf("%.2f%% mutation(%d) of '%s'", 100 * chg, method, (const char*)g.getName()); else
 			mutinfo = SString::sprintf("%.2f%% mutation(%s) of '%s'", 100 * chg, gf->mutation_method_names ? gf->mutation_method_names[method] : "unspecified method name", (const char*)g.getName());
@@ -320,5 +324,5 @@
 		{
 			char *gn;
-			if (g1n[0] && g2n[0]) if (randomN(2) == 0) g1n[0] = 0; else g2n[0] = 0; //we want only one
+			if (g1n[0] && g2n[0]) if (randomN(2) == 0) g1n[0] = 0; else g2n[0] = 0; //both provided? we want only one
 			if (g1n[0]) { gn = g1n; chg = chg1; }
 			else { gn = g2n; chg = chg2; }
@@ -474,8 +478,8 @@
 	int ind = operformats.find(format);
 	if (ind == -1) return NULL;
-	int ktoryopformatu = seloper[ind];
+	int which_oper_of_format = seloper[ind];
 	for (unsigned int i = 0; i < oper_fx_list.size(); i++)
 		if (oper_fx_list[i]->supported_format == format)
-			if (ktoryopformatu == 0) return oper_fx_list[i]; else ktoryopformatu--;
+			if (which_oper_of_format == 0) return oper_fx_list[i]; else which_oper_of_format--;
 	return NULL; //should never happen
 }
