Skip to main content
Topic: recalc_status() calls in haltestelle_t::step() (Read 1994 times) previous topic - next topic

recalc_status() calls in haltestelle_t::step()

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

 

Re: recalc_status() calls in haltestelle_t::step()

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