OpenTTD

Tasklist

FS#4154 - Transfer and Take Cargo fix

Attached to Project: OpenTTD
Opened by TruePikachu (TruePikachu) - Wednesday, 06 October 2010, 23:30 GMT
Last edited by Remko Bijker (Rubidium) - Friday, 22 October 2010, 14:32 GMT
Type Feature Request
Category Core
Status Assigned
Assigned To Igor Ybema (thehog)
Operating System All
Severity Medium
Priority Low
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Okay, I know that lots of people have been complaining about how, if they transfer cargo to a station and then load, the cargo just gets picked up again. I have a solution for it, which will patch the functionality: The vehicle should only pick up the cargo if it is not from the next station the train will go to. There are a couple reasons for this particular direction:

1. If there are only 2 orders (like transferring passengers to a huge station and taking passengers back), this will have the effect of not loading passengers who would be going back to their originating location
2. In a transfer loop (3+ stations in a loop with transfer at each - theoretical idea), cargo might be dropped off and then picked up again, but the farthest it can go is just before the original station, therefore making there be a definite flow

I will research into how exactly to impliment it, and might eventually have a patch.
This task depends upon

Comment by TruePikachu (TruePikachu) - Wednesday, 06 October 2010, 23:31 GMT
Ummm...reduce priority to "Low" please
Comment by Zdeněk Sojka (SmatZ) - Wednesday, 06 October 2010, 23:40 GMT
  • Field changed: Priority (Normal → Low)
Priority set to Low as requested.
Comment by Kogut (Kogut) - Sunday, 21 November 2010, 07:47 GMT

I think the ticket can be fixed via partial of cargodist inclusion
- cargo is in packets
- packets have sources
+ algorithm "is it allowed to load the packet of cargo on the station to the vehicle with orders"
Comment by fonsinchen (fonsinchen) - Sunday, 21 November 2010, 12:51 GMT
Actually you'd need almost all of cargodist for that. The functionality you're looking for is provided in the branch "cargomap" and that requires the branches capacities, components, demands, mcf, flowmapping-core, multimap, selfaware-stationcargo, texteff, moving-average and reservation as precondition. That is, if you don't want to see what's going on. Otherwise you'll have to merge at least one of the GUI patches, too.
Comment by Lecerf (lecerf) - Saturday, 21 May 2011, 10:21 GMT
Hello.

I have ever think about this features when I play OTTD. Indeed, the main problem of transfer is the vehicle in question is not able to do the travel back with a cargo without get back a cargo which has the same source/destination.

I have ever modified in the source code 1.1.0 (just for me, I have to make a trunk no ?) to keep from this situation.

1 - Considering the loading in a station of a "cargopacket", if its source is in the destination of the vehicle -> the "cargopacket" is not loaded.
2 - This induces a problem : when the order is "Transfer and Load" (and not waiting for full loading) one should count the waiting packet considering the destination of the vehicle.
And NOT waiting for others cargo loading whereas the cargo in station as the same source/destination -> the vehicle can go away.

In order to do that, the vehicle variable must be added in parameters of function "MoveTo". And default value is NULL when the "MoveTo" destination is a station.
In the LoadUnloadStation function, skip when there is no more cargo to add then :

if (!ge->cargo.Empty() && cap_left > 0) ........

become

if (!ge->cargo.Empty() && (cap_left > 0) && (none_recursive_count >0) ) ........

Where "none_recursive_count" is the amount of cargo which will NOT be delivered to the source station.

I don't know if I can modified and update the repository. Someone can help me about that.

The modification is not very important by I have not debug enough to ensure that there is no more default by using this way.
Comment by Igor Ybema (thehog) - Sunday, 28 August 2011, 21:36 GMT
Hi,
I managed to patch this with Lecerf's input.
It checks if the cargo that is being moved isn't from a station that is in the orderlist from the vehicle which is receiving the cargo. Also in economy.cpp it counts the total cargo that is available in that case so we don't wait at the station when there is still cargo from the vehicle's station order list.

The test savefile has two remote busstation delivering passengers to a transferium. The busses only pick passengers from that transferium which is not destinated for it's own path (order list).

Please have a look at the patch. Maybe there is some normalisation to do. This is my first time changing code in openttd.

regards, Igor
Comment by Igor Ybema (thehog) - Monday, 29 August 2011, 16:52 GMT
Here is a new patch. The first was wrong with trains and as a result trains not picking up cargo. I noticed that trains consists of multiple vehicles and only the first one has the order list (and more variable). So I had to insert some First()'s. See this new GOOD patch.

Owh btw,.. it is patched on 1.1.2

regards, Igor
Comment by Igor Ybema (thehog) - Monday, 29 August 2011, 19:08 GMT
Note however this will not fix a three-stage (or more) feeder.

In this case (for example 'bus <-> remote airport <-> remote airport <-> bus') the cargo is being constantly begin transported between both airports (if not already pickuped by a bus). That is because the planes do not have the busses stations, and so the source of the cargo, in their order list so their behaviour is not changed by this patch.
Comment by Igor Ybema (thehog) - Tuesday, 30 August 2011, 06:18 GMT
Hi,
This new patch now also works for multi-stage feeders (like a bus->airport->bus). It now utilizes 'transfer_at_xy' to check if a cargopacket has already been on the route the loading vehicle is about to take (and then don't load it).
It also creates the condition that loaded cargo can not be unloaded (by force unload or transfer) at the station it just has been pickuped from. This one was there already for final-delivery but not for unload or transfer.
Comment by Igor Ybema (thehog) - Thursday, 01 September 2011, 20:54 GMT
new patch.. much better.. patch on top of current trunk and fixes all issues (hopefully)
Comment by Igor Ybema (thehog) - Thursday, 01 September 2011, 21:44 GMT
Ok this is now hopefully the last patch (on top of the current trunk). It fixes 2 way feeding all the way to 3 stage feeding. 4 stage feeding and more would also work unless you circle cargo back in the center of the feeding process. For example 3 airports with planes only flying on 2 airports. The solution would be to circle the planes on all three airports instead of only two.

But then again,.. who uses more than 3 stage feeding :)
Comment by andythenorth (andythenorth) - Tuesday, 27 December 2016, 13:59 GMT
This is moot, CargoDist solves the problem differently ;) Should be closed.

Loading...