updates FBCB2, updates log fnc, adds comments

This commit is contained in:
2024-02-01 20:48:30 -08:00
parent c7d9298987
commit 1e4a5a79a8
12 changed files with 173 additions and 86 deletions

View File

@@ -1,6 +1,9 @@
// called from milsim_fnc_processFBCB2RadioFrequencies
params ["_cfg", ["_indentCount", 1, [5]]];
//////////////////////////////////////////////////////
// Define leading space/hyphenation for element name
//////////////////////////////////////////////////////
private _leadingSpace = [
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
@@ -9,7 +12,9 @@ for "_i" from 1 to _indentCount do {
};
_leadingSpace pushBack " | </font>";
// make header line
/////////////////////////////////////////////////////////
// Create the header line for the provided config entry
/////////////////////////////////////////////////////////
private _lines = [
format[
"<font color='%1'>%2%3</font>",
@@ -19,7 +24,11 @@ private _lines = [
]
];
// make frequency lines
////////////////////////////////////////////////////////////
// Create the frequency lines for the provided config entry
////////////////////////////////////////////////////////////
// Generate leading space
private _freqLeadingSpace = [
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
@@ -29,6 +38,7 @@ for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
_freqLeadingSpace pushBack "</font>";
_freqLeadingSpace = _freqLeadingSpace joinString "";
// Process config values for frequencies
{
_x params ["_role", "_sr", "_lr"];
@@ -45,7 +55,7 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
_lrStr = "----";
};
// Add formatted line to the array
_lines pushBack format[
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
_freqLeadingSpace,
@@ -59,4 +69,5 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
} forEach (getArray (_cfg >> "frequencies"));
// diag_log text (_lines joinString endl);
// Return the formatted lines in ARRAY format
_lines;

View File

@@ -1,4 +1,5 @@
// called from milsim_fnc_processFBCB2RadioFrequencies
// 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]
@@ -8,8 +9,10 @@ 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"),
@@ -17,16 +20,33 @@ private _recordTitle = format[
];
// systemChat _recordTitle;
//////////////////////////////////////////////////////////
// Generate frequency table header line's leading space
//////////////////////////////////////////////////////////
private _freqLeadingSpace = [
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
_freqLeadingSpace pushBack " ";
};
_freqLeadingSpace pushBack "</font>";
_freqLeadingSpace = _freqLeadingSpace joinString "";
//////////////////////////////////////////////////////////
// Generate header line and frequency table header line
//////////////////////////////////////////////////////////
private _headers = [
format[
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
"<font size='%1' color='%2' face='%3'>%4</font>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
],
format[
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font><br/><br/>",
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
_freqLeadingSpace,
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
@@ -37,6 +57,10 @@ private _headers = [
]
];
//////////////////////////////////////////////////////////
// Generate the list of element headers and frequencies
//////////////////////////////////////////////////////////
private _allText = [];
// get all child elements recursively and format them
@@ -49,12 +73,15 @@ if (_shouldProcessChildCfgs) then {
_allText pushBack (_lines joinString "<br/>");
}] 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 "<br/>");
};
// add headers, add all other lines and format them as monospace
_allText = format[
"%1<br/><br/><font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/><br/>"];
_allText = format["%1<font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/>"];
// return the title and all text
[_recordTitle, _allText];