Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subcomponent support to macros #1598

Merged
merged 9 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
13 changes: 12 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 Expand Up @@ -889,10 +897,13 @@ Macro: GVAR()
Sickboy
------------------------------------------- */
#define GVAR(var1) DOUBLES(ADDON,var1)
#define SUBGVAR(var1) TRIPLES(ADDON,SUBCOMPONENT,var1)
#define EGVAR(var1,var2) TRIPLES(PREFIX,var1,var2)
#define QGVAR(var1) QUOTE(GVAR(var1))
#define QSUBGVAR(var1) QUOTE(SUBGVAR(var1))
#define QEGVAR(var1,var2) QUOTE(EGVAR(var1,var2))
#define QQGVAR(var1) QUOTE(QGVAR(var1))
#define QQSUBGVAR(var1) QUOTE(QSUBGVAR(var1))
#define QQEGVAR(var1,var2) QUOTE(QEGVAR(var1,var2))

/* -------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion addons/ui/ui_helper/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class CfgPatches {
jonpas marked this conversation as resolved.
Show resolved Hide resolved
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"
2 changes: 1 addition & 1 deletion addons/xeh/xeh_a3/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class CfgPatches {
jonpas marked this conversation as resolved.
Show resolved Hide resolved
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"