Skip to content

Commit

Permalink
Merge pull request #1598 from CBATeam/subconfig-macro
Browse files Browse the repository at this point in the history
Add subcomponent support to macros
  • Loading branch information
PabstMirror committed Sep 9, 2023
2 parents 0796c26 + 8d326dd commit eab161e
Show file tree
Hide file tree
Showing 23 changed files with 133 additions and 96 deletions.
4 changes: 2 additions & 2 deletions addons/jam/jam_finish/config.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = ECSTRING(jam,component);
class SUBADDON {
name = CSTRING(component);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
Expand Down
5 changes: 2 additions & 3 deletions addons/jam/jam_finish/script_component.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#define COMPONENT jam_finish
#include "\x\cba\addons\main\script_mod.hpp"
#include "\x\cba\addons\main\script_macros.hpp"
#define SUBCOMPONENT finish
#include "\x\cba\addons\jam\script_component.hpp"
4 changes: 2 additions & 2 deletions addons/jr/jr_prep/config.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = ECSTRING(jr,component);
class SUBADDON {
name = CSTRING(component);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
Expand Down
5 changes: 2 additions & 3 deletions addons/jr/jr_prep/script_component.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#define COMPONENT jr_prep
#include "\x\cba\addons\main\script_mod.hpp"
#include "\x\cba\addons\main\script_macros.hpp"
#define SUBCOMPONENT prep
#include "\x\cba\addons\jr\script_component.hpp"
10 changes: 9 additions & 1 deletion addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Provide a solid structure that can be dynamic and easy editable (Which sometimes means we cannot adhere to Aim #1 ;-)
An example is the path that is built from defines. Some available in this file, others in mods and addons.
Follows Standard:
Follows Standard:
Object variables: PREFIX_COMPONENT
Main-object variables: PREFIX_main
Paths: MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\SCRIPTNAME.sqf
Expand All @@ -29,6 +29,10 @@
and include your mod's script_macros.hpp
In your scripts you can then include the addon's component.hpp with relative path)
use in subcomponents (subconfigs)
define SUBCOMPONENT and include parent component's script_component.hpp
currently only supported by SUBADDON, additional macros may be added in the future
TODO:
- Try only to use 1 string type " vs '
- Evaluate double functions, and simplification
Expand All @@ -54,6 +58,10 @@
#define ADDON DOUBLES(PREFIX,COMPONENT)
#define MAIN_ADDON DOUBLES(PREFIX,main)

#ifdef SUBCOMPONENT
#define SUBADDON DOUBLES(ADDON,SUBCOMPONENT)
#endif

/* -------------------------------------------
Macro: VERSION_CONFIG
Define CBA Versioning System config entries.
Expand Down
4 changes: 3 additions & 1 deletion addons/ui/ui_helper/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "script_component.hpp"

class CfgPatches {
class cba_ui_helper {
class SUBADDON {
requiredAddons[] = {"cba_ui"};
units[] = {};
};
Expand Down
2 changes: 2 additions & 0 deletions addons/ui/ui_helper/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SUBCOMPONENT helper
#include "\x\cba\addons\ui\script_component.hpp"
4 changes: 3 additions & 1 deletion addons/xeh/xeh_a3/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "script_component.hpp"

class CfgPatches {
class cba_xeh_a3 {
class SUBADDON {
requiredAddons[] = {"cba_xeh"};
units[] = {};
};
Expand Down
2 changes: 2 additions & 0 deletions addons/xeh/xeh_a3/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SUBCOMPONENT a3
#include "\x\cba\addons\xeh\script_component.hpp"
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
#include "\x\cba\addons\xeh\script_component.hpp"
#undef COMPONENT
#define COMPONENT xeh_compat_contact

class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "cba_xeh", "A3_Data_F_Contact" };
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
VERSION_CONFIG;
// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};
class XEH_CLASS_BASE;

class CfgVehicles {
class B_W_Soldier_F;
class B_W_Story_Protagonist_01_F: B_W_Soldier_F {
Expand Down
23 changes: 23 additions & 0 deletions addons/xeh/xeh_contact/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"

class CfgPatches {
class SUBADDON {
name = CSTRING(component);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"cba_xeh", "A3_Data_F_Contact"};
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
authors[] = {"PabstMirror"};
url = "$STR_CBA_URL";
VERSION_CONFIG;

// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};

class XEH_CLASS_BASE;

#include "CfgVehicles.hpp"
2 changes: 2 additions & 0 deletions addons/xeh/xeh_contact/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SUBCOMPONENT contact
#include "\x\cba\addons\xeh\script_component.hpp"
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
#include "\x\cba\addons\xeh\script_component.hpp"
#undef COMPONENT
#define COMPONENT xeh_compat_csla

class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "cba_xeh", "CSLA", "US85" };
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
VERSION_CONFIG;
// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};
class XEH_CLASS_BASE;

class CfgVehicles {
class StaticATWeapon;
class CSLA_9K113_Stat: StaticATWeapon {
Expand Down
23 changes: 23 additions & 0 deletions addons/xeh/xeh_csla/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"

class CfgPatches {
class SUBADDON {
name = CSTRING(component);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"cba_xeh", "CSLA", "US85"};
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
authors[] = {"Dahlgren"};
url = "$STR_CBA_URL";
VERSION_CONFIG;

// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};

class XEH_CLASS_BASE;

#include "CfgVehicles.hpp"
2 changes: 2 additions & 0 deletions addons/xeh/xeh_csla/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SUBCOMPONENT csla
#include "\x\cba\addons\xeh\script_component.hpp"
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
#include "\x\cba\addons\xeh\script_component.hpp"
#undef COMPONENT
#define COMPONENT xeh_compat_sog

class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "cba_xeh", "loadorder_f_vietnam" };
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
VERSION_CONFIG;
// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};
class XEH_CLASS_BASE;

class CfgVehicles {
class vn_object_b_base_02;
class Land_vn_candle_01: vn_object_b_base_02 {
Expand Down
23 changes: 23 additions & 0 deletions addons/xeh/xeh_sog/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"

class CfgPatches {
class SUBADDON {
name = CSTRING(component);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"cba_xeh", "loadorder_f_vietnam"};
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
authors[] = {"Dahlgren"};
url = "$STR_CBA_URL";
VERSION_CONFIG;

// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};

class XEH_CLASS_BASE;

#include "CfgVehicles.hpp"
2 changes: 2 additions & 0 deletions addons/xeh/xeh_sog/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SUBCOMPONENT sog
#include "\x\cba\addons\xeh\script_component.hpp"
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
#include "\x\cba\addons\xeh\script_component.hpp"
#undef COMPONENT
#define COMPONENT xeh_compat_ws

class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "cba_xeh", "data_f_lxWS" };
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
VERSION_CONFIG;
// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};
class XEH_CLASS_BASE;

class CfgVehicles {
class PowerLines_Small_base_F;
class Land_PowerPoleWooden_lxWS: PowerLines_Small_base_F {
Expand All @@ -38,12 +19,12 @@ class CfgVehicles {
class C_Journalist_lxWS: C_journalist_F {
XEH_ENABLED;
};

class C_Man_casual_1_F_afro;
class C_Tak_01_A_lxWS: C_Man_casual_1_F_afro {
XEH_ENABLED;
};

class B_Soldier_TL_F;
class B_ION_Story_Givens_lxWS: B_Soldier_TL_F {
XEH_ENABLED;
Expand Down
23 changes: 23 additions & 0 deletions addons/xeh/xeh_ws/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"

class CfgPatches {
class SUBADDON {
name = CSTRING(component);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"cba_xeh", "data_f_lxWS"};
skipWhenMissingDependencies = 1;
author = "$STR_CBA_Author";
authors[] = {"Dahlgren"};
url = "$STR_CBA_URL";
VERSION_CONFIG;

// this prevents any patched class from requiring XEH
addonRootClass = "A3_Characters_F";
};
};

class XEH_CLASS_BASE;

#include "CfgVehicles.hpp"
2 changes: 2 additions & 0 deletions addons/xeh/xeh_ws/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define SUBCOMPONENT ws
#include "\x\cba\addons\xeh\script_component.hpp"
4 changes: 2 additions & 2 deletions optionals/legacy_jr/legacy_jr_prep/config.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
class SUBADDON {
author = "$STR_CBA_Author";
name = ECSTRING(legacy_jr,component);
name = CSTRING(component);
url = "$STR_CBA_URL";
units[] = {};
weapons[] = {};
Expand Down
5 changes: 2 additions & 3 deletions optionals/legacy_jr/legacy_jr_prep/script_component.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#define COMPONENT legacy_jr_prep
#include "\x\cba\addons\main\script_mod.hpp"
#include "\x\cba\addons\main\script_macros.hpp"
#define SUBCOMPONENT prep
#include "\x\cba\addons\legacy_jr\script_component.hpp"

0 comments on commit eab161e

Please sign in to comment.