_USRDLL is called a
preprocessor flag because it is used to tell the C preprocessor what to do. Let me back up a step.
When you compile the SDK's C++ code into a DLL, it goes through a four-step process:
- C preprocessor can modify the C++ (see below)
- The C++ compiler compiles .cpp files into .obj (object) files
- The linker links .obj files into a single .lib (library)
- The linker produces a .dll from the .lib
There are other minor steps (assembler) in there, but the first three are the important ones. You can think of 3 and 4 as a single step that produces two output files if you like.
The first step, the C preprocessor, uses preprocessor directives like "#ifdef" and "#define" to modify the C/C++ code before it goes to the compiler. These constructs work much like C's "if (...)" runtime construct except they operate on the source code itself rather than on the data the program is using.
"#ifdef" (pronounced pound-if-def, short for "if X is defined") allows you to control whether or not a block of code is included in the final code to be compiled based on a
flag. These flags can be defined in source code directly using "#define",
or they can be defined in the "cpp" command-line using the /D switch:
The latter method is used for _USRDLL in the makefile. If _USRDLL is not defined, the preprocessor removes all code between "#ifdef" and its matching "#endif". These matching directives work just like C's matching braces { and }.
You may be asking, "Why would you want the code guarded by _USRDLL to be removed?" Good question; I don't have an answer. For some reason, Firaxis needed to use these source files in a context where that code would break something.
As to your first question, I don't really understand it. What "problems" are you having with them? If you are getting compilation errors, it would help significantly to post them. If not, please describe what is breaking, what bad behavior your seeing, or whatever may help us help you.
That code you posted looks fine. Just make sure it's the last value defined in the enum. If both mods added new values to the same enum, make sure they all go a) after the original BTS values and b) before the NUM_XXX_TYPES value.