The base price is given, and the bonus % mean how much is that affected by vehicle maximal speed / bonus speed ratio.

Assuming bonus speed is 80 km/h and your vehicle does exactly 80, there is no difference in price, regardless of bonus %.

If bonus % are set to 0, you always get the same fee regardless of speed.

Or in different words. If one leaves out the various modes of payment that depend on how exactly is determined "distance", this remains for the simplest mode:

`const sint32 ref_speed = welt->get_average_speed( get_besch()->get_waytype() );`

const sint32 speed_base = (100*speed_to_kmh(cnv->get_min_top_speed()))/ref_speed-100;

// pay distance traveled

const long dist = koord_distance( start, end );

while( iter.next() ) {

const ware_t & ware = iter.get_current();

if(ware.menge==0 || !ware.get_zwischenziel().is_bound()) {

continue;

}

// now only use the real gain in difference for the revenue (may as well be negative!)

const sint32 grundwert128 = ware.get_besch()->get_preis()<<7; // bonus price will be always at least 0.128 of the real price

const sint32 grundwert_bonus = (ware.get_besch()->get_preis()*(1000+speed_base*ware.get_besch()->get_speed_bonus()));

const sint64 price = (sint64)(grundwert128>grundwert_bonus ? grundwert128 : grundwert_bonus) * (sint64)dist * (sint64)ware.menge;

// sum up new price

value += price;

// Hajo: Rounded value, in cents

// prissi: Why on earth 1/3???

return (value+1500ll)/3000ll;

OK, so what exactly are we looking at?

(The distance taken here is from last station, so it's the same for all items.)

`const sint32 ref_speed = welt->get_average_speed( get_besch()->get_waytype() );`

Just a complicated way of saying "gimme the bonus speed against which I will be compared"

`const sint32 speed_base = (100*speed_to_kmh(cnv->get_min_top_speed()))/ref_speed-100;`

My speed rating is: 100 * (my maximal speed / bonus speed) - 100 ; units are km/h

`const long dist = koord_distance( start, end );`

Calculate distance; how many tiles traveled

`while( iter.next() ) {`

const ware_t & ware = iter.get_current();

cycle through all loaded goods

`if(ware.menge==0 || !ware.get_zwischenziel().is_bound()) {`

continue;

}

skip items that are for some reason invalid

`const sint32 grundwert128 = ware.get_besch()->get_preis()<<7`

Lowest revenue per tile is 128 * goods' worth (later divided by 1000 so 0.128)

`const sint32 grundwert_bonus = (ware.get_besch()->get_preis()*(1000+speed_base*ware.get_besch()->get_speed_bonus()));`

Standard revenue per tile is 1000 + (my speed rating * my bonus %)

`const sint64 price = (sint64)(grundwert128>grundwert_bonus ? grundwert128 : grundwert_bonus) * (sint64)dist * (sint64)ware.menge;`

Take the one of the two revenues which is higher. Income from this particular pile of loaded goods is that * distance * quantity of goods

`value += price;`

Total income is sum of all incomes.

`return (value+1500ll)/3000ll;`

The final number that shows in finances is the (total income + 1500) / 3000

Aside: for the protesters, these not-11-but-LL-s at end of numbers make the literal evaluate explicitly as long long (aka sint32). I did have to look this up...