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

maxentropy
Engineer
Engineer
Posts: 4
Joined: 04 Jul 2008 11:30

Re: Howto apply a patch/diff file

Post by maxentropy »

Hi,

I'm learning how to use TortoiseSVN using MeusH's instructions on page 1. I have followed the steps to 'Checkout SVN' and I am trying to apply PhilSophious' realistic timetables patch using right-click->TortoiseSVN->Apply patch. I select 'patch all' as in attachment 2 at which point TortoiseMerge loads up and displays two columns, 'source.list: original' and source.list: patched.' What do I do now in order to play OpenTTD with the patch applied?

I have previously used BuildOTTD and after pressing 'Update and Compile' a build of the patched game would appear in 'My OTTD Builds.' Does TortoiseSVN have an equivalent feature?

I hope that this is clear and would appreciate any advice you can offer.

Thanks
User avatar
tigerface
Engineer
Engineer
Posts: 93
Joined: 01 Jan 2007 17:29

Re: Howto apply a patch/diff file

Post by tigerface »

What are you using to compile? TortoiseSVN won't do that.
Formerly thanet-bomber.
maxentropy
Engineer
Engineer
Posts: 4
Joined: 04 Jul 2008 11:30

Re: Howto apply a patch/diff file

Post by maxentropy »

Ah, a compiler would help!

Anyway, installed Cygwin and successfully followed the wiki to the end of step 12, with no problems (as far as I can tell). I decided to start with a clean, unpatched version of the source code.

However, when I type 'run openttd.exe' into Cygwin (or indeed just double-click the icon in the binaries folder) the program loads up with the normal title in the window bar (OpenTTD rxxxxx) but it then freezes and I am left with just a black screen (sometimes with the OpenTTD mouse pointer) before the dreaded 'not responding' Windows dialogue box appears. The original TTD data files and Cygwin files are in place.

To check it wasn't some sort of bug in the latest nightly, I changed the revision using TortoiseSVN to the last revision I compiled using BuildOTTD - still no functioning binary. Also, my BuildOTTD binaries still work.

Any suggestions on what might be the problem?

Thanks for your help
User avatar
wojteks86
Traffic Manager
Traffic Manager
Posts: 159
Joined: 30 Dec 2006 23:26
Location: Ruda Slaska[PL]

Re: Howto apply a patch/diff file

Post by wojteks86 »

Code: Select all

make
gives an error after compiling, see screenshot
what i was trying to do is to implement new_oil.patch
there was no errors after previous commands
no openttd.exe created
any ideas?
Attachments
make error.PNG
make error.PNG (23.07 KiB) Viewed 2463 times
Regards,
Wojtek
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4765
Joined: 09 Sep 2007 05:03
Location: home

Re: Howto apply a patch/diff file

Post by Alberth »

You've got a C++ compiler error, according to the report, _reachable_tracks is used, but does not exist.
Do the revision numbers of 'trunk' and the 'new_oil.patch' match?
User avatar
wojteks86
Traffic Manager
Traffic Manager
Posts: 159
Joined: 30 Dec 2006 23:26
Location: Ruda Slaska[PL]

Re: Howto apply a patch/diff file

Post by wojteks86 »

what does that mean and how to do it? :shock: im a noob
Regards,
Wojtek
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4765
Joined: 09 Sep 2007 05:03
Location: home

Re: Howto apply a patch/diff file

Post by Alberth »

Unlike what you may think, there is not one set of source files to build OpenTTD, there are over 14000 of them. Each time on of the devs makes a change in trunk (where you copied your source files from with SVN or TortoiseSVN), we get a new set of files. In order not to get confused, each set of source files is given a number, the so called revision number.
You can ask the number from your trunk directory by typing 'svnversion' in your /home/Administrator/trunk directory.

A patch is a description of what lines must be changed (and how) in a set of files in order to make the patch work. Since with each revision, the source files are different, a patch is always made against against a specific revision, and this number is known as the patch revision number.

The only guaranteed working way to apply a patch is to use the same set of sources as were used to create the patch. In other words, you need to get the patch revision number of new_oil.patch, and get that exact same set of sources (with eg 'svn update -r', see the end of the BuildOTTD thread) before you can apply the patch.

Alternatively, you can try to update the patch to a newer revision, but you need C++ knowledge to do that.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Howto apply a patch/diff file

Post by DaleStan »

Alberth wrote:the only guaranteed working way
Inasmuch as anything released under the GPL is either warranted or guaranteed to anything at all.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
wojteks86
Traffic Manager
Traffic Manager
Posts: 159
Joined: 30 Dec 2006 23:26
Location: Ruda Slaska[PL]

Re: Howto apply a patch/diff file

Post by wojteks86 »

I dont really understand it (not the language but instructions)
I think I will give up for now :) and enjoy stable 0.6.3 :)
Regards,
Wojtek
XxInNOutxX
Engineer
Engineer
Posts: 61
Joined: 20 Oct 2008 12:50

Re: Howto apply a patch/diff file

Post by XxInNOutxX »

Just a quick qn, once i patch the source files... how do i play it?
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 »

XxInNOutxX wrote:Just a quick qn, once i patch the source files... how do i play it?
you compile it

After having successfully compiled you can start your binary the usual way.
XxInNOutxX
Engineer
Engineer
Posts: 61
Joined: 20 Oct 2008 12:50

Re: Howto apply a patch/diff file

Post by XxInNOutxX »

How do u compile then? BuildOTTD doesnt work :(
User avatar
Lilman424
Tycoon
Tycoon
Posts: 2743
Joined: 20 Oct 2002 14:55
Location: Georgia
Contact:

Re: Howto apply a patch/diff file

Post by Lilman424 »

by using a compiler?
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction. - Albert Einstein
XxInNOutxX
Engineer
Engineer
Posts: 61
Joined: 20 Oct 2008 12:50

Re: Howto apply a patch/diff file

Post by XxInNOutxX »

I have tried cygwin and all sorts of compilers, but they give all sorts of errors and are too complicated. Pls help :(
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 »

XxInNOutxX wrote:I have tried cygwin and all sorts of compilers, but they give all sorts of errors and are too complicated. Pls help :(
You may notice that we can help, if you have a specific error.

But going here and stating "doesn't work" simply won't get you anywhere and is likely to give no helpful response as simply it cannot be given. Especially if you come with an attitude of "I think it's compilicated" showing no effort of your part to solve your problem with your computer. Why should we do your work?

General guidelines on how to install and setup compilers are sufficiently around in the net and in this very sticky topic. Yes, it may require you to do some reading. Yes, it may not be everything quite straight forward. Yes, may not even be a piece of cake. But also yes, our crystal balls are broken.

Enough of this rant now.

So, please, if you tell us what you tried on which system and where exactly what error exactly happend. That's fine and we might be able to give a hint.
XxInNOutxX
Engineer
Engineer
Posts: 61
Joined: 20 Oct 2008 12:50

Re: Howto apply a patch/diff file

Post by XxInNOutxX »

Quote from cygwin article from openttd wiki "Now you need to launch Cygwin, so use the start menu icon or run cygwin.bat in C:\cygwin. You then need to move to the folder where the source is, so type cd /usr/src/openttd/trunk."

This is the step that confused me.
What error does it indicate?
Attachments
cgywin.JPG
cgywin.JPG (126.09 KiB) Viewed 1141 times
Last edited by XxInNOutxX on 27 Oct 2008 09:52, edited 1 time in total.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Howto apply a patch/diff file

Post by Rubidium »

XxInNOutxX wrote:What error does it indicate?
That either your space bar is broken or that you haven't exactly (character-by-character) copied what was written you should type.
XxInNOutxX
Engineer
Engineer
Posts: 61
Joined: 20 Oct 2008 12:50

Re: Howto apply a patch/diff file

Post by XxInNOutxX »

hmm there are spaces to be put in?

Edit: uploaded a new picture with correct words typed in.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Howto apply a patch/diff file

Post by Yexo »

XxInNOutxX wrote:Quote from cygwin article from openttd wiki "Now you need to launch Cygwin, so use the start menu icon or run cygwin.bat in C:\cygwin. You then need to move to the folder where the source is, so type cd_space_/usr/src/openttd/trunk."?
XxInNOutxX
Engineer
Engineer
Posts: 61
Joined: 20 Oct 2008 12:50

Re: Howto apply a patch/diff file

Post by XxInNOutxX »

Doesnt work for me still getting the same error. Wait, do i have to get the source FIRST before doing this?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 19 guests