News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Unnecessary Code in stadt_t::step_passagiere()?

Started by knightly, April 21, 2009, 08:27:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knightly

Version : R2432

I have this question on my mind for a long time. May I know whether line 1475-78 of simcity.cc inside step_passagiere() is unnecessary?

Quote

if(will_return != town_return) {
   // restore normal mail amount => more mail from attractions and factories than going to them
   pax.menge = pax_left_to_do;
}


I have checked the code below these lines for a few times and cannot find any further reference to this local object pax. In that case, should these lines be removed?

Thank you very much for your attention!

Dwachs

A wild guess would be that line 1498 should read

return_pax.menge = pax.menge;

maybe prissi can tell more
Parsley, sage, rosemary, and maggikraut.

VS

Second possibility is that pax is object whose reference is added to some system earlier and now only its values are changed... but that doesn't seem to be the case.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

prissi

I would say those are leftovers. Thank you for spotting this out. (I think there are many more such gems hidden, as usually there has been seldomly one doing code review of my code.)

z9999

I may be wrong but ...

simcity.cc:1384

int pax_left_to_do = min(7, num_pax - pax_routed);


simcity.cc:1440

pax.menge = (wtyp == warenbauer_t::passagiere ? pax_left_to_do : max(1, pax_left_to_do >> 2));


So, mail packet is always 1, isn't it ?

pax.menge = (wtyp == warenbauer_t::passagiere ? pax_left_to_do : 1);


prissi