The International Simutrans Forum


Author Topic: [Code v3.5] Suggestion Regarding stadt_t::step_passagiere()  (Read 2016 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Hi James,

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

Code: [Select]

if(start_halts.get_count() < 1)
halthandle_t current_halt = start_halts[i];
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().

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [Code v3.5] Suggestion Regarding stadt_t::step_passagiere()
« Reply #1 on: May 09, 2009, 03:19:25 PM »

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