The cfgPatches class

triggered by the -F switch on the command line, this option is ignored if -N (wysiwig) specified.

cfgPatches is the most important class you can have in your addon. It may well be the only class in your config.cpp, but it must be there.

It outweighs the relative trivia of configuring your tank, machine gun or car.

All config.cpp's must contain this class so that your addon (pbo) can be identified by the game engine.

class cfgPatches
{
    class MyGreatAddon // identifies this addon to the engine. The name of your pbo has no meaning at all.
    {
        units[]={...};            // identifies cfgVehicles classes that can be used in the editor. (scope=2)
        weapons[]={...};    // identifies cfgWeapons classes that can be used in the editor.
        requiredAddons[]={...};
    };

//optional


    class OldAddonName // used when you change your mind what your addon is called but need to maintain compatibility with what you've
    {                                      // already published and which existing mission.sqm's will look for.
        ...
    };
};

the dll will automatically fill in units and weapons for you.

requiredAddons

This array is possibly the least understood and overlooked element of addon construction. It has two, equally important, but fundamentally different uses.

  1. The addons listed are checked for existence. Normally you will get either 'white' textures or crash to desktops if the addon(s) you rely on aren't actually there in-game. Stating them here prevents crashes because the engine wont even try an load your addon.

    The dll automatically adds to this array addons you need (via checking on the p:drive)

     

  2. extern class statements must come from some other addon. It is a classic error to not mention them, The engine ensures that the addon they come from loads before yours, thus ensuring you have no conflicts with the class you wanted to inherit. The list of errors that occur when you don't do this is too many to mention

The dll will attempt to find these classes for you.