The International Simutrans Forum

Simutrans Extended => Simutrans Extended Development => Topic started by: knightly on May 08, 2009, 07:59:06 PM

Title: [Code v3.5] Suggestion Regarding stadt_t::step_passagiere()
Post by: knightly on May 08, 2009, 07:59:06 PM
Hi James,

Regarding the following part of code in stadt_t::step_passagiere() :

Code: [Select]

ITERATE(start_halts,i)
{
if(start_halts.get_count() < 1)
{
break;
}
halthandle_t current_halt = start_halts[i];
#ifdef NEW_PATHING
uint16 current_journey_time = current_halt->find_route(pax, best_journey_time);


I see that, for each ware packet, find_route() is called once per start halt. The same ziel halt list for the same ziel pos will get created each time find_route() is invoked, causing redundant efforts. While find_route() is certainly useful in cases where you only need to find the best route from a single start halt, it is not very efficient when you want to check multiple start halts against multiple ziel halts.

IMHO, find_route() can be incorporated into the iteration above, by nesting an iteration of ziel halts within. In this way, you can build the ziel list once, and you can even save the overhead of calling find_route().
Title: Re: [Code v3.5] Suggestion Regarding stadt_t::step_passagiere()
Post by: jamespetts on May 09, 2009, 03:19:25 PM
Knightly,

thank you for the suggestion - I have implemented this in 3.6.