TL;DR:
Macros expand incorrectly due to #defines being set differently by PCF and the base mod.
e.g. GVAR(myVar) expands into a3ue_pcf_core_myVar instead of A3A_core_myVar which breaks various things.
I was having an issue where the terrain manipulators (smooth terrain, clear vegetation, etc) that you can build weren't loading from a persistent save correctly. When loading a save with PCF loaded terrain manipulator objects would show up as floating blue arrows and wouldn't apply the smoothing etc that they were supposed to.
After buildings are loaded from a save they are supposed to run a handler function here:
|
if isText(configOf _veh >> QGVAR(onBuildingLoaded)) then { |
|
Debug_3("calling %1 on %2 with params %3", QGVAR(onBuildingLoaded), typeOf _veh, [_veh]); |
|
[_veh] call compile getText(configOf _veh >> QGVAR(onBuildingLoaded)); |
|
}; |
Notice the macro QGVAR(onBuildingLoaded) which expands to something like: PREFIX_COMPONENT_onBuildingLoaded.
When the file is loaded in the base AU mod PREFIX is set to A3A and so the function name expands to A3A_core_onBuildingLoaded.
However, when the file is loaded in PCF, it's #includeing it's own script_mod.hpp file which sets PREFIX to a3ue_pcf and so it expands into a3ue_pcf_core_onBuildingLoaded instead! Since that's not a valid handler name, no function gets called and stuff breaks.
A simple fix might be to set PREFIX to A3A so that the macros expand correctly in those files (this is what I did in a personal build and it seems to work fine):
#define PREFIX A3A
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()
Or to possibly include the script_component.hpp from the base mod using something like #include "\x\A3A\addons\core\script_component.hpp" but I'm not sure if that could cause other issues.
Note this is kind of a hack though, so it needs some more looking into for a proper fix.
TL;DR:
Macros expand incorrectly due to
#defines being set differently by PCF and the base mod.e.g.
GVAR(myVar)expands intoa3ue_pcf_core_myVarinstead ofA3A_core_myVarwhich breaks various things.I was having an issue where the terrain manipulators (smooth terrain, clear vegetation, etc) that you can build weren't loading from a persistent save correctly. When loading a save with PCF loaded terrain manipulator objects would show up as floating blue arrows and wouldn't apply the smoothing etc that they were supposed to.
After buildings are loaded from a save they are supposed to run a handler function here:
A3UEPCF/a3ue_pcf/addons/core/functions/Save/fn_loadStat.sqf
Lines 412 to 415 in 93cfe74
Notice the macro
QGVAR(onBuildingLoaded)which expands to something like:PREFIX_COMPONENT_onBuildingLoaded.When the file is loaded in the base AU mod
PREFIXis set toA3Aand so the function name expands toA3A_core_onBuildingLoaded.However, when the file is loaded in PCF, it's
#includeing it's ownscript_mod.hppfile which setsPREFIXtoa3ue_pcfand so it expands intoa3ue_pcf_core_onBuildingLoadedinstead! Since that's not a valid handler name, no function gets called and stuff breaks.A simple fix might be to set
PREFIXtoA3Aso that the macros expand correctly in those files (this is what I did in a personal build and it seems to work fine):Or to possibly include the
script_component.hppfrom the base mod using something like#include "\x\A3A\addons\core\script_component.hpp"but I'm not sure if that could cause other issues.Note this is kind of a hack though, so it needs some more looking into for a proper fix.