News:

SimuTranslator
Make Simutrans speak your language.

recalc_status() calls in haltestelle_t::step()

Started by knightly, November 25, 2009, 11:26:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knightly

Hi Prissi,


Quote
bool haltestelle_t::step(sint16 &units_remaining)
{
//   DBG_MESSAGE("haltestelle_t::step()","%s (cnt %i)",get_name(),reroute_counter);
   if(rebuilt_destination_counter!=welt->get_schedule_counter()) {
      // schedule has changed ...
      status_step = RESCHEDULING;
      units_remaining -= (rebuild_destinations()/256)+2;
   }
   else if(reroute_counter!=welt->get_schedule_counter()) {
      // all new connection updated => recalc routes
      status_step = REROUTING;
      if(  !reroute_goods(units_remaining)  ) {
         return false;
      }
      recalc_status();
   }
   else {
      // nothing needs to be done
      status_step = 0;
      units_remaining = 0;
   }
   // only update needed after monthly change: really slow, but does not matter at all
   recalc_status();
   return true;
}

May I know why there are 2 calls to recalc_status()? During rerouting, if rerouting of the current halt is complete instead of partial, recalc_status() will be called twice. Is there any particular reason for this?


Knightly

prissi

Checked in in the middle of code change. The scond can go completely.