Changeset 720 for cpp/frams/model
- Timestamp:
- 01/14/18 11:24:22 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/model.cpp
r660 r720 407 407 SString mod_props; 408 408 modelparam.select(this); 409 modelparam.save 2(mod_props, handle_defaults ? &defaultmodel : NULL, true, !handle_defaults);409 modelparam.saveSingleLine(mod_props, handle_defaults ? &defaultmodel : NULL, true, !handle_defaults); 410 410 if (mod_props.len() > 1) //are there any non-default values? ("\n" is empty) 411 411 { … … 419 419 len = gen.len(); 420 420 gen += "p:"; 421 partparam.save 2(gen, handle_defaults ? &defaultpart : NULL, true, !handle_defaults);421 partparam.saveSingleLine(gen, handle_defaults ? &defaultpart : NULL, true, !handle_defaults); 422 422 if (map) 423 423 map->add(len, gen.len() - 1, partToMap(i)); … … 429 429 jointparam.setParamTab(j->usedelta ? f0_joint_paramtab : f0_nodeltajoint_paramtab); 430 430 gen += "j:"; 431 jointparam.save 2(gen, handle_defaults ? &defaultjoint : NULL, true, !handle_defaults);431 jointparam.saveSingleLine(gen, handle_defaults ? &defaultjoint : NULL, true, !handle_defaults); 432 432 if (map) 433 433 map->add(len, gen.len() - 1, jointToMap(i)); … … 438 438 len = gen.len(); 439 439 gen += "n:"; 440 neuroparam.save 2(gen, handle_defaults ? &defaultneuro : NULL, true, !handle_defaults);440 neuroparam.saveSingleLine(gen, handle_defaults ? &defaultneuro : NULL, true, !handle_defaults); 441 441 if (map) 442 442 map->add(len, gen.len() - 1, neuroToMap(i)); … … 469 469 len = gen.len(); 470 470 gen += "c:"; 471 connparam.save 2(gen, handle_defaults ? &defaultconn : NULL, true, !handle_defaults);471 connparam.saveSingleLine(gen, handle_defaults ? &defaultconn : NULL, true, !handle_defaults); 472 472 if (map) 473 473 map->add(len, gen.len() - 1, neuroToMap(n->refno)); … … 582 582 { 583 583 error_message = SString::empty(); 584 int pos = 0; const char*t = line.c_str(); 585 for (; *t; t++, pos++) 584 const char*t = line.c_str(); 585 ParamInterface::LoadOptions opts; 586 for (; *t; t++, opts.offset++) 586 587 if (!strchr(" \r\t", *t)) break; 587 588 if (*t == '#') return 0; … … 592 593 Part *p = new Part(); 593 594 partparam.select(p); 594 pos += 2; 595 if (partparam.load2(line, pos) & ParamInterface::LOAD2_PARSE_FAILED) { delete p; error_message = "Invalid 'p:'"; return -1; } 595 opts.offset += 2; 596 partparam.load(ParamInterface::FormatSingleLine, line, &opts); 597 if (opts.parse_failed) { delete p; error_message = "Invalid 'p:'"; return -1; } 596 598 p->o.rotate(p->rot); 597 599 parts += p; … … 604 606 Param modelparam(f0_model_paramtab); 605 607 modelparam.select(this); 606 pos += 2; 607 if (modelparam.load2(line, pos) & ParamInterface::LOAD2_PARSE_FAILED) { error_message = "Invalid 'm:'"; return -1; } 608 opts.offset += 2; 609 modelparam.load(ParamInterface::FormatSingleLine, line, &opts); 610 if (opts.parse_failed) { error_message = "Invalid 'm:'"; return -1; } 608 611 return 0; 609 612 } … … 613 616 Joint *j = new Joint(); 614 617 jointparam.select(j); 615 pos+= 2;618 opts.offset += 2; 616 619 j->owner = this; 617 if (jointparam.load2(line, pos) & ParamInterface::LOAD2_PARSE_FAILED) { delete j; error_message = "Invalid 'j:'"; return -1; } 620 jointparam.load(ParamInterface::FormatSingleLine, line, &opts); 621 if (opts.parse_failed) { delete j; error_message = "Invalid 'j:'"; return -1; } 618 622 bool p1_ok = false, p2_ok = false; 619 623 if ((p1_ok = ((j->p1_refno >= 0) && (j->p1_refno < getPartCount()))) && … … 642 646 Neuro *nu = new Neuro(); 643 647 neuroparam.select(nu); 644 pos += 2; 645 if (neuroparam.load2(line, pos) & ParamInterface::LOAD2_PARSE_FAILED) { delete nu; error_message = "Invalid 'n:'"; return -1; } 648 opts.offset += 2; 649 neuroparam.load(ParamInterface::FormatSingleLine, line, &opts); 650 if (opts.parse_failed) { delete nu; error_message = "Invalid 'n:'"; return -1; } 646 651 #ifdef MODEL_V1_COMPATIBLE 647 652 if (nu->neuro_refno>=0) // parent specified... … … 718 723 NeuroConn c; 719 724 ncparam.select(&c); 720 pos += 2; 721 if (ncparam.load2(line, pos) & ParamInterface::LOAD2_PARSE_FAILED) { error_message = "Invalid 'c:'"; return -1; } 725 opts.offset += 2; 726 ncparam.load(ParamInterface::FormatSingleLine, line, &opts); 727 if (opts.parse_failed) { error_message = "Invalid 'c:'"; return -1; } 722 728 bool n1_ok = false, n2_ok = false; 723 729 if ((n1_ok = ((c.n1_refno >= 0) && (c.n1_refno < getNeuroCount()))) … … 741 747 Neuro *nu=new Neuro(); 742 748 neuroitemparam.select(nu); 743 pos+=3; 744 if (neuroitemparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) {delete nu; return -1;} 749 opts.offset+=3; 750 neuroitemparam.loadSingleLine(line,opts); 751 if (opts.parse_failed) {delete nu; return -1;} 745 752 // illegal parent? 746 753 if ((nu->neuro_refno<0)||(nu->neuro_refno>=old_getNeuroCount()))
Note: See TracChangeset
for help on using the changeset viewer.