Page 28 of 40
Re: Howto apply a patch/diff file
Posted: 31 Oct 2009 10:14
by zedd
The stuff is all in the right place according to what your write.
I made a new SVN checkout and moved the patch file into trunk. (I can't use patch anywhere in cmd just where the patch.exe actually is)
I have attached screenshots of the process
EDIT: clutter screenshots removed as issue is resolved
Re: Howto apply a patch/diff file
Posted: 31 Oct 2009 20:10
by fonso
The files and folders look quite good, but your patch.exe is broken. It crashes and throws an assertion. Obviously this is not the one which will accept patches from git.
Re: Howto apply a patch/diff file
Posted: 31 Oct 2009 20:18
by petert
And if you need one, then try
MinGW and MSYS.
Re: Howto apply a patch/diff file
Posted: 31 Oct 2009 20:23
by Terkhen
Gnuwin32 patch can apply patches from git correctly (I use it for smallmap zoom out), but is very picky regarding end of line characters. To use patches created in UNIX, you must convert them to Windows format first. Any good text editor (which of course excludes Notepad) will allow you to change the EOL format to Windows: for example Notepad++.
Edit: Also you can use the Gnuwin32 version of unix2dos called u2d, that can be found at the
Cygutils package.
Code: Select all
u2d patch.diff
patch -p[0|1] -i patch.diff
Re: Howto apply a patch/diff file
Posted: 31 Oct 2009 23:16
by zedd
Terkhen wrote:unix2dos
Finally there is the problem. I should have remembered that from my 1 credit UNIX usage class at uni
Thanks a lot.
Now lets just hope this stuff compiles too...
Re: Howto apply a patch/diff file
Posted: 06 Jan 2010 18:44
by griffin71
Hi, I'm lost applying a patch.
Wiki sais:
Windows: Make sure you have TortoiseSVN installed.
Right-click on the folder with the OpenTTD source code, open the TortoiseSVN submenu and select 'Apply Patch...'. Browse to the patch file and select it. Then, right click on the 'File Patches' window and click on 'Patch All'. After you're done, close the TortoiseMerge window.
OK, so I right-click on trunk-capacities.diff
Popop menu appears, I select TortoiseSVN --> Apply patch...
The following menu appears:

- SVN menu 1
- SVN popup1.jpg (24.39 KiB) Viewed 2748 times
Then what? I cannot choose a file here, it asks for a directory.
Choosing the trunk directory, the window disappears, and I'm left with

- Mainscreen
Uhhhh... I guess I completely miss the hang of how patches are applied ::deep sigh::
Anyone, please?
Re: Howto apply a patch/diff file
Posted: 06 Jan 2010 20:01
by Yexo
griffin71 wrote:Wiki sais:
Windows: Make sure you have TortoiseSVN installed.
Right-click on the folder with the OpenTTD source code, open the TortoiseSVN submenu and select 'Apply Patch...'. Browse to the patch file and select it. Then, right click on the 'File Patches' window and click on 'Patch All'. After you're done, close the TortoiseMerge window.
Highlighted the important part for you.
OK, so I right-click on trunk-capacities.diff
That's not a folder but the patch file.
Hope this helps.
Re: Howto apply a patch/diff file
Posted: 06 Jan 2010 20:45
by petert
You can start by using a proper patch program, TortoiseSVN can't patch git patches.
Re: Howto apply a patch/diff file
Posted: 06 Jan 2010 21:21
by griffin71
Yexo, thanks. Indeed quite a stupidity of mine -- one should right-click on the directory holding the source files. Unfortunately, this won't help me in this case, see through.
Petert, thanks to you too. I hadn't noticed this, but the cargo distribution branch uses git, and SVN does not support that.
It seems that git is primarily unix based, which forces me to use an emulator. Do you have any suggestions which program running under winxp directly will apply the git-style patch?
Re: Howto apply a patch/diff file
Posted: 06 Jan 2010 21:26
by petert
See this tutorial:
http://wiki.openttd.org/MSYS#Setting_up_MinGW
Note: if you only want to patch with MinGW, you only need to follow these steps:
- Setting up MinGW
- Setting up MSYS
- Install SVN
- Testing the MinGW installation
The rest isn't really needed. After you are done, change dirs to your source "cd /c/<path_to_source>". Patch with: "patch -p1 -i <patchfile>.diff
Re: Howto apply a patch/diff file
Posted: 06 Jan 2010 21:42
by Yexo
griffin71 wrote:It seems that git is primarily unix based,
Not true, and also not relevant.
Do you have any suggestions which program running under winxp directly will apply the git-style patch?
The program "patch" will apply git patches just fine. There is a gnuwin32 patch but I think it crashes on unix newlines, so it's better to install the one from msys or cygwin (just install msys or cygwin itself). The wiki page petert linked should get you started.
Before you're trying to apply a patch, try compiling OpenTTD without any patches first. If that succeeds only then add a patch and try to compile that.
Re: Howto apply a patch/diff file
Posted: 07 Jan 2010 12:17
by griffin71
Hello again,
Thanks for the suggestions. Patching and compiling succeeded. I followed the steps Petert suggested.
I'm now much enjoying the cargodist patch.
I'm considering to develop an AI fot it.
Edit: [offtopic]Can it be that with the cargodist patch the game is significantly slower?[/offtopic]
Thanks
Re: Howto apply a patch/diff file
Posted: 07 Jan 2010 13:32
by Yexo
griffin71 wrote:Edit: [offtopic]Can it be that with the cargodist patch the game is significantly slower?[/offtopic]
That's possible, but it's just as likely that you build a debug build and not a release build. Are you compiling with msvc or with msys/cygwin? In case of msvc set the solution configuration at the top (it's a dropdown box) from "Debug" to "Release". In case of cygwin/msys you you should build a release binary by default,just don't configure with --enable-debug=x.
Re: Howto apply a patch/diff file
Posted: 08 Jan 2010 14:16
by fonso
griffin71 wrote:Edit: [offtopic]Can it be that with the cargodist patch the game is significantly slower?[/offtopic]Thanks
If Yexo's suggestions don't help, please post a report with a savegame in the cargodist thread. Slowness is a bug and I'll fix it.
Re: Howto apply a patch/diff file
Posted: 08 Jan 2010 16:57
by griffin71
Aha, thanks again.
Yesterday I found cargodist is now available for nightly 18748, so I recompiled everything (as release), and it's got the speed which is normal for my system.
I use MSVC. Why would a debug compile be much slower?
Re: Howto apply a patch/diff file
Posted: 09 Jan 2010 16:06
by petert
griffin71 wrote:I use MSVC. Why would a debug compile be much slower?
A debug build is built for debugging, not playing. It (probably) checks everything, makes logs and so-on.
Re: Howto apply a patch/diff file
Posted: 10 Jan 2010 01:12
by neob
after following
this guide,in the last step how do you make that bundle in VS2008?
installed all the required software.
got the required svn branch and the DIFF and successfully applied it.
add the aditional library's to the project as shown.
compiled, build successful, now how do i make the bundle or where is that excitable i built?
(sorry for all the questions but its been almost a decade since i touched VS last)
Re: Howto apply a patch/diff file
Posted: 10 Jan 2010 01:15
by petert
Open MSYS, type "cd <dir_of_trunk>", then type the code given at that section. The bundle will be in /bundle, so you can make a zip.
Re: Howto apply a patch/diff file
Posted: 10 Jan 2010 01:31
by neob
yes i read this part but its also says "The purpose of this article is to get the equivalent of a "make bundle" for MSVC builds. "
which implies that there is a "make bundle" option in VS itself, so if i got the full version and not the express version is it there or do i still need to get MSYS?
Re: Howto apply a patch/diff file
Posted: 10 Jan 2010 01:33
by petert
I should've rephrased that. I meant "The equivalent of a 'make bundle' for binaries created with MSVC". You will still need MSYS no matter what to obtain a bundle feature.