News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

[Code v3.5] Suggestion Regarding stadt_t::step_passagiere()

Started by knightly, May 08, 2009, 07:59:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knightly

Hi James,

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



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().

jamespetts

Knightly,

thank you for the suggestion - I have implemented this in 3.6.
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.