The International Simutrans Forum

 

Author Topic: Merge Station Tool  (Read 3327 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9519
  • Languages: De,EN,JP
Re: Merge Station Tool
« Reply #35 on: May 18, 2019, 02:21:48 PM »
HyperSim was correct. However, the allow_merge_distant_halt is indeed the maximum distance you can merge.

Fixed in r8762

Offline HyperSim

  • *
  • Posts: 117
  • Languages: EN, JP
Re: Merge Station Tool
« Reply #36 on: May 18, 2019, 02:42:46 PM »
HyperSim was correct. However, the allow_merge_distant_halt is indeed the maximum distance you can merge.

Fixed in r8762

Thanks.

By the way, I also found one odd thing.
In settings window, we can change "allow_merge_distant_halt" parameter.
This should be a checkbox (like "separate_halt_capacities" parameter) but it is a number text box. (see the picture attached)
I checked source code but I cannot find out what was wrong.
I did not notice that the parameter "allow_merge_distant_halt" was changed to an int value, so forget that.

Offline HyperSim

  • *
  • Posts: 117
  • Languages: EN, JP
Re: Merge Station Tool
« Reply #37 on: May 19, 2019, 02:30:02 PM »
I checked r8762 and the merging is working.
However, when I do merging, the funds increase.  I checked the code and line 6372 and 6404 in simtool.cc were wrong.

Code: [Select]
workcost = -welt->scale_with_month_length( (1<<distance) * welt->get_settings().cst_multiply_merge_halt );should be
Code: [Select]
workcost = welt->scale_with_month_length( (1<<distance) * welt->get_settings().cst_multiply_merge_halt );
That was originaly my mistake, sorry.


And I found that line 219 in gui/settings_stats.cc was also wrong.

Code: [Select]
INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, 0x7FFFFFFFul, gui_numberinput_t::POWER2, false );should be something like
Code: [Select]
INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, max( welt->get_size().x , welt->get_size().y ), gui_numberinput_t::AUTOLINEAR, false );
« Last Edit: May 19, 2019, 02:40:05 PM by HyperSim »

Offline ACarlotti

  • *
  • Posts: 478
Re: Merge Station Tool
« Reply #38 on: May 19, 2019, 04:11:47 PM »
And I found that line 219 in gui/settings_stats.cc was also wrong.

Code: [Select]
INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, 0x7FFFFFFFul, gui_numberinput_t::POWER2, false );should be something like
Code: [Select]
INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, max( welt->get_size().x , welt->get_size().y ), gui_numberinput_t::AUTOLINEAR, false );

That change looks wrong to me - I don't see why you would want to constrain the value of a setting by the current dimensions of the current map. What happens if that map is subsequently enlarged? Also, what happens if a new (larger) map is created/loaded?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9519
  • Languages: De,EN,JP
Re: Merge Station Tool
« Reply #39 on: May 21, 2019, 05:28:10 AM »
The cost fix is submitted in r9763, but for the maximum distance, I go with ACarlotti

Offline HyperSim

  • *
  • Posts: 117
  • Languages: EN, JP
Re: Merge Station Tool
« Reply #40 on: June 09, 2019, 05:01:31 PM »
I've found another bug related this patch.
It has already reported in this topic.
https://forum.simutrans.com/index.php/topic,19018.msg180203.html#msg180203

This problem is caused by overflowing of "cent" (koord) in "recalc_basis_pos()" in simhalt.cc.
I attached .diff file to solve the problem.


That change looks wrong to me - I don't see why you would want to constrain the value of a setting by the current dimensions of the current map. What happens if that map is subsequently enlarged? Also, what happens if a new (larger) map is created/loaded?

That is true, I agree.  Then, this is better?
Code: [Select]
INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, 10000, gui_numberinput_t::AUTOLINEAR, false );Anyway, "gui_numberinput_t::POWER2" is definitely wrong and it should be fixed.