CfgPatches
CfgPatches is a header class of an addon. Placed in Config.cpp, it contains information about requirements, content and meta data describing the addon.
If the config doesn't contain CfgPatches, it is ignored when the game is loading addons on startup.
Configuration
Most commonly, config.cpp file is placed in addon folder's root.
MyAddon\config.cpp
class CfgPatches
{
class MyAddon
{
// Meta information for editor.
name = "My Addon";
author = "Me";
url = "http://xkcd.com";
// Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game.
requiredVersion = 1.60;
// Required addons, used for setting load order.
// When any of the addons is missing, pop-up warning will appear when launching the game.
requiredAddons[] = {"A3_Functions_F"};
// List of objects (CfgVehicles classes) contained in the addon. Important also for Zeus content unlocking.
units[] = {};
// List of weapons (CfgWeapons classes) contained in the addon.
weapons[] = {};
};
};
Additional config files can be also placed in sub-folders. Even when part of the same PBO, they are treated as individual addons by the game.
To make configuration of meta data simpler, you can simply create a link to the root class instead of defining name, author and url again. A good practice is to have all configs withing one PBO to use the same meta data.
MyAddon\Weapons\config.cpp
class CfgPatches
{
class MyAddon_Weapons
{
// Use meta information from specified addon. Used to avoid repeated declarations.
addonRootClass = "MyAddon";
requiredVersion = 1.60;
requiredAddons[] = {"MyAddon"};
units[] = {};
weapons[] = {};
};
};
Scenario Design
When a designer is saving a scenario, meta data of all required addons are saved to mission.sqm as well. When someone else attempts to load the scenario without having the required addons, he will be shown a list of all addons including meta data, even though he doesn't have the addons where they're defined.