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

Line Based Loading

Started by hreintke, August 18, 2017, 10:35:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


This is a patch which implements the use of specific lines when transporting goods between halts.

Within routing the selection of used halts is dependent on the "weight" of tranport between halts.
In that process the weight is calulated is the "minimal number of hops" between two halts.

But when loading goods at a halt, any line that has the destination halt in it's schedule is used -> not only the lines which contributed to the "lowest weight"

This patch saves the lines/lineless convoys of the "lowest weight" in the connection.
When loading goods, then only these lines are used.

In the halt_detail display, for each directly connected halt, the used lines are displayed.

F.e in the line setup

Line 1 : A>B>C>D>E
Line 2 : A    >C    >E
Line 3 : A    >C
Line 4 :         C     >E

Goods from A to  B&D will use Line 1
Goods from A to C will use Line 2 &3
Goods from A to E will use line 2
Goods from B will use Line 1
Goods from C to E will use Line 2&4
Goods from C to D will use Line 1
Goods from D will use Line 1

The current implementation is
- Using the LineBasedRouting always -> needs to be an option
- Does have debugging code inlcuded
- Needs code cleanup.

Attached :
- Example sve based on pak64 which shows the feature
- Diff file based on the latest simutrans trunk

Comments welcome


The patch seems to assume that there is a unique line or convoi to realize the best connection. What if there are more?
Parsley, sage, rosemary, and maggikraut.


It takes all lines and/or lineless convoys which have the lowest weight.

In the example :
In Station A, goods to C  will be loaded on both lines 2 and 3.