Re: The meaning of life minus one
Reply #7 –
Prissi,
I am aware of the saving/loading position: I have created a special separate system for versioning Simutrans-Experimental saved games that gives a specific Simutrans-Experimental version in addition to the normal version, and I have made sure that the timings and average speeds are indeed loaded and saved.
I am not quite clear on what you mean by "the last speed between halts" here. What I am currently planning to do is something very similar to the present system, where the distance and average speed is calculated for each hop.
Thank you for the suggestion for using the number in route_t - 1; I shall try that and see whether that works better (with the above formula, the speeds all seem far too low). One advantage of using a system of Manhattan distance divided by time, however, is that the lesser number of steps in a diagonal tile would seem to be counterbalanced by the fact of using the Manhattan distance, which would not be true of the route distance. Also, using route_t - 1 would seem not to create a sufficient incentive to create direct routes.
Edit: I have now found a formula that works effectively:
const double journey_time = (welt->get_zeit_ms() - last_departure_time) / 4096;
// Manhattan distance
const uint32 journey_distance = abs(fahr[0]->get_pos().get_2d().x - fahr[0]->last_stop_pos.x) + abs(fahr[0]->get_pos().get_2d().y - fahr[0]->last_stop_pos.y);
const uint16 average_speed = (journey_distance / journey_time) * 20;