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

XEH - Add missing event handlers with SPE 1.0 #1587

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions addons/xeh/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,31 @@ class CfgVehicles {
class Truck_02_aa_base_lxWS: Truck_02_base_F {
XEH_ENABLED;
};

// Spearhead 1944

class Tank;
class SPE_Armored_Target_Dummy: Tank {
class EventHandlers {
// This class has an empty CBA_Extended_EventHandlers, repopulate with actual event handlers
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, what? Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, this is the SPE class structure

class SPE_Armored_Target_Dummy: Tank
{
	class Eventhandlers
	{
		class CBA_Extended_EventHandlers{};
	};
};

Since the XEH_ENABLED macro adds the EventHandlers classes with inheritance from the CBA_Extended_EventHandlers_base class it causes a load order issue and UBC problem. This structure with macros usage avoids both problems.

Copy link
Contributor

Choose a reason for hiding this comment

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

LOL. To fix, should put

class SPE_Armored_Target_Dummy: Tank {
	class Eventhandlers {
		delete CBA_Extended_EventHandlers;
	};
};

here, and then

    class Tank;
    class SPE_Armored_Target_Dummy: Tank {
        XEH_ENABLED;
    };

into ee component.

Copy link
Contributor Author

@Dahlgren Dahlgren Jul 25, 2023

Choose a reason for hiding this comment

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

That would need a separate (sub)config with cfgPatches requiredAddons[] = { "Some_SPE_Addon" }; and either the new skipWhenMissingDependencies with 2.14 patch or #if __has_include("some_spe_path")

Copy link
Contributor

Choose a reason for hiding this comment

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

Why? delete complains now if no class is there? Maybe add it in patch 1, then remove it in patch 2, then XEH_enabled in patch 3. XEH already has a ton of (now sub-) module duplicates for legacy reasons. If you need to change the requiredAddons for it, go ahead.

Your current solution is whack.

Copy link
Contributor Author

@Dahlgren Dahlgren Jul 26, 2023

Choose a reason for hiding this comment

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

Why?

SPE is optional CDLC so not always loaded, when I tried locally CBA always got loaded before SPE so we need to ensure the load order unless we use the suggested solution in the PR

If you need to change the requiredAddons for it, go ahead.

Any preference on new skipWhenMissingDependencies which won't be usable until upcoming patch 2.14 and would block PR / release until then or using #if __has_include("some_spe_path") which doesn't work properly with some tools like HEMTT and binarization enabled?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think #1589 should help with this problem

Copy link
Contributor

Choose a reason for hiding this comment

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

	class SPE_Armored_Target_Dummy: Tank
	{
		scope=1;
		class Eventhandlers
		{
			class CBA_Extended_EventHandlers
			{
			};
		};

it's scope=1 and nothing inherits from this

I'm guessing this is for something scripted,
they explicitly disabled eh and xeh on it
I think we might just want to trust them and not touch it

class CBA_Extended_EventHandlers {
EXTENDED_EVENTHANDLERS
};
};
SLX_XEH_DISABLED = 0;
};

class SPE_MineObject_base: ModuleEmpty_F {
XEH_ENABLED;
};
class SPE_Minefield_base: SPE_MineObject_base {};
class SPE_MINE_TMI42_Field_30x30: SPE_Minefield_base {
XEH_ENABLED;
};
class SPE_MINE_TMI42_Field_70x30: SPE_Minefield_base {
XEH_ENABLED;
};
class SPE_MINE_US_M1A1_ATMINE_Field_30x30: SPE_Minefield_base {
XEH_ENABLED;
};
};
Loading