James, in haltestelle::calculate_paths(), there is this conditional statement :
if(paths_timestamp[category] < welt->get_base_pathing_counter() - welt->get_einstellungen()->get_max_rerouting_interval_months()
|| welt->get_base_pathing_counter() >= (65535 - welt->get_einstellungen()->get_max_rerouting_interval_months()))
{
// List is stale. Recalculate.
// If this is false, then this is only being called to finish
// calculating paths that have not yet been calculated.
if(!open_list.empty())
{
open_list.clear();
delete[] path_nodes;
}
// Reset the timestamp.
paths_timestamp[category] = welt->get_base_pathing_counter();
}
In the 1st component of the IF condition, we should use
<= instead of just
<. For example, assuming max_rerouting_interval_months is 2, if paths_timestamp[c] is 7 and base_pathing_counter is 10, then the expression is true (7 < 10 - 2) and the IF body is executed, resetting paths_timestamp[c] to 10. It has to wait for
3 months, i.e. when base_pathing_counter = 13, before this condition will become true again (10 < 13 - 2). But according to your definition in simuconf.tab, all paths should become stale every other month.
Note : This problem happens with all similar checks between paths_timestamp[c]/connexions_timestamps[c], so please look around and make all necessary changes.
Related questions :
(1) It seems to me that both paths_timestamp(c) and connexions_timestamp(c) check against the same expression in calculate_paths() :
timestamp < base_pathing_counter - max_rerouting_interval_months
So, actually, paths and connexions become stale after the same interval? That is, both become stale every other month? This seems to be different from what is described in your simuconf.tab.
(2) Regarding this part of code from rebuild_connexions() :
connexions_timestamp[category] = welt->get_base_pathing_counter();
if(connexions_timestamp[category] == 0 || reschedule[category])
{
// Spread the load of rebuilding this with pathing - advance by half the interval.
connexions_timestamp[category] += (welt->get_einstellungen()->get_max_rerouting_interval_months() / 2);
}
I am not quite sure why you have to add 1 (= max_rerouting_interval_months / 2) to connexions_timestamp[c] even after it is set to the value of base_pathing_counter? Wouldn't that further postpone the time for next rebuild to 3 months later? Could you please explain your intention here? Many thanks in advance!