First of all thank you to all of you for this nice simulator. Great work !
Now my question:
I want to implement feature "Start from pit lane", i found that cars placed on tracks in initStartingGrid (raceinit.cpp)
so what i have done:
1 swapped calls initStartingGrid and initPits in ReInitCars
2 replace this code in initStartingGrid
startpos = ReInfo->track->length - (d1 + (i / rows) * d2 + (i % rows) * d3);
tr = a + b * ((i % rows) + 1) / (rows + 1);
curseg = ReInfo->track->seg; /* last segment */
while (startpos < curseg->lgfromstart) {
curseg = curseg->prev;
}
ts = startpos - curseg->lgfromstart;
car->_trkPos.seg = curseg;
car->_trkPos.toRight = tr;
with
//later in will be a key in xml file
if (1 == 1) {
ts = car->_pit->pos.seg->lgfromstart;
car->_trkPos.seg = car->_pit->pos.seg;
car->_trkPos.toLeft = car->_pit->pos.toLeft;
car->_trkPos.toRight = car->_pit->pos.toRight;
} else {
startpos = ReInfo->track->length - (d1 + (i / rows) * d2 + (i % rows) * d3);
tr = a + b * ((i % rows) + 1) / (rows + 1);
curseg = ReInfo->track->seg; /* last segment */
while (startpos < curseg->lgfromstart) {
curseg = curseg->prev;
}
ts = startpos - curseg->lgfromstart;
car->_trkPos.seg = curseg;
car->_trkPos.toRight = tr;
}
and after that in aalborg my car (driver simplix) start from
468.442780:472.048004:10.401583 (s->cars[i]->pub.DynGCg.pos.x : s->cars[i]->pub.DynGCg.pos.y : s->cars[i]->pub.DynGCg.pos.z)
segment.id = 9
segment.name = 10 (segment name from aalborg.xml)
but when a car goes to pit it stop at
271.957123:472.596558:3.761633
segment.id = 357
segment.name = 403 (segment name from aalborg.xml)
Its seems that i have miss something but cant understand what is it
Yes i understand that answer can be found in simplix driver code
But if someone what to help me to explain why its different (i mean the meaning of that) i will be very happy
![Smile :)](./images/smilies/icon_e_smile.gif)
Thank you