Index: cpp/frams/genetics/f4/f4_conv.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_conv.cpp	(revision 1212)
+++ cpp/frams/genetics/f4/f4_conv.cpp	(revision 1227)
@@ -90,8 +90,8 @@
 	if (cells) delete cells;
 	cells = new f4_Cells(geno, 0);
-	if (GENOPER_OK != cells->geterror())
-	{
-		error = cells->geterror();
-		errorpos = cells->geterrorpos();
+	if (GENOPER_OK != cells->getErrorCode())
+	{
+		error = cells->getErrorCode();
+		errorpos = cells->getErrorPos();
 		//delete cells;
 		return error;
@@ -99,13 +99,13 @@
 
 	cells->simulate();
-	if (GENOPER_OK != cells->geterror())
-	{
-		error = cells->geterror();
-		errorpos = cells->geterrorpos();
+	if (GENOPER_OK != cells->getErrorCode())
+	{
+		error = cells->getErrorCode();
+		errorpos = cells->getErrorPos();
 		return error;
 	}
 
 	// reset recursive traverse flags
-	for (i = 0; i < cells->nc; i++)
+	for (i = 0; i < cells->cell_count; i++)
 		cells->C[i]->recProcessedFlag = 0;
 
@@ -114,10 +114,10 @@
 	// process every cell
 	int res;
-	for (i = 0; i < cells->nc; i++)
+	for (i = 0; i < cells->cell_count; i++)
 	{
 		res = buildModelRec(cells->C[i]);
 		if (res)
 		{
-			logMessage("f4_Model", "buildModelRec", 2, "Error in building Model");
+			logMessage("f4_Model", "buildFromF4", LOG_ERROR, "Error in building a Model");
 			error = res;
 			break;
@@ -135,18 +135,17 @@
 f4_Cell* f4_Model::getStick(f4_Cell *C)
 {
-	if (T_STICK4 == C->type) return C;
+	if (C->type == CELL_STICK) return C;
 	if (NULL != C->dadlink)
 		return getStick(C->dadlink);
 	// we have no more dadlinks, find any stick
-	for (int i = 0; i < cells->nc; i++)
-		if (cells->C[i]->type == T_STICK4)
+	for (int i = 0; i < cells->cell_count; i++)
+		if (cells->C[i]->type == CELL_STICK)
 			return cells->C[i];
 	// none!
-	logMessage("f4_Model", "getStick", 2, "Not a single stick");
+	logMessage("f4_Model", "getStick", LOG_ERROR, "Not a single stick");
 	return NULL;
 }
 
 
-/// updated by MacKo to follow new SDK standards (no more neuroitems)
 int f4_Model::buildModelRec(f4_Cell *C)
 {
@@ -164,7 +163,7 @@
 	// make sure parent is a stick
 	if (NULL != C->dadlink)
-		if (C->dadlink->type != T_STICK4)
-		{
-		C->dadlink = getStick(C->dadlink);
+		if (C->dadlink->type != CELL_STICK)
+		{
+			C->dadlink = getStick(C->dadlink);
 		}
 
@@ -179,5 +178,5 @@
 
 	range = C->genoRange;
-	if (C->type == T_STICK4)
+	if (C->type == CELL_STICK)
 	{
 		int jj_p1_refno;  // save for later
@@ -190,5 +189,5 @@
 				/*1.0/C->P.mass,*/ C->P.friction, C->P.ingestion, C->P.assimilation
 				//C->firstend.x, C->firstend.y, C->firstend.z
-				);
+			);
 			partidx = addFromString(PartType, tmpLine, &range);
 			if (partidx < 0) return -1;
@@ -207,5 +206,5 @@
 			//C->lastend.x, C->lastend.y, C->lastend.z
 			/*"vol=" 1.0/C->P.mass,*/ C->P.friction, C->P.ingestion, C->P.assimilation
-			);
+		);
 		partidx = addFromString(PartType, tmpLine, &range);
 		if (partidx < 0) return -2;
@@ -227,5 +226,5 @@
 			//C->P.ruch,   // rotstif
 			C->P.stamina
-			);
+		);
 		partidx = addFromString(JointType, tmpLine, &range);
 		if (partidx < 0) return -13;
@@ -234,5 +233,5 @@
 	}
 
-	if (C->type == T_NEURON4) ///<this case was updated by MacKo
+	if (C->type == CELL_NEURON)
 	{
 		const char* nclass = C->neuclass->name.c_str();
@@ -259,12 +258,10 @@
 			partno = C->dadlink->p2_refno;
 			if ((partno < 0) || (partno >= getPartCount())) return -21;
+
 			if (strcmp(nclass, "N") == 0)
-			{
 				sprintf(tmpLine, "p=%d,d=\"N:in=%g,fo=%g,si=%g\"", partno, C->inertia, C->force, C->sigmo);
-			}
 			else
-			{
 				sprintf(tmpLine, "p=%d,d=\"%s\"", partno, nclass);
-			}
+
 			partidx = addFromString(NeuronType, tmpLine, &range);
 			if (partidx < 0) return -22;
@@ -275,5 +272,12 @@
 		{
 			jointno = C->dadlink->joint_refno;
-			sprintf(tmpLine, "j=%d,d=\"%s\"", jointno, nclass);
+
+			if (strcmp(nclass, "@") == 0)
+				sprintf(tmpLine, "j=%d,d=\"@:p=%g\"", jointno, C->P.muscle_power);
+			else if (strcmp(nclass, "|") == 0)
+				sprintf(tmpLine, "j=%d,d=\"|:p=%g,r=%g\"", jointno, C->P.muscle_power, C->mz);
+			else
+				sprintf(tmpLine, "j=%d,d=\"%s\"", jointno, nclass);
+
 			partidx = addFromString(NeuronType, tmpLine, &range);
 			if (partidx < 0) return -32;
@@ -283,68 +287,20 @@
 		int n_refno = C->neuro_refno;
 
-		if ((strcmp(nclass,"N") == 0) && C->ctrl)
-		{
-			if (1 == C->ctrl)
-				sprintf(tmpLine, "j=%d,d=\"@:p=%g\"", C->dadlink->joint_refno, C->P.muscle_power);
-			else
-				sprintf(tmpLine, "j=%d,d=\"|:p=%g,r=%g\"", C->dadlink->joint_refno, C->P.muscle_power, C->mz);
-			partidx = addFromString(NeuronType, tmpLine, &range);
-			if (partidx < 0) return -32;
-			sprintf(tmpLine, "%d,%d", partidx, n_refno);
-			if (addFromString(NeuronConnectionType, tmpLine, &range) < 0) return -33;
-			this->checkpoint();
-		}
-
-		for (j = 0; j < C->nolink; j++)
-		{
-			if (NULL != C->links[j]->from)
-				buildModelRec(C->links[j]->from);
+		for (j = 0; j < C->conns_count; j++)
+		{
+			if (C->conns[j]->from != NULL)
+				buildModelRec(C->conns[j]->from);
 
 			tmpLine[0] = 0;
-			if (C->links[j]->from == NULL)
+			if (C->conns[j]->from == NULL)
 			{
-				const char* nclass = C->links[j]->t.c_str();
-				char* temp = (char*)C->links[j]->t.c_str();
-				NeuroClass *sensortest = GenoOperators::parseNeuroClass(temp);
-				//backward compatibility for G*TS
-				if (C->links[j]->t == "*" || C->links[j]->t == "S" || C->links[j]->t == "T")
-				{
-					partno = C->dadlink->p2_refno;
-					sprintf(tmpLine, "p=%d,d=\"%s\"", partno, nclass);
-				}
-				else if (C->links[j]->t == "G")
-				{
-					jointno = C->dadlink->joint_refno;
-					sprintf(tmpLine, "j=%d,d=\"%s\"", jointno, nclass);
-				}				
-				else if (sensortest->getPreferredLocation() == 0)
-				{
-					sprintf(tmpLine, "d=\"%s\"",nclass);
-				}
-				else if (sensortest->getPreferredLocation() == 1)
-				{
-					partno = C->dadlink->p2_refno;
-					sprintf(tmpLine, "p=%d,d=\"%s\"", partno, nclass);
-				}
-				else
-				{
-					jointno = C->dadlink->joint_refno;
-					sprintf(tmpLine, "j=%d,d=\"%s\"", jointno, nclass);
-				}
-
+				logMessage("f4_Model", "buildModelRec", LOG_ERROR, "Old code for sensors as inputs embedded in [connection]: C->conns[j]->from == NULL");
 			}
 			int from = -1;
-			if (tmpLine[0]) //input from receptor
-			{
-				from = addFromString(NeuronType, tmpLine, &range);
-				if (from < 0) return -34;
-				this->checkpoint();
-			} /*could be 'else'...*/
-
-			if (NULL != C->links[j]->from) // input from another neuron
-				from = C->links[j]->from->neuro_refno;
+			if (C->conns[j]->from != NULL) // input from another neuron
+				from = C->conns[j]->from->neuro_refno;
 			if (from >= 0)
 			{
-				sprintf(tmpLine, "%d,%d,%g", n_refno, from, C->links[j]->w);
+				sprintf(tmpLine, "%d,%d,%g", n_refno, from, C->conns[j]->weight);
 				if (addFromString(NeuronConnectionType, tmpLine, &range) < 0) return -35;
 				this->checkpoint();
