Wolf01 wrote:i tried to divide the cargo payments rate, but so a train lose more money than the profit (i had trains with negative profit which travelled for half a 1024 map, where with the normal economy a train repays itself twice in one trip)
There may be a difference between multiplying the number of days by the day length and dividing the actual profit by the day length*. That is because the function
Code: Select all
GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type)
is not inversely linear in transit_days, i.e. multiplying transit_days by x does not have to imply that the result is divided by x. If it would have been inversely linear, then it would make no difference what option you had chosen.
I would go for
Code: Select all
profit = GetTransportedGoodsIncome(num_pieces, dist, transit_days * day_length, cargo_type);
rather than
Code: Select all
profit = GetTransportedGoodsIncome(num_pieces, dist, transit_days, cargo_type) / day_length;
The first version reflects what actually should be done (namely, to compensate for the fact that the days are longer), whereas the second one is an alternative which yields fair results on first sight, but it is based on a wrong assumption (read the remarks above).
Note that for the first version, one must take care that for long day lengths and very short distances transit_days might become 0 (for instance, if you have a fast train over a short distance that drops the cargo the same day it has picked it up). You'll have to find a way to get around that problem.
*Which is equivalent to dividing the cargo payment rates by day_length.