Bug 177 Patch: Feeder Transfer @ accepting

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
PandaMojo
Engineer
Engineer
Posts: 21
Joined: 04 May 2006 04:42

Bug 177 Patch: Feeder Transfer @ accepting

Post by PandaMojo »

Bug 177 Patch: Feeder Transfer @ accepting
(Massively Edited Post)

Seems to be Bug #177 - patch uploaded as a comment there.
EDIT: Maedhros seems to be working on a similar/overlapping/conflicting patch here that sounds less hackerish and may deal with this as well.

Bug Reproduction Steps:

Station in question must accept the good, and be used as the feeder dropoff point as well (I used buses dropping off passengers). The station must have 0 of the good when the dropoff occurs, and have a loading train waiting. This appears to first load the goods onto the waiting train, then immediately resell approximately that portion (1 or 2 cabins worth) of that good to the station instead of keeping it loaded.

Cause:

Since the station is empty when the feeder unloads, the dropped of cargo mantains it's original station id instead of having it's ID changed to the current one. I presume this means this ID is assigned to any/all cars loading the cargo (each passenger box counts as a seperate vehicle?), thus causing all those cars to immediately unload their cargo at this station in the next tick.

Patched solution:

Fixed the unload conditional, and after the first tick update current_order.flags to include OF_FULL_LOAD and OF_TRANSFER if it included either (unless it also included OF_UNLOAD).
Attachments
Slartfingfield Transport, 18th Jun 1952.sav
Watch Train #2 cargo in detail as buses unload. It will never finish filling :(
(231.87 KiB) Downloaded 139 times
Last edited by PandaMojo on 20 Aug 2006 08:09, edited 3 times in total.
User avatar
gkirilov
Chief Executive
Chief Executive
Posts: 696
Joined: 03 May 2005 09:32
Location: Othala

Post by gkirilov »

The bug on Flyspray concerns only passengers.
The train takes the passengers delivered by the buses(with the transer-and-leave-empty) and does not keep them but makes a profit at the same station without even leaving it (because the station accepts pass.). If the station does not accept passengers everything is ok - the train can be fully loaded.
OTTDCoop NewGRF Pack|Different sets of GRFs for TTDPatch (some of them work in OTTD) - 1|- 2|GRF sets for OTTD|OTTD nightly
Image
I hooked up my accelerator to my brake lights. I hit the gas, people behind me stop, and I'm gone.
Understeer is when you hit the wall with the front of the car. Oversteer is when you hit the wall with the rear of the car. Horsepower is how fast you hit the wall. Torque is how far you take the wall with you. Spoilers and bodykits are how much of the wall you take with you. Rollcages and windownets are how much of a mess you leave on the wall.
PandaMojo
Engineer
Engineer
Posts: 21
Joined: 04 May 2006 04:42

Post by PandaMojo »

gkirilov wrote:The bug on Flyspray concerns only passengers.
The train takes the passengers delivered by the buses(with the transer-and-leave-empty) and does not keep them but makes a profit at the same station without even leaving it (because the station accepts pass.). If the station does not accept passengers everything is ok - the train can be fully loaded.
I only noticed it with passengers, originally, since I don't typically build feeder services to a station by an industry they could be dropped off at anyways. Instead, I feed to another industry producing the same good - which is synonymous with the former only for passengers. I'm extrapolating the behavior to other cargo types on conjecture alone, actually. I'm guessing the original bug report was based off the observed behavior which only seemed reproducable with passengers :-).

I seem to have patched this bug in a 3rd manner I hadn't thought of by adding to economy.c @ 1411-1412:

Code: Select all

		/* don't unload goods that we picked up */
		if (u->current_order.flags & OF_FULL_LOAD) u->current_order.flags |= OF_TRANSFER;
After testing it, it seems to fix the problem with no ill effects. Someone more knowledgable about OpenTTD's workings should probably sanity check this, though. I'll try and get a .patch file made and upload it here.

EDIT: Patched against SVN trunk and uploaded - testing
EDIT: Whoops, got "get it compiling" project changes in there too I think - will reupload after I figure out ignoring specific files in SVN and test
EDIT: Tested against Flyspray savegame, causes looping transfer messages for a bit. Trying to find the cause :S
PandaMojo
Engineer
Engineer
Posts: 21
Joined: 04 May 2006 04:42

Post by PandaMojo »

Finally fixed. Patched against SVN and tested. Should still probably be sanity checked by someone with a clue still :lol:

Will upload to first post.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests