投稿者 トピック: [111-2-2] bonus_basefactorはpay_for_total_distance=2以外では動作しない?  (参照数 3989 回)

z9999+

  • 管理人
  • 急行
  • *
  • 投稿: 381
bonus_basefactorはpay_for_total_distance=2の場合にのみ動作するのでしょうか?
pay_for_total_distanceが0または1の場合には、使用されていないようですが。

Does bonus_basefactor work only when pay_for_total_distance=2 ?
pay_for_total_distance=0 and 1 are still using old code.

I'm not sure this is intended or a bug.

simvehikel.cc:1207-
コード: [選択]
if (welt->get_settings().get_pay_for_total_distance_mode() == settings_t::TO_DESTINATION) {
// pay only the distance, we get closer to our destination
..
const sint32 grundwert128 = (ware.get_besch()->get_preis()*1000)/welt->get_settings().get_bonus_basefactor(); // bonus price will be always at least 0.128 of the real price
..
}
} else if (welt->get_settings().get_pay_for_total_distance_mode() == settings_t::TO_TRANSFER) {
// pay distance traveled to next trasnfer stop
..
const sint32 grundwert128 = ware.get_besch()->get_preis()<<7; // bonus price will be always at least 0.128 of the real price
..
}
else {
// pay distance traveled
..
const sint32 grundwert128 = ware.get_besch()->get_preis()<<7; // bonus price will be always at least 0.128 of the real price
..
}

If this is a bug, convoi detail window and goods list windowmay need to change its code, too.

convoi_detail.cc:307
コード: [選択]
const sint32 grundwert128 = v->get_fracht_typ()->get_preis()<<7;

goods_stats_t.cc:60
コード: [選択]
const sint32 grundwert128 = wtyp->get_preis()<<7;



BTW, old grundwert128 is ..
grundwert128 = ware.get_besch()->get_preis()<<7 = preis*128

new grundwert128 is ..
grundwert128 = (ware.get_besch()->get_preis()*1000)/welt->get_settings().get_bonus_basefactor() = preis*1000/125 = preise*8

The value is very different between them.
Is this code really correct ? I doubt.
« 最終編集: 2012/05/01 12:13 by z9999+ »

prissi

  • 各駅停車
  • *
  • 投稿: 45

z9999+

  • 管理人
  • 急行
  • *
  • 投稿: 381
BTW, old grundwert128 is ..
grundwert128 = ware.get_besch()->get_preis()<<7 = preis*128

new grundwert128 is ..
grundwert128 = (ware.get_besch()->get_preis()*1000)/welt->get_settings().get_bonus_basefactor() = preis*1000/125 = preise*8

The value is very different between them.
Is this code really correct ? I doubt.

No reply for this ? Which means that this fomula is correct ?

Then, default bonus_basefactor 125 can get only 0.8% of the price. It was 12.8% before.

bonus_basefactor=1 can get full price.
bonus_basefactor=2 can get half of the price.
bonus_basefactor=1000 can get 0.1% of the price.

So, we can't set the price of between 100% and 50%.
I think this fomula below is better, which allows to use more flexible value.


const sint32 grundwert128 ware.get_besch()->get_preis()*welt->get_settings().get_bonus_basefactor();


In this case.
bonus_basefactor=1000 can get full price.
bonus_basefactor=500 can get half of the price.
bonus_basefactor=1 can get 0.1% of the price.

How do you think about this ?
« 最終編集: 2012/05/04 12:10 by z9999+ »

prissi

  • 各駅停車
  • *
  • 投稿: 45
Too tired aparently ;) I only copied your code lines in all the places without going through the code.

The best way out would be probably use indeed
"ware.get_besch()->get_preis()*welt->get_settings().get_bonus_basefactor()"

Most pak do not set this value anyway, so it seems save to chaneg its calculation.