// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
params [
["_elementCfg", configNull, [configNull]],
["_shouldProcessChildCfgs", true]
];
if (isNull _elementCfg) exitWith {
["_elementCfg parameter is NULL"] call BIS_fnc_error;
};
// change reference variable for clarity
private _battalionElement = _elementCfg;
// Generate title from callsign and shortDescription
private _recordTitle = format[
"%1 (%2)",
getText(_battalionElement >> "callsign"),
getText(_battalionElement >> "shortDescription")
];
// systemChat _recordTitle;
//////////////////////////////////////////////////////////
// Generate frequency table header line's leading space
//////////////////////////////////////////////////////////
private _freqLeadingSpace = [
format["| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
_freqLeadingSpace pushBack " ";
};
_freqLeadingSpace pushBack "";
_freqLeadingSpace = _freqLeadingSpace joinString "";
//////////////////////////////////////////////////////////
// Generate header line and frequency table header line
//////////////////////////////////////////////////////////
private _headers = [
format[
"%4",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
],
format[
"%1- %5%6%7",
_freqLeadingSpace,
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR,
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
"LR"
]
];
//////////////////////////////////////////////////////////
// Generate the list of element headers and frequencies
//////////////////////////////////////////////////////////
private _allText = [];
// get all child elements recursively and format them
if (_shouldProcessChildCfgs) then {
[_battalionElement, {
params ["_cfg", "_recurseCounter"];
// add config
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
// private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "
");
}] call milsim_fnc_recurseSubclasses;
} else {
// or if the param was false, just add the battalion element
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
// private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "
");
};
// add headers, add all other lines and format them as monospace
_allText = format[
"%1
%2", _headers joinString "
", _allText joinString "
"];
// return the title and all text
[_recordTitle, _allText];