"Compiling" converts a set of source code to a binary executable. If you run that executable, you get the behaviour as specified in the source code.
"Patching" changes (some of the) source code. To get the changes in an executable, you must again "compile" the (modified) source code.
There are several different ways to create a patch file, and these differences cause that you sometimes must use p0 and sometimes you must use p1 when applying the file to the source code (ie, "patching" above).
To see, open the patch file (it's a plain text file, wordpad, notepad++, or any other plain texteditor will work), and look for likes like
These must be applied with '-p0'
Other files may have
(there is an additional "a/" and "b/" there) These must be applied with "-p1"
The digit is the number of directory levels to discard, In the first example the number of directory levels is correct, so you don't want to throw anything away, in the second example, you want to throw the "a/" and "b/" levels out, so it's -p1.
The generally recommended order to do things
1. Get unmodified source code of OpenTTD
2. Setup Compiler
3. Compile source code to OpenTTD program, and check if it works
# Here you established that the compiler setup is sane, and can produce working programs
4. Patch the source code
5. Compile modified source code to get modified OpenTTD program, and check if it works.
Being a retired OpenTTD developer does not mean I know what I am doing.