Y. Wang: 1
Add API to get wagons at a specific position
2 files changed, 31 insertions(+), 0 deletions(-)
Hi,
yes, generally this is the right way to do. However you need to be
careful because the index does not necessarily match the real position
(an index of 1 can be a distance greater than 1)
Since I have some time today, I added such a function in 283efc4. You
should be able to use it right away.
Regards,
orwell
Hi again,
Just noticed you added a patch here an hour ago... Which means we were
working in parallel.
My remark still holds though, and I believe my implementation is
correct.
Agreed. I put together that patch based on reading some existing code
and my (limited) knowledge of the path system.
Anyway, I wrote that function as an auxiliary function for
occ.get_wagon_at(pos) since Maverick2797 wanted to get the wagon at a
speicific position; the idea is to use occ.get_trains_at(pos) and remap
the returned table to wagons (instead of trains).
A function to return a _single_ wagon at the position should IMO not be
necessary as a occ.get_trains_at(pos)-like function would allow you to
get it using next(occ.get_wagons_at(pos)).
Regards,
orwell