News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[Bug v6.2] Tolerance Values

Started by knightly, August 06, 2009, 08:08:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knightly

James,

From what I learnt from your comments in get_average_waiting_time() and add_connexion() of haltestelle_t, waiting time and journey time are calculated and stored in *tenths* of minute, right?

If that is the case, the following tolerance values should be multiplied by 10, as your simuconf.tab comment states that they are expressed in minutes :

Quote
min_local_tolerance = contents.get_int("min_local_tolerance", min_local_tolerance);
max_local_tolerance = contents.get_int("max_local_tolerance", max_local_tolerance) - min_local_tolerance;
min_midrange_tolerance = contents.get_int("min_midrange_tolerance", min_midrange_tolerance);
max_midrange_tolerance = contents.get_int("max_midrange_tolerance", max_midrange_tolerance) - min_midrange_tolerance;
min_longdistance_tolerance = contents.get_int("min_longdistance_tolerance", min_longdistance_tolerance);
max_longdistance_tolerance = contents.get_int("max_longdistance_tolerance", max_longdistance_tolerance) - min_longdistance_tolerance;

Otherwise, when you compare tolerance level against journey time of the returned path, your comparison will be wrong.


Edit :

There is actually another problem with the above code. You have subtracted max from min before saving it to the max variables. It is not wrong to precalculate the difference between max and min, but you have to change the names of the internal variables and getter functions to reflect the fact that they are no longer the maximum, but the difference between max and min. Otherwise, it would be misleading to other developers. Remember, the code you write will be read and used by others, and thus please keep your code unconfusing, consistent, readable and easily understandable.

Knightly

jamespetts

Knightly,

thank you for this (and your other work). Apologies for not replying sooner on this and other mattesr: I have been busy at work and also, in Simutrans time, with fine-tuning the physics and settings for Pak128.Britain. I thought that I'd reply to this one quickly, though, to let you know that I have both implemented your suggested change (thank you for spotting that bug) and had already spotted the other bug that you identify in  your edit, and fixed that, too, which fix will be available in version 6.3.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

knightly

Thank you very much for the changes! ;)