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

Logital82
Engineer
Engineer
Posts: 58
Joined: 15 Feb 2010 12:03
Location: Germany, Berlin

Re: Howto apply a patch/diff file

Post by Logital82 »

Yexo wrote:Follow either http://wiki.openttd.org/Compiling_on_MinGW or http://wiki.openttd.org/Microsoft_Visua ... s_Editions to compile the source code you got. I'd strongly recommend trying to compile a clean version of the code (without any patch applied first) so you know that works for you.
Oh my god! This looks like it is very complicated.
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 »

Logital82 wrote: First: Downloaded TortoiseSVN and installed it:
than: Downloaded source files from here: http://www.openttd.org/en/download-stable
than: extractet sourcefiles to a folder
(highlight mine)
If you use a version controly system like SVN it's stupid to first download the bundled source. Use the VCS to obtain the source via its inbuilt ability to checkout certain source revisions:

Code: Select all

then: Checkout appropriate source revision
Ezennemuljon
Engineer
Engineer
Posts: 1
Joined: 08 Nov 2011 14:25

Re: Howto apply a patch/diff file

Post by Ezennemuljon »

Can somebody make a video tutorial from patching?
donpost
Engineer
Engineer
Posts: 1
Joined: 20 Dec 2011 11:56

Re: Howto apply a patch/diff file

Post by donpost »

Hi all. I'm trying to apply the patch in the last post of this thread:

http://www.tt-forums.net/viewtopic.php?f=33&t=54332

Being on Vista 64, I have followed the instructions for using tortouiseSVN in the 4th post in this thread by MeusH.

I checked out the source code, then right clicked on the folder and chose apply patch as described. When the list of files come up they are all red. I click patch all then a lot of windows titled something like "Rejected chunks" or similar appear.

I have set up MinGW using the wiki article - and can compile the source code I have patched above with no problems. However, the patched features do not appear in game. The evidence suggests the patching process is where I have gone wrong, but I'm not sure.

Could anyone shine any light on what I am doing wrong?

Thanks in advance :)
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 »

donpost wrote: Could anyone shine any light on what I am doing wrong?
You checked out the wrong version of the source code. In principle a patch is only made for one very specific version of the source code. It may or may not work for other revisions. How well that works depends on whether the underlaying code changed.
Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: Howto apply a patch/diff file

Post by Antonio1984 »

Hi...
I have applied the extraZoom patch to the source of openttd and now I try to compile the code with Visual C++ 2008 express edition (windows 7, 64 bit), following the instructions contained in this link http://wiki.openttd.org/Microsoft_Visua ... s_Editions, except for these 2 points:

Right-click on openttd (project) -> Properties -> C/C++ -> -> General -> Additional Include Directories. Add the DirectX headers subdirectory (Usually, C:\Program Files\Microsoft DirectX SDK (August 2007)\Include)
For Win32:
Right-click on openttd (project) -> Properties -> Linker -> General -> Additional Library Directories. Add the DirectX SDK Lib subdirectory (Usually, C:\Program Files\Microsoft DirectX SDK (August 2007)\Lib\x86)

because I haven't installed DirectX SDK

But the compilation fails and I get 156 errors, all of the same type:

...
1>..\src\subsidy.cpp(29) : fatal error C1083: Cannot open include file: 'table/strings.h': No such file or directory

1>..\src\signs.cpp(19) : fatal error C1083: Cannot open include file: 'table/strings.h': No such file or directory
...

while for example these filel work
1>sprite.cpp
1>sound.cpp
1>signs.cpp

it seems a problem with the path, but I don't know how resolve the problem...any ideas???
thank you!
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Howto apply a patch/diff file

Post by Terkhen »

You need to pay attention to the output while applying the patch; you probably got a lot of rejects. You can only apply a patch against the revision it was made, if you try to apply it to other revision patching will likely fail. I also recommend you to try compiling an unpatched trunk version first to know for sure if you can compile or not.
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

Re: Howto apply a patch/diff file

Post by Eddi »

make sure you compile the whole solution, not only one subproject.
Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: Howto apply a patch/diff file

Post by Antonio1984 »

Terkhen wrote:You need to pay attention to the output while applying the patch; you probably got a lot of rejects. You can only apply a patch against the revision it was made, if you try to apply it to other revision patching will likely fail. I also recommend you to try compiling an unpatched trunk version first to know for sure if you can compile or not.
ok...and which is the way to understand which is the correct match patch/revision?
Thank you!
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Howto apply a patch/diff file

Post by Terkhen »

Most patches include the revision in their name, or at least in the post where they can be downloaded. For example, patch_r20000 applies to Subversion revision 20000 (svn up -r 20000 with console Subversion).
Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: Howto apply a patch/diff file

Post by Antonio1984 »

Ok...I've the extraZoom patch ez_r22998_full.diff so I guess it is for the revision 22998...perfect...and now?What I have to do?I use Tortoise SVN to get the source code..
Excuse me but I'm a bit confused...
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

Re: Howto apply a patch/diff file

Post by Eddi »

tortoise svn offers a "update to <revision>" option on right click.
Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: Howto apply a patch/diff file

Post by Antonio1984 »

I've specified the revision when I've done the checkout...but inspite of that, I get always a lot of "reject" during the patching..
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 »

extra-zoom patch seems to have 3 parts. It is important to apply them in the right order.

Also, it is a HG diff, which TortoiseSVN does not understand (see also http://wiki.openttd.org/FAQ_development ... a_patch.3F ).
Frank327
Engineer
Engineer
Posts: 41
Joined: 20 Nov 2007 21:08

Re: Howto apply a patch/diff file

Post by Frank327 »

I've done everything described in this thread (using windows). I've created a new folder, used TortoiseSVN for SVNcheckout. Set it to svn.openttd.org/trunk, and filled the folder. Then I updated it to the version number that was in the patch title. So then I tried to patch it, and still I get mass errors. Does it have to do with my windows version (windows 7 64 bit), or does it have something to do with the patch? I'm completely lost.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Howto apply a patch/diff file

Post by Terkhen »

Without knowing which errors you get while patching we can only guess what is happening.
iranair777
Traffic Manager
Traffic Manager
Posts: 163
Joined: 13 Apr 2007 21:18

Re: Howto apply a patch/diff file

Post by iranair777 »

Hiya all,
I've been trying to add departure boards and Timetable separation to my cargodist openttd.

I'm just wholly confused about where to start on the patching the .patch file. I've read a multitude of links and tried a few options, the most promising the TortoiseSVN as described in this link, but:
a) I don't know exactly which openttd source code (cargodist if there is one or the actual games) I have to use if there is a difference (I've tried with the games source code)

b) even with the games source code, as per the instructions, there is no apply patch in the tortoiseSVN submenu when I extract

Is the .diff file just an advanced/complete version of a .patch file? I'm just a attach and play person

I've also tried with buildottd which failed on too many levels and just don't know where to start ?(
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 »

patch and diff file are different words for the same thing. TortoiseSVN doesn't understand all kind of diff files, though. You'll need to get the proper source version a patch applies to. If you try to apply more than one patch at once, they might interfer and you'll need to know how to solve the conflicts, thus you'll need to know the programme code and decide what is right. In this context CargoDist is a pre-patched version of OpenTTD.

Patching is not a "click and play" business. I recommend you to try Chill's PatchPack.
iranair777
Traffic Manager
Traffic Manager
Posts: 163
Joined: 13 Apr 2007 21:18

Re: Howto apply a patch/diff file

Post by iranair777 »

planetmaker wrote:patch and diff file are different words for the same thing. TortoiseSVN doesn't understand all kind of diff files, though. You'll need to get the proper source version a patch applies to. If you try to apply more than one patch at once, they might interfer and you'll need to know how to solve the conflicts, thus you'll need to know the programme code and decide what is right. In this context CargoDist is a pre-patched version of OpenTTD.

Patching is not a "click and play" business. I recommend you to try Chill's PatchPack.
thanks for the reply, I guess thats my best option. was hoping to be able to carry on using the map I was playing with.
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 »

For patched builds you usually have to continue using the very same binary you started out with.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests