Solution found but still WIP!
RtTrackLocal2Global expects different values,
depending if it is called on a straight or on a turn.

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3289 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: c62e191e3ebe1c2fcaaeffd18882a060844d87a7
Former-commit-id: d634d5cda2e0bfbb69e2f62f92048bc08c949210
This commit is contained in:
kmetykog 2011-01-26 10:25:00 +00:00
parent 1e6a59595f
commit 7e70a796f9

View file

@ -1504,10 +1504,24 @@ void ReadTrack4(tTrack *theTrack, void *TrackHandle,
}//switch pits->side
}//if changeSeg
pits->driversPits[i].pos.seg = mSeg;
pits->driversPits[i].pos.toStart = (tdble)(toStart + pits->len / 2.0);
printf("toStart: %s %.2f ", mSeg->name, pits->driversPits[i].pos.toStart);
pits->driversPits[i].pos.type = TR_TOMIDDLE;
//TR_LPOS_MAIN; //NB: TR_LPOS_MAIN not handled by RtTrackLocal2Global!
pits->driversPits[i].pos.seg = mSeg;
//RtTrackLocal2Global expects toStart as a length in meters for straight,
//and as an angle in radian for curves
tdble pitCenter = toStart + pits->len / 2.0;
switch(mSeg->type) {
case TR_STR:
pits->driversPits[i].pos.toStart = pitCenter;
break;
case TR_LFT:
case TR_RGT:
pits->driversPits[i].pos.toStart = pitCenter / mSeg->radius;
break;
}
switch (pits->side) {
case TR_RGT:
pits->driversPits[i].pos.toRight = (tdble)(-offset - RtTrackGetWidth(curPitSeg, toStart) + pits->width / 2.0);