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 );