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

Optionals - Add No Medical and No Realistic Names components #8187

Merged
merged 12 commits into from
Sep 4, 2023
2 changes: 2 additions & 0 deletions addons/fire/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/fire/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
Comment on lines +3 to +9
Copy link
Member

@jonpas jonpas Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
ACE_PATCH_NOT_LOADED(ADDON,"No Medical")
#else

Why not just this? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way can define PATCH_SKIP with several conditions. E.g.:

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
#if __has_include("\some\other_addon\config.bin")
#define PATCH_SKIP "Some Other Addon"
#endif

and then you use PATCH_SKIP just once to disable component with ACE_PATCH_NOT_LOADED. In this PR this is mostly a good template for other __has_include components. I liked @PabstMirror idea and implemeted it here too.
See also

#if __has_include("\lxWS\data_f_lxWS\config.bin")
#else
#define PATCH_SKIP "Western Sahara"
#endif
#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)

Also you have PATCH_SKIP undefined in suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok your example adds multiple conditions, but you can also do that like this:

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#if __has_include("\some\other_addon\config.bin")
ACE_PATCH_NOT_LOADED(ADDON,"Some Other Addon")
#else
ACE_PATCH_NOT_LOADED(ADDON,"No Medical")
#else
// default config
#endif
#endif

Although that is uglier and I wouldn't want to do it.

Not sure, we just need the opposite of skipWhenMissingDependencies!

Fixed suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not fully sure about #if, but I seem to remember that preprocessor "commands" like that are not able to be nested(at least #ifdef is not able to be nested)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, and they also don't support logical operators I believe. Yeah, we need a skipWhenLoaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if __has_include("\rhsafrf\addons\rhs_main\loadorder\config.bin")
#else
    #define PATCH_SKIP "RHS AFRF"
#endif

#if __has_include("\z\ace\addons\explosives\script_component.hpp")
#else
    #ifdef PATCH_SKIP
    #else
        #define PATCH_SKIP "ACE Explosives"
    #endif
#endif

works on game, mikro and hemtt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about #ifndef, is it working everywhere ? Cuz if it is, I don't see why do ifdef-else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I seem to remember that preprocessor "commands" like that are not able to be nested(at least #ifdef is not able to be nested)

This should be fixed at least for a patch or two.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#9294 seems to work fine with nesting.

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -18,3 +25,5 @@ class CfgPatches {
#include "CfgSounds.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
#include "RscTitles.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
PabstMirror marked this conversation as resolved.
Show resolved Hide resolved
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -21,3 +28,5 @@ class CfgPatches {
class ACE_Tests {
medicalHitpoints = QPATHTOF(dev\test_hitpointConfigs.sqf);
};

#endif
2 changes: 2 additions & 0 deletions addons/medical_ai/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_ai/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -16,3 +23,5 @@ class CfgPatches {

#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_blood/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_blood/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -16,3 +23,5 @@ class CfgPatches {

#include "CfgEventHandlers.hpp"
#include "ACE_Settings.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_damage/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_damage/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand Down Expand Up @@ -27,3 +34,5 @@ class ACE_Extensions {
};
};
*/

#endif
2 changes: 2 additions & 0 deletions addons/medical_engine/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_engine/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -21,3 +28,5 @@ class CfgPatches {
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_feedback/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_feedback/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -20,3 +27,5 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "RscTitles.hpp"
#include "RscInGameUI.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_gui/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_gui/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -18,3 +25,5 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "gui.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_statemachine/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_statemachine/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -16,3 +23,5 @@ class CfgPatches {

#include "Statemachine.hpp"
#include "CfgEventHandlers.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_status/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_status/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -16,3 +23,5 @@ class CfgPatches {

#include "ACE_settings.hpp"
#include "CfgEventHandlers.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_treatment/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_treatment/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -22,3 +29,5 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "Cfg3DEN.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/medical_vitals/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/medical_vitals/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -15,3 +22,5 @@ class CfgPatches {
};

#include "CfgEventHandlers.hpp"

#endif
2 changes: 2 additions & 0 deletions addons/realisticnames/addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[preprocess]
enabled = false
9 changes: 9 additions & 0 deletions addons/realisticnames/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include "script_component.hpp"

#if __has_include("\z\ace\addons\norealisticnames\script_component.hpp")
#define PATCH_SKIP "No Realistic Names"
#endif

#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
Expand All @@ -20,3 +27,5 @@ class CfgPatches {
#include "CfgMagazines.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

#endif
1 change: 1 addition & 0 deletions optionals/nomedical/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\nomedical
jonpas marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions optionals/nomedical/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {};
author = ECSTRING(common,ACETeam);
authors[] = {"Dystopian"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
6 changes: 6 additions & 0 deletions optionals/nomedical/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define COMPONENT nomedical
#define COMPONENT_BEAUTIFIED No Medical

#include "\z\ace\addons\main\script_mod.hpp"

#include "\z\ace\addons\main\script_macros.hpp"
1 change: 1 addition & 0 deletions optionals/norealisticnames/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\norealisticnames
jonpas marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions optionals/norealisticnames/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {};
author = ECSTRING(common,ACETeam);
authors[] = {"Dystopian"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
6 changes: 6 additions & 0 deletions optionals/norealisticnames/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define COMPONENT norealisticnames
#define COMPONENT_BEAUTIFIED No Realistic Names

#include "\z\ace\addons\main\script_mod.hpp"

#include "\z\ace\addons\main\script_macros.hpp"