Thnx for moving it to the right place and thnx for the links. I have fiddled a bit with it and got it to work! It is not difficult to do, but it is tricky. Make one tiny mistake and it won't work.
I will try to explain what I have done to get it to work in a windows environment. But first 2 important things:
1. Choose your directorynames very carefully!!
Make sure there are no spaces in the names. In the wiki's that can be found it is only said that the name of the directory where you are going to place MinGW (the program you need to compile with) in should have no spaces, but all other subdirectories that will come later should have no spaces too. And here comes the important part:
If your windows username has spaces in it, you should make another account with a name that has no spaces and work from there!!!!! This is very important as MinGW will make a folder where it will put important secondary programmes with your username and if that folder has spaces in it the compiling will not work. And trying to rename that folder won't work either. So I recommend logging in to an accountname without spaces and it will work fine.
2. When trying to apply patches, look carefully for which version of OTTD they apply. Often the clue is already in the name (for example map-1M-20820.patch might only work with OTTD releasenumber 20820). Most of the times trying to apply a patch to another version will not work.
Right, lets get going.
There are 2 programs you will need to download:
- MinGW (this will apply the patch and compile OTTD) :
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20120426/-TortoiseSVN (this will enable you to download the specific version of OTTD you need for the patch) :
http://tortoisesvn.tigris.org/We'll start with MinGW first:
Follow the exact instructions as described in this Wiki:
http://wiki.openttd.org/Compiling_on_MinGWFollow all the steps in these instructions closely, pay extra attention to the setting up MSYS part, do that wrong and it wont work.
When you get to the "getting the sourcecode" part, don't follow the instructions of that Wiki, but do this:
- Download and install TortoiseSVN
- Make a new folder
- Right click on it
- Choose "SVN Checkout..." from the menu
- In the URL of Repository part, enter this:
svn://svn.openttd.org/trunk- In the Checkout Directory part, enter the location of where the repository should be downloaded to
- At the Revision part, check the Revision box and enter the revisionnumber (that is the OTTD release number to which the patch is applied)
- Hit OK, wait a few minutes for all files to download
Example (enter the versionnumber in place of the xxxxxx):
Attachment:
01.png [ 74.22 KiB | Viewed 4465 times ]
NOTE: checking the HEAD revision box will get you the latest nightly.
Before applying a patch it is recommended to compile this clean version (the source) first to check if you have followed all the steps described in the wiki correctly. If you can't compile this clean version, you should restart from scratch.
To compile follow the instructions as described in the last section of the wiki, but don't forget to copy/paste the source into your home folder (by default it is C:\MinGW\msys\1.0\home\<user_name>\<source_name>).
This is an example of the foldersetup I have:
Attachment:
02.png [ 31.74 KiB | Viewed 4465 times ]
If this all worked you should get an openttd.exe in C:\MinGW\msys\1.0\home\<user_name>\<source_name>\bin and all your settings are correct, so you are ready to apply a patch. This is fairly simple:
- Again, place an uncompiled source in your home folder
- copy/paste the patch-file in the <source_name> folder
- Start MSYS.bat
- Run:
cd C:\MinGW\msys\1.0\home\<user_name>\<source_name>Attachment:
03.png [ 19.92 KiB | Viewed 4464 times ]
- Run:
patch -p0 -i <filename> Attachment:
04.png [ 24.24 KiB | Viewed 4464 times ]
Unless it's a mercurial/git patch, in which case substitute -p0 for -p1
You can usually tell by opening the patch in a text editor, and if it has lots of a/src... and b/src then try it with -p1 instead.
Also patch will stop and complain if you've used the wrong p option.
If you get any errormessages, don't bother trying to compile and try again with another sourceversion or patchversion.
- if you didn't get errors, run:
./configure- and finally run:
makeAnd after a few minutes your freshly patched OTTD is ready