if(!track) // XXX Probably unnecessary
return 0;
- BlockIter block = track.block_iter();
- if(&*block==until_block)
+ if(&track->get_block()==until_block)
return 0;
// Account for the vehicle's offset on its current track
result = track->get_type().get_path_length(track->get_active_path())-result;
result -= veh.get_type().get_length()/2;
+ BlockIter block = track.block_iter();
+
// Count remaining distance in the vehicle's current block
for(track=track.next(); &track->get_block()==&*block; track=track.next())
result += track->get_type().get_path_length(track->get_active_path());