Skip to content

Commit

Permalink
Make isRecompileEnabled generic, warn FiredBIS
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Jan 9, 2016
1 parent 7c69f15 commit b9ee7ce
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions addons/common/init_functionsModule.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ scriptName "CBA\common\init_functionsModule";
private ["_recompile"];
_recompile = (count _this) > 0;

if (isNil "CBA_FUNC_RECOMPILE") then { CBA_FUNC_RECOMPILE = ["functions"] call CBA_fnc_isRecompileEnabled; };
if (CBA_FUNC_RECOMPILE) then { _recompile = true };


Expand Down
4 changes: 4 additions & 0 deletions addons/xeh/fnc_addClassEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ if (_eventName == "getOutMan" && {isNil QGVAR(getOutManAdded)}) then {
_eventName = toLower _eventName;

// no such event
if (_eventName == "FiredBIS") exitWith {
WARNING("Cannot add 'FiredBIS' - Use 'Fired' instead");
false
};
if !(_eventName in GVAR(EventsLowercase)) exitWith {false};

// add events to already existing objects
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_compileFunction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if (isNil "_cachedFunc") then {
uiNamespace setVariable [_funcName, compileFinal preprocessFileLineNumbers _funcFile];
missionNamespace setVariable [_funcName, uiNamespace getVariable _funcName];
} else {
if (call CBA_fnc_isRecompileEnabled) then {
if (["compile"] call CBA_fnc_isRecompileEnabled) then {
missionNamespace setVariable [_funcName, compileFinal preprocessFileLineNumbers _funcFile];
} else {
missionNamespace setVariable [_funcName, _cachedFunc];
Expand Down
26 changes: 16 additions & 10 deletions addons/xeh/fnc_isRecompileEnabled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,36 @@ Description:
Check if recompiling is enabled.
Parameters:
None
0: _compileType - The compile type (`compile` or `functions`) <STRING>
Returns:
true - recompiling is enabled, false - recompiling is disabled <BOOLEAN>
Examples:
(begin example)
_enabled = call CBA_fnc_isRecompileEnabled;
_enabled = ["compile"] call CBA_fnc_isRecompileEnabled;
(end)
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"

if (isNil QGVAR(isRecompileEnabled)) then {
private _config = configFile >> "CfgSettings" >> "CBA" >> "caching" >> "compile";
private _missionConfig = missionConfigFile >> "CfgSettings" >> "CBA" >> "caching" >> "compile";
params ["_compileType"];

GVAR(isRecompileEnabled) = (isNumber _config && {getNumber _config == 0}) || {isNumber _missionConfig && {getNumber _missionConfig == 0}};
private _return = missionNamespace getVariable (format [QGVAR(isRecompileEnabled_%1), _compileType]);

#ifdef DEBUG_MODE_FULL
diag_log text format ["isRecompileEnabled = %1", GVAR(isRecompileEnabled)];
#endif
if (isNil "_return") then {
private _config = configFile >> "CfgSettings" >> "CBA" >> "caching" >> _compileType;
private _missionConfig = missionConfigFile >> "CfgSettings" >> "CBA" >> "caching" >> _compileType;

_return = (isNumber _config && {getNumber _config == 0}) || {isNumber _missionConfig && {getNumber _missionConfig == 0}};
missionNamespace setVariable [(format [QGVAR(isRecompileEnabled_%1), _compileType]), _return];

// Normally, full caching is enabled. If not, log an informative message.
if (_return) then {
XEH_LOG(PFORMAT_1("CBA CACHE DISABLED? (Disable caching with cba_cache_disable.pbo)", _compileType));
};
};

GVAR(isRecompileEnabled)
_return
2 changes: 1 addition & 1 deletion addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ GVAR(EventsLowercase) = [];
} forEach ([false, true] call CBA_fnc_supportMonitor);

// recompile extended event handlers when enabled
if (call CBA_fnc_isRecompileEnabled) then {
if (["xeh"] call CBA_fnc_isRecompileEnabled) then {
GVAR(allEventHandlers) = configFile call CBA_fnc_compileEventHandlers; // from addon config
} else {
GVAR(allEventHandlers) = call (uiNamespace getVariable QGVAR(fnc_getAllEventHandlers));
Expand Down

0 comments on commit b9ee7ce

Please sign in to comment.