Changeset 973 for cpp/frams/model
- Timestamp:
- 07/03/20 00:37:13 (5 years ago)
- Location:
- cpp/frams/model
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/autoname.cpp
r534 r973 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 15Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 11 11 SString t; 12 12 t = firstName(model); 13 SString last =lastName(model);14 if (last.len ()>0)15 13 SString last = lastName(model); 14 if (last.length() > 0) 15 { 16 16 t += ' '; 17 17 t += last; 18 18 } 19 19 return t; 20 20 } … … 42 42 unsigned int s1 = 0, s2 = 0, s3 = 0; 43 43 const char *x = g.c_str(); 44 if (*x ==0) return SString();45 for (; *x; x++) { s1 += *x; s2 = s2 **x + *x; s3 = (s3^*x) + *x; }44 if (*x == 0) return SString(); 45 for (; *x; x++) { s1 += *x; s2 = s2 * *x + *x; s3 = (s3 ^ *x) + *x; } 46 46 char* t = buf; 47 47 t = cat_syl(t, s1); … … 71 71 for (i = 0; i <= pp; i++) 72 72 { 73 p = (i*d1) / pp - 1; for (; p1 <= p; p1++) *(out++) = *(in1++);74 p = (i*d2) / pp - 1; for (; p2 <= p; p2++) *(out++) = *(in2++);73 p = (i * d1) / pp - 1; for (; p1 <= p; p1++) *(out++) = *(in1++); 74 p = (i * d2) / pp - 1; for (; p2 <= p; p2++) *(out++) = *(in2++); 75 75 } 76 76 *out = 0; … … 100 100 if (model.getPartCount() > 0) 101 101 { 102 cialo = min((int)(sqrt(double(model.getPartCount()) - 1) *NAME_BODYLEN), NAME_MAXLENBODY - 1);102 cialo = min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1); 103 103 poz = 0; 104 104 for (i = 0; i <= cialo; i++) // budowanie "opisu" ciala 105 105 { 106 nextpoz = ((model.getPartCount()) *(i + 1)) / (cialo + 1) - 1;106 nextpoz = ((model.getPartCount()) * (i + 1)) / (cialo + 1) - 1; 107 107 w = 1.0; 108 108 for (; poz <= nextpoz; poz++) w = max(w, model.getPart(poz)->mass); 109 tmpc[i] = Sp[min(int((w - 1.0) *NAME_BODYMASS), int(sizeof(Sp)) - 2)];109 tmpc[i] = Sp[min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)]; 110 110 } 111 111 tmpc[i] = 0; … … 117 117 if (model.getNeuroCount() > 0) 118 118 { 119 mozg = min((int)(sqrt((double)model.getNeuroCount()) *NAME_BRAINLEN), NAME_MAXLENBRAIN - 1);119 mozg = min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1); 120 120 poz = 0; 121 121 for (i = 0; i <= mozg; i++) // budowanie "opisu" mozgu 122 122 { 123 nextpoz = (model.getNeuroCount() *(i + 1)) / (mozg + 1) - 1;123 nextpoz = (model.getNeuroCount() * (i + 1)) / (mozg + 1) - 1; 124 124 wint = 0; 125 125 for (; poz <= nextpoz; poz++) wint = max(wint, model.getNeuro(poz)->getInputCount()); 126 tmpm[i] = Sam[min(int(wint *NAME_BRAININP), int(sizeof(Sam)) - 2)];126 tmpm[i] = Sam[min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)]; 127 127 } 128 128 tmpm[i] = 0; -
cpp/frams/model/modelparts.cpp
r952 r973 149 149 SString t; 150 150 t = getDescription(); 151 if (t.len ()) t += "\n\n";151 if (t.length()) t += "\n\n"; 152 152 t += "Characteristics:\n"; 153 153 if (getPreferredInputs()) … … 171 171 if (p.getPropCount()) 172 172 { 173 if (t.len ()) t += "\n\n";173 if (t.length()) t += "\n\n"; 174 174 t += "Properties:\n"; 175 175 const char *h; … … 341 341 { 342 342 SString ret = getClassName(); 343 if (myclassparams.len ()) { if (!ret.len()) ret = "N"; ret += ":"; ret += myclassparams; }343 if (myclassparams.length()) { if (!ret.length()) ret = "N"; ret += ":"; ret += myclassparams; } 344 344 return ret; 345 345 } … … 372 372 int Neuro::addInput(Neuro *child, double weight, const SString *info) 373 373 { 374 inputs += NInput(child, weight, (info && (info->len ())) ? new SString(*info) : 0);374 inputs += NInput(child, weight, (info && (info->length())) ? new SString(*info) : 0); 375 375 child->parentcount++; 376 376 if (child->parentcount == 1) { child->parent = this; } … … 759 759 ParamEntry entries[] = { 760 760 { "class", 2, 0, "neuro class", "s", GETSET(neuroclass) }, 761 { "liveNeuro", 2, 1, "live Neuro object", "oNeuro", GETONLY(liveNeuro) } };761 { "liveNeuro", 2, 1, "live Neuro object", "oNeuro", GETONLY(liveNeuro) } }; 762 762 #undef FIELDSTRUCT 763 for (auto& e : entries) add(&e);763 for (auto& e : entries) add(&e); 764 764 765 765 #define FIELDSTRUCT Neuro … … 804 804 { 805 805 #ifndef SDK_WITHOUT_FRAMS 806 NeuroNetImpl::getLiveNeuroObject(this, ret);806 NeuroNetImpl::getLiveNeuroObject(this, ret); 807 807 #endif 808 808 }
Note: See TracChangeset
for help on using the changeset viewer.