Howto apply a patch/diff file

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

Alestorm
Engineer
Engineer
Posts: 9
Joined: 18 Jul 2010 16:10

Re: Howto apply a patch/diff file

Post by Alestorm »

Hi, after long work i've finally managed to apply a patch using TortoiseSVN/Merge. I'm able to patch all the files without any problems. But now, i still have the problem how to actually play the game.
When I save the file when i have patched it and then try to play the game... nothing has changed.

If someone could help me with that I'd be very gratefull :)
dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

Re: Howto apply a patch/diff file

Post by dihedral »

the additional keyword you are looking for is 'compile' or 'compiling' - using this keyword in the tt-forums search function, or that of wiki.openttd.org will lead you to some lovely additional information :-)
Alestorm
Engineer
Engineer
Posts: 9
Joined: 18 Jul 2010 16:10

Re: Howto apply a patch/diff file

Post by Alestorm »

Thanks, but it doesn't really help me.

I've done everything it says on the Wiki. Which did nothing with the patch I've downloaded.
For that information I went to this topic. Read that windows should use TortioseSVN, so I did.
But in the explanation it says how to apply the patch, but not what to do afterwards.

All those different programms are getting me a little confused.haha.
dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

Re: Howto apply a patch/diff file

Post by dihedral »

after applying the patch you need to follow the steps on the wiki and compile.
you have the source code, you have patched the source code - now you need a binary, for that the source code must be compiled and you will in the end receive the openttd.exe in the bin/ directory of the source code you already have.
Simoneq
Engineer
Engineer
Posts: 6
Joined: 01 May 2010 11:46

Re: Howto apply a patch/diff file

Post by Simoneq »

Please have a question. I may install this patch
http://www.tt-forums.net/viewtopic.php?f=33&t=33137 but I do not know how to please simple instructions. I have no idea how to apply the patch. My English is bad simply because the very simple instructions.
beker60
Engineer
Engineer
Posts: 5
Joined: 02 May 2011 16:15

How do I install a patch

Post by beker60 »

I have been looking on the forums and found patches that I would like to test. (example: the copy&paste patch, ProgSigs). They come in diff files.
I don't know wath I must do to install the patches. I think I need to compile the game using the patches. But i'm not sure and I don't know how I will need to do this.

Thanks.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Howto apply a patch/diff file

Post by planetmaker »

You might have found this sticky... yes, you'll need to compile OpenTTD's source code. Also see the wiki for that.
DragDen
Engineer
Engineer
Posts: 1
Joined: 17 Jun 2011 06:19

Re: Howto apply a patch/diff file

Post by DragDen »

Greetings everyone.
I have a question - to apply multiple patches intended for different revisions, is this the correct way?

Code: Select all

svn update -r 16200
patch -p0 < company_info_v3_r16200.patch
svn update -r 19990
patch -p0 < buy_area_r19990.diff
svn update -r 20180
patch -p0 < more-cond-orders.r20180.patch
Or updating to new version overwrites previously applied patches?

And is there a way to revert partially applied patch (which resulted in error)? Because

Code: Select all

svn revert -r <name>
just says "Skipped <name>"
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Howto apply a patch/diff file

Post by Yexo »

Generally yes, that is the correct way. However each "svn update -r x" after applying a patch might give trouble. In that case you'll have to fix the problems manually in the source code.

If you apply patches like this there is no way to revert things only partly. If you know the patch only changes files src/a.cpp and src/b.cpp and no other patch changed those you can run "svn revert src/a.cpp src/b.cpp". If other patches modified those files too you're out of luck.
Loiner
Engineer
Engineer
Posts: 56
Joined: 28 Mar 2010 17:48

Re:

Post by Loiner »

MeusH wrote:If you're using windows, you can download TortoiseSVN, install and do the following:

Download the source files:
Make a new folder
Right click on it
Choose "SVN Checout..." from the menu
Set data fields like on attachement 1
Hit OK, wait 5-20 minutes for all files to download

Choose the diff file:
Right click on folder you've downloaded files to
Choose "TortoiseSVN > Apply Patch..." from the menu
Browse for .patch or .diff file

Apply the changes:
Usually, right clicking on filelist window (attachement 2) and clicking "Patch all" should work, but sometimes there is something wrong (attachement 2 - files marked red):

Don't worry, often application will download other revision and everything will work.
However, if you're experiencing problems (marked red) ask patch developer and tell him what's wrong. Tell him what diff file have you downloaded and what revision have you downloaded using "SVN Checkout"


Happy patching :)
I tried doing this with the infrastructure sharing patch but it's not worked...I probably did something wrong though.

What is the easiest method of patching, for someone who is completely inexperienced with this sort of thing? :)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Howto apply a patch/diff file

Post by Alberth »

That quoted text comes quite close, except that after download you should not apply any patch, but instead first build a binary from unmodified trunk sources.
That exercises the whole compiler chain, and if the built binary works, you know that parts works.

Then if you apply a patch and it breaks, you know that patching is the problem spot.


As for further assistance, we need more details than "I did something wrong."
Loiner
Engineer
Engineer
Posts: 56
Joined: 28 Mar 2010 17:48

Re: Howto apply a patch/diff file

Post by Loiner »

Alberth wrote:That quoted text comes quite close, except that after download you should not apply any patch, but instead first build a binary from unmodified trunk sources.
That exercises the whole compiler chain, and if the built binary works, you know that parts works.

Then if you apply a patch and it breaks, you know that patching is the problem spot.


As for further assistance, we need more details than "I did something wrong."
I don't know if I did, I followed everything in the quoted text but hasn't gone through so I assume I've missed something out.

Like I say, I'm completely new to this and there's just one patch I want to install, so what would be an easy method for a patching rookie like me to understand? :) How would I go about building a binary from trunk sources to install this patch?
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Howto apply a patch/diff file

Post by Alberth »

Read the wiki about downloading SVN source, installing compilers, building the binary.
You may want to join IRC, as explaining it here is way too complicated.

(Also, as I don't have Windows, I am probably not the best person to ask how to do it, others may be in a better position to help you.)
Loiner
Engineer
Engineer
Posts: 56
Joined: 28 Mar 2010 17:48

Re: Howto apply a patch/diff file

Post by Loiner »

I've just had a look through and it's all too complicated for me. :|

Doesn't TortoiseSVN do the whole thing for you? I've applied the patches, I just need to know how to get them to work.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Howto apply a patch/diff file

Post by planetmaker »

TortoiseSVN is only the tool which helps to apply patches to the source code. Which is the very first step.

But as others have said before: first compile without patches so that you confidently can say that you can build OpenTTD. Only if that succeeds it's worth to continue, and compile a patched OpenTTD.
Loiner
Engineer
Engineer
Posts: 56
Joined: 28 Mar 2010 17:48

Re: Howto apply a patch/diff file

Post by Loiner »

OK, well I've got BuildOTTD and I've followed the instructions on the Wiki but I'm unable to click 'Update and Compile'. Any ideas?

(Apologies if my n00bishness is getting annoying :wink: )
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Howto apply a patch/diff file

Post by FooBar »

What operating system? I believe BuildOTTD doesn't work on Vista or Win7, unless that changed since the last time I checked.
Loiner
Engineer
Engineer
Posts: 56
Joined: 28 Mar 2010 17:48

Re: Howto apply a patch/diff file

Post by Loiner »

I'm on Win7, so that must explain a lot.

What is the easiest method of compiling OpenTTD?
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Howto apply a patch/diff file

Post by Lord Aro »

http://wiki.openttd.org/Category:Compiling_OpenTTD

those are about your only options
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Loiner
Engineer
Engineer
Posts: 56
Joined: 28 Mar 2010 17:48

Re: Howto apply a patch/diff file

Post by Loiner »

So if I used this method:

http://wiki.openttd.org/Compiler_sur_MinGW/Fr

Would I have to do everything mentioned or just the part under 'Compiling OTTD'?

Also, is there something I should put where it says 'cd ~/<path_to_source>'?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 28 guests