2016-04-08 20:21:46 +00:00
|
|
|
/*
|
|
|
|
Author: Aaron Clark - EpochMod.com
|
|
|
|
|
|
|
|
Contributors:
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Custom functions compiler
|
|
|
|
|
|
|
|
Licence:
|
|
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
|
|
|
|
Github:
|
2016-06-13 16:54:19 +00:00
|
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/both/EPOCH_compiler.sqf
|
2016-04-08 20:21:46 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
"CfgServerFunctions" call EPOCH_fnc_compiler;
|
|
|
|
or
|
|
|
|
"CfgClientFunctions" call EPOCH_fnc_compiler;
|
|
|
|
|
|
|
|
Parameter(s):
|
|
|
|
_this: STRING - Config class name
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
BOOL
|
|
|
|
*/
|
2016-09-01 00:29:08 +00:00
|
|
|
//[[[cog import generate_private_arrays ]]]
|
2016-09-08 17:09:58 +00:00
|
|
|
private ["_config","_config_name","_file","_file_raw","_file_tag","_fnc_path","_missionConfig","_tag","_var_name","_version"];
|
2016-09-01 00:29:08 +00:00
|
|
|
//[[[end]]]
|
|
|
|
params [["_configName","",[""] ] ];
|
2016-04-08 20:21:46 +00:00
|
|
|
|
2016-09-08 17:09:58 +00:00
|
|
|
_config = (configfile >> _configName);
|
|
|
|
_missionConfig = (getMissionConfig _configName);
|
|
|
|
if (isClass _missionConfig) then{
|
|
|
|
_config = _missionConfig;
|
2016-04-08 20:21:46 +00:00
|
|
|
};
|
|
|
|
_version = getNumber(_config >> "version");
|
2016-09-08 17:09:58 +00:00
|
|
|
if (_version >= 1) then {
|
2016-04-08 20:21:46 +00:00
|
|
|
{
|
|
|
|
if (isClass(_x)) then {
|
|
|
|
_tag = getText(_x >> "tag");
|
|
|
|
_file = getText(_x >> "file");
|
|
|
|
_file_tag = _file;
|
|
|
|
{
|
|
|
|
if (isClass(_x)) then {
|
|
|
|
_file = _file_tag;
|
|
|
|
_file_raw = getText(_x >> "file");
|
|
|
|
if (_file_raw == "") then {
|
2016-09-08 17:09:58 +00:00
|
|
|
_file = format["%1\%2", _file, configName _x];
|
2016-04-08 20:21:46 +00:00
|
|
|
} else {
|
|
|
|
_file = _file_raw;
|
|
|
|
};
|
|
|
|
{
|
2016-09-08 17:09:58 +00:00
|
|
|
_config_name = configName _x;
|
|
|
|
//version 2 More like BI standard fnc / fn_
|
|
|
|
_var_name = format["%1_fnc_%2", _tag, _config_name];
|
|
|
|
_fnc_path = format["%1\fn_%2.sqf", _file, _config_name];
|
|
|
|
if (_version == 1) then {
|
|
|
|
//version 1 TAG + _ + configName
|
|
|
|
_var_name = format["%1_%2", _tag, _config_name];
|
|
|
|
_fnc_path = format["%1\%2.sqf", _file, _var_name];
|
|
|
|
};
|
2016-04-08 20:21:46 +00:00
|
|
|
_file_raw = getText(_x >> "file");
|
|
|
|
if (_file_raw != "") then {
|
|
|
|
_fnc_path = _file_raw;
|
|
|
|
};
|
2016-09-08 17:09:58 +00:00
|
|
|
missionNamespace setvariable [_var_name,compileFinal preprocessFileLineNumbers _fnc_path];
|
|
|
|
if (getNumber(_x >> "preInit") == 1) then {
|
|
|
|
call (missionNamespace getvariable _var_name);
|
|
|
|
};
|
|
|
|
} forEach (configProperties [_x, "isClass _x", true]);
|
2016-04-08 20:21:46 +00:00
|
|
|
}
|
2016-09-08 17:09:58 +00:00
|
|
|
} forEach (configProperties [_x, "isClass _x", true]);
|
2016-04-08 20:21:46 +00:00
|
|
|
};
|
2016-09-08 17:09:58 +00:00
|
|
|
} forEach (configProperties [_config, "isClass _x", true]);
|
2016-04-08 20:21:46 +00:00
|
|
|
};
|