News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Merge Station Tool

Started by HyperSim, January 02, 2019, 02:13:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prissi

HyperSim was correct. However, the allow_merge_distant_halt is indeed the maximum distance you can merge.

Fixed in r8762

HyperSim

Quote from: prissi 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

Thanks.

Quote from: HyperSim on May 18, 2019, 04:29:42 AMBy 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.

HyperSim

#37
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.

workcost = -welt->scale_with_month_length( (1<<distance) * welt->get_settings().cst_multiply_merge_halt );
should be
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.

INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, 0x7FFFFFFFul, gui_numberinput_t::POWER2, false );
should be something like
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 );

ACarlotti

Quote from: HyperSim on May 19, 2019, 02:30:02 PMAnd I found that line 219 in gui/settings_stats.cc was also wrong.

INIT_NUM( "allow_merge_distant_halt", sets->get_allow_merge_distant_halt(), 0, 0x7FFFFFFFul, gui_numberinput_t::POWER2, false );
should be something like
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?

prissi

The cost fix is submitted in r9763, but for the maximum distance, I go with ACarlotti

HyperSim

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.


Quote from: ACarlotti on May 19, 2019, 04:11:47 PM
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?
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.