Unless I am terribly misunderstanding something, there is a potentially serious bug in void fabrik_t::update_scaled_mail_demand() and void fabrik_t::update_scaled_pax_demand() in simfab.cc - lines 359 and 385 are as follows:
arrival_stats_pax.set_scaled_demand( pax_demand );
and
arrival_stats_mail.set_scaled_demand( mail_demand );
whereas, if I have understood this correctly, they should be:
arrival_stats_pax.set_scaled_demand( scaled_pax_demand );
and
arrival_stats_mail.set_scaled_demand( scaled_pax_demand );
This has the effect that the mail and passenger demand shown in the graphs (and, I think, used elsewhere, although I have not specifically checked yet) is not scaled based on the number of bits_per_month. I don't think that this is intended, is it? Or have I misunderstood something? At best, the code is confusing, since the method names are "set_scaled_demand", yet the unscaled version of the variables are passed to them. If this is intended, the methods should probably be renamed to "set_demand" or "set_base_demand" or somesuch.
scaled_x_demand is sometimes used elsewhere, sometimes arrival_stats...scaled_demand. Not sure myself.
Quote from: jamespetts on September 05, 2013, 12:08:24 AM
This has the effect that the mail and passenger demand shown in the graphs (and, I think, used elsewhere, although I have not specifically checked yet) is not scaled based on the number of bits_per_month. I don't think that this is intended, is it? Or have I misunderstood something?
This is intended and not a bug. Arrival statistics are processed based on
fixed period length -- i.e. with respect to bits_per_month = 18, unscaled with respect to time.
Quote from: jamespetts on September 05, 2013, 12:08:24 AMAt best, the code is confusing, since the method names are "set_scaled_demand", yet the unscaled version of the variables are passed to them. If this is intended, the methods should probably be renamed to "set_demand" or "set_base_demand" or somesuch.
Not confusing at all, given that the demand is already scaled by current production base. Only that it's
not scaled by bits_per_month.
Morelook, thanks for having one more look :)
Ahh, thank you for clarifying that. It might be helpful to explain this in a code comment, since it has the superficial appearance of a bug when looking through the code.