News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

[Code v3.5] 1/3 of Max Wait Time??

Started by knightly, May 08, 2009, 03:58:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knightly

Hi James,

May I know why in the following code from haltestelle_t::hole_ab() :

Quote

   // Skip if the goods have recently arrived, and this is not their preferred line/convoy
   // After waiting some time (1/3rd of their maximum wait), they will board anything.
   const uint16 third_minutes = base_max_minutes / 3;
   const uint16 twice_journey = connexions[tmp.get_besch()->get_catg_index()].get(tmp.get_zwischenziel()) != NULL ?
      connexions[tmp.get_besch()->get_catg_index()].get(tmp.get_zwischenziel())->journey_time * 2 : base_max_minutes;
   const uint16 max_best_minutes = third_minutes > twice_journey ? twice_journey : third_minutes;
   if(cnv != NULL && waiting_minutes <= max_best_minutes / 3)
   {
      ...


third_minutes is already 1/3 of base_max_minutes, but max_best_minutes is divided by 3 again? I ask this because in your comment, it says 1/3 of max wait time. Many thanks for your clarification.

Edited

jamespetts

#1
Ahh, thank you for spotting that - that is indeed inefficient. I can use third_minutes there instead.

Edit: Changed 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.