Re: Patch: fix calculation of convoi length
Reply #5 –
I dont get it. Is the routine (as it is now in trunk) wrong or not??
Actually, this is how it should be (lengths are added and divided by 16). But the reality (the movement code) is different!
At first, the last vehicle does not count, that is a train 9+8+8+X always needs the same station tiles regardless what value X has. (This can be cured by adding a 0-length wagon to each convoi.)
Second, convois driving north/west when entering a station need a halt tile more (precisely 127/256 of a tile). This is where your proposed code fails.
The result is the following:
(a) a train 8-8 needs one tile (regardless of driving direction)
(b) a train 8-8-0 needs two tiles if driving n/w, now the second wagon counts! ( I did not test this. The third wagon is behind the second (obviously), that is if driving n/w it is on the second station tile)
(c) a (road) train 4-4-4 needs one tile
(d) a (road) train 4-4-4-4 needs two tiles if driving n/w, now the second wagon counts! When driving s/e one tile suffices.
(e) the 9-8-8-X needs 3 station tiles when driving n/w