Changeset 1259 for cpp/frams/genetics/f4/f4_conv.cpp
- Timestamp:
- 06/22/23 03:52:39 (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/f4_conv.cpp
r1249 r1259 153 153 f4_Cell* f4_Model::getStick(f4_Cell *C) 154 154 { 155 if (C->type == CELL_STICK) return C;155 if (C->type == f4_Cell_type::CELL_STICK) return C; 156 156 if (NULL != C->dadlink) 157 157 return getStick(C->dadlink); 158 158 // we have no more dadlinks, find any stick 159 159 for (int i = 0; i < cells->cell_count; i++) 160 if (cells->C[i]->type == CELL_STICK)160 if (cells->C[i]->type == f4_Cell_type::CELL_STICK) 161 161 return cells->C[i]; 162 162 // none! … … 177 177 // make sure parent is a stick 178 178 if (C->dadlink != NULL) 179 if (C->dadlink->type != CELL_STICK)179 if (C->dadlink->type != f4_Cell_type::CELL_STICK) 180 180 { 181 181 C->dadlink = getStick(C->dadlink); … … 192 192 MultiRange range = C->genoRange; 193 193 194 if (C->type == CELL_STICK)194 if (C->type == f4_Cell_type::CELL_STICK) 195 195 { 196 196 int jj_p1_refno; // save for later … … 244 244 } 245 245 246 if (C->type == CELL_NEURON)246 if (C->type == f4_Cell_type::CELL_NEURON) 247 247 { 248 248 const char* nclass = C->neuclass->name.c_str(); … … 253 253 else 254 254 sprintf(tmpLine, "d=\"%s\"", nclass); 255 256 C->neuro_refno = addFromString(NeuronType, tmpLine, &range);257 if (C->neuro_refno < 0) return -22;258 this->checkpoint();259 255 } 260 256 else if (C->neuclass->getPreferredLocation() == 1) // attached to Part or have no required attachment - also part … … 264 260 265 261 sprintf(tmpLine, "p=%d,d=\"%s\"", partno, nclass); 266 267 C->neuro_refno = addFromString(NeuronType, tmpLine, &range);268 if (C->neuro_refno < 0) return -22;269 this->checkpoint();270 262 } 271 263 else // attached to Joint, assume there are only three possibilities of getPreferredLocation() … … 277 269 else if (strcmp(nclass, "|") == 0) 278 270 { 279 sprintf(tmpLine, "j=%d,d=\"|:p=%g,r=%g\"", jointno, C->P.muscle_power, C->dadlink->P.muscle_bend_range); //Macko 2023-05 change: we take muscle_bend_range from dadlink, not from C, because we also assign this neuron to C->dadlink->joint_refno. Without this, for example in /*4*/<<X><<<<X>N:|>X>X>X>X the muscle is attached to the junction with 3 sticks, but gets range=33% as in a four-stick junction. f1 correctly sets range=0.5 for the analogous phenotype: X(X[|],X(X,X,X))271 sprintf(tmpLine, "j=%d,d=\"|:p=%g,r=%g\"", jointno, C->P.muscle_power, C->dadlink->P.muscle_bend_range); //Macko 2023-05 change: we take muscle_bend_range from dadlink, not from C, because we also assign this neuron to C->dadlink->joint_refno. Without this, for example in /*4*/<<X><<<<X>N:|>X>X>X>X the muscle is attached to the junction with 3 sticks, but gets range=33% as in a four-stick junction. f1 correctly sets range=0.5 (see also conv_f1_f0_branch_muscle_range) for the analogous phenotype: X(X[|],X(X,X,X)) 280 272 } 281 273 else 282 274 sprintf(tmpLine, "j=%d,d=\"%s\"", jointno, nclass); 283 284 C->neuro_refno = addFromString(NeuronType, tmpLine, &range); 285 if (C->neuro_refno < 0) return -32; 286 this->checkpoint(); 287 } 275 } 276 277 C->neuro_refno = addFromString(NeuronType, tmpLine, &range); 278 if (C->neuro_refno < 0) return -22; 279 this->checkpoint(); 280 288 281 for (int j = 0; j < C->conns_count; j++) 289 282 {
Note: See TracChangeset
for help on using the changeset viewer.