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,16 +1,15 @@
// updated 2024-02-01 by IndigoFox
// now reads from the battalion config structure
private _addToAllText = {
params [["_lines", []]];
_allText pushBack (_lines joinString "<br/>");
};
// now reads from the battalion config structure to generate the diary entries
////////////////////////////////////////
// Get info from missionConfigFile
////////////////////////////////////////
private _battalionInfoCfg = call milsim_fnc_getBattalionCfg;
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
////////////////////////////////////////
// Define formatting constants
////////////////////////////////////////
private _ELEMENT_NAME_SIZE = 10;
private _ELEMENT_NAME_FONT = "EtelkaMonospaceProBold";
private _ELEMENT_FREQ_SIZE = 9;
@@ -18,21 +17,17 @@ private _ELEMENT_FREQ_FONT = "EtelkaMonospacePro";
private _FREQ_INDENT_CONSTANT = 6;
private _FREQ_PAD_LENGTH = 17;
private _FREQ_TEXT_COLOR = "#CCCCCC";
// Note: Element colors are defined in the battalion config
////////////////////////////////////////
// ADD DIARY ENTRIES
////////////////////////////////////////
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 "";
// reverse the list so diary records are filed in the correct order
// First is all the battalion-level elements beneath command
// To have the records listed in the order they appear in the battalion config, we need to reverse the array
// Since each entry is added to the top of the list, this will result in the entries being added in the correct order
reverse _battalionElementCfgs;
{
// recursively generate diary text for all child elements of battalion-level elements
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText;
@@ -50,4 +45,6 @@ private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fn
milsim_fbcb2_subjectFrequenciesID,
_diaryTitleText#0,
_diaryTitleText#1
] call milsim_fnc_createOrUpdateDiaryRecord;
] call milsim_fnc_createOrUpdateDiaryRecord;
true;