Way to not stop at station if train is full of cargo?

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
legitalk
Engineer
Engineer
Posts: 1
Joined: 04 Aug 2023 13:44

Way to not stop at station if train is full of cargo?

Post by legitalk »

Is there any way to set this up, when really long train has orders to go to couple stations (f.e. forests) and then final destination (f. e. paper mill) to do not stop at that forest stations, if is already full of cargo (wood)? I mean, there is no other empty wagons, so there is no reason to stop at that station and just go through to the final station (paper mill).
User avatar
kamnet
Moderator
Moderator
Posts: 8594
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Way to not stop at station if train is full of cargo?

Post by kamnet »

Use conditional orders. https://wiki.openttd.org/en/Manual/Conditional%20Orders

1: Go non-stop to Station A (Load if available)
2: Jump to order 4 when Load percentage is equal to 100.
3: Go non-stop to Station B (Load if available)
4: Go non-stop to Station C (Unload)
skc
Traffic Manager
Traffic Manager
Posts: 177
Joined: 17 Sep 2022 02:02

Re: Way to not stop at station if train is full of cargo?

Post by skc »

Yep - Conditional orders are what you're looking for.
Find them in the orders' screen, by clicking and holding on the bottom-right button
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Way to not stop at station if train is full of cargo?

Post by ebla71 »

kamnet wrote: 04 Aug 2023 15:37 Use conditional orders. https://wiki.openttd.org/en/Manual/Conditional%20Orders

1: Go non-stop to Station A (Load if available)
2: Jump to order 4 when Load percentage is equal to 100.
3: Go non-stop to Station B (Load if available)
4: Go non-stop to Station C (Unload)
With the question of orders in regard to loading up: There is still no way to just fill a part of the cargo capacity of a train, right?

Say a train has a capacity of 100 units (whatever that is) for a certain cargo - what I really would like to do is:

1: go to Station A and load up to 50 units of a particular cargo (leaving at least 50 units capacity for that cargo empty)
2: go to Station B and load up to 50 units of a particular cargo
3: go to Station C and unload all cargo

Same the other way round - say a train has loaded 100 units of a certain cargo:

1: go to Station B and unload 50 units of cargo
2: go to Station A and unload 50 units of cargo

Both would be neat to fill up or unload a train one by one during multiple stops.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Way to not stop at station if train is full of cargo?

Post by Eddi »

ebla71 wrote: 04 Aug 2023 15:581: go to Station A and load up to 50 units of a particular cargo (leaving at least 50 units capacity for that cargo empty)
[...]
1: go to Station B and unload 50 units of cargo
no, that is not possible.
User avatar
odisseus
Director
Director
Posts: 568
Joined: 01 Nov 2017 21:19

Re: Way to not stop at station if train is full of cargo?

Post by odisseus »

legitalk wrote: 04 Aug 2023 13:47 Is there any way to set this up, when really long train has orders to go to couple stations (f.e. forests) and then final destination (f. e. paper mill) to do not stop at that forest stations, if is already full of cargo (wood)? I mean, there is no other empty wagons, so there is no reason to stop at that station and just go through to the final station (paper mill).
I cannot but point out that this is a typical newbie mistake. If you don't pick up cargo from further stations down the line, their rating will drop, which in turn will cause a drop in production. Eventually you'll remain with one or two industries in the beginning of the circuit, while the rest will decline and eventually close down.

To keep up the station rating and make the production increase, make sure that there is always a train waiting for full load at each industry. If your industries are still small but you want to have a big delivery train, set up feeder services with shorter trains.
openttd-1-fs8.png
openttd-1-fs8.png (11.98 KiB) Viewed 1860 times
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Way to not stop at station if train is full of cargo?

Post by ebla71 »

Eddi wrote: 04 Aug 2023 18:43
ebla71 wrote: 04 Aug 2023 15:581: go to Station A and load up to 50 units of a particular cargo (leaving at least 50 units capacity for that cargo empty)
[...]
1: go to Station B and unload 50 units of cargo
no, that is not possible.
Does somebody have a link to the part of the source code where the conditional orders are handled for me or at least the name of the file that does that?

I would like to take a look but lack a general overview of the overall code structure.
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Way to not stop at station if train is full of cargo?

Post by ebla71 »

2TallTyler wrote: 05 Aug 2023 12:59 Should be order_cmd.cpp.

https://github.com/OpenTTD/OpenTTD/blob ... er_cmd.cpp
Thank you very much for pointing to the source code.

It's the switch block in the ProcessConditionalOrder() function that determines which conditional orders are available, right?

I roughly understand what it is doing but unfortunately I'm mostly a "Python person" ...
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Way to not stop at station if train is full of cargo?

Post by Eddi »

the problem with "only load 50%" orders is that the conditional orders are only evaluated AFTER loading finished.
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 507
Joined: 11 Aug 2019 18:15
Contact:

Re: Way to not stop at station if train is full of cargo?

Post by 2TallTyler »

C++ is not quite as simple as Python. :wink:

I have not delved into orders recently, but conditional order types are defined in this header file and assigned to orders in various places in order_gui.cpp: https://github.com/OpenTTD/OpenTTD/blob ... er_gui.cpp

The best way to explore is is probably to check out the OpenTTD repository and open it in something like Visual Studio, where you can follow links between files, see references, etc., using IntelliSense or its equivalent. Instructions for this are in the official Contributing guide, which also contains links to the Compiling guide and other resources.
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Way to not stop at station if train is full of cargo?

Post by ebla71 »

2TallTyler wrote: 06 Aug 2023 15:12 C++ is not quite as simple as Python. :wink:
I know - that's why in a professional context I only prototype in Python and then a "real" software developer re-codes my gibberish in C++ 8)
2TallTyler wrote: 06 Aug 2023 15:12 I have not delved into orders recently, but conditional order types are defined in this header file and assigned to orders in various places in order_gui.cpp: https://github.com/OpenTTD/OpenTTD/blob ... er_gui.cpp
Thank you very much for the insight - already found the definition and learnt that the assignment and evaluation of orders are handled by some different pieces of code.

Not as simple as thought - contributions will possibly have to wait until my retirement, which is still a couple of decades down the road 8)
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 507
Joined: 11 Aug 2019 18:15
Contact:

Re: Way to not stop at station if train is full of cargo?

Post by 2TallTyler »

For what it's worth, I learned C++ to contribute to OpenTTD with little formal training. Start simple and work your way up to more complex changes.
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Way to not stop at station if train is full of cargo?

Post by ebla71 »

2TallTyler wrote: 07 Aug 2023 10:17 For what it's worth, I learned C++ to contribute to OpenTTD with little formal training. Start simple and work your way up to more complex changes.
The main problem, as always with such projects, is time besides family and a regular job ... plus program or play?
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Way to not stop at station if train is full of cargo?

Post by Eddi »

as a rule of thumb: if you start programming on a game, you will never play that game again :p
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: Bing [Bot] and 17 guests