for (methi=0; methi<n_meths; methi++)
if (meths[methi] == meth) goto found_method;
/* need a new method */
- methi= ++n_meths;
- if (methi >= EVAL_MAX_METHODS) return EC_MovFeatTooManyMethods;
+ methi= n_meths++;
+ if (methi >= EVAL_MAX_METHODS) {
+ DPRINTF2(" MovFeatTooManyMethods methi=%d\n",methi);
+ return EC_MovFeatTooManyMethods;
+ }
meths[methi]= meth;
n_motions[methi]= 0;
DPRINTF2(" meths[%d]=%s", methi,meth->pname);
found_method:;
- int motioni= ++n_motions[methi];
- if (motioni >= EVAL_MAX_MOTIONS) return EC_MovFeatTooManyMotions;
+ int motioni= n_motions[methi]++;
+ if (motioni >= EVAL_MAX_MOTIONS) {
+ DPRINTF2(" MovFeatTooManyMotions motioni=%d\n",motioni);
+ return EC_MovFeatTooManyMotions;
+ }
DPRINTF2(" motion[%d][%d]=%s%d", methi, motioni, feati->pname,posn);
motions[methi][motioni].i= feati;
motions[methi][motioni].posn= posn;
if (indep_r) {
DPRINTF2(" alloc");
indep= mmalloc(sizeof(*indep) + sizeof(Change*) * n_meths);
- memset(indep->changes, 0, sizeof(Change*) * n_meths);
indep->move= move;
indep->actual= startpoint;
indep->target= target;
+ indep->n_changes= n_meths;
+ memset(indep->changes, 0, sizeof(Change*) * n_meths);
}
DPRINTF2("\n");
Change *chg= indep->changes[changei];
chg->meth= meth;
chg->indep= indep;
+ chg->installed= 0;
}
totalcost += thiscost;
}