diff --git a/description.ext b/description.ext
index 340a0a0..5b61555 100644
--- a/description.ext
+++ b/description.ext
@@ -1,4 +1,4 @@
-//-------------------------------------------DESCRIPTION.EXT-----------------------------------------------------------------
+//-------------------------------------------DESCRIPTION.EXT-----------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -18,6 +18,7 @@
#include "mission_settings.hpp"
#include "functions\definitions\DisallowedEquipment.hpp"
+#include "functions\definitions\BattalionInfo.hpp"
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/functions/CfgFunctions.hpp b/functions/CfgFunctions.hpp
index 7e8f088..f7d3fb2 100644
--- a/functions/CfgFunctions.hpp
+++ b/functions/CfgFunctions.hpp
@@ -15,15 +15,22 @@ class milsim
};
class fbcb2 {
- class addFBCB2DiaryEntries { postInit = 1; };
class initFBCB2 { postInit = 1; };
- class processFBCB2Callsigns {};
class processFBCB2FixedWingAssets {};
class processFBCB2RotaryAssets {};
class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {};
class processFBCB2Environment {};
- class messageFBCB2AssetStatus {};
+ class hintFBCB2AssetStatus {};
+ };
+ class fbcb2_util {
+ file = "functions\fbcb2\util";
+ class createOrUpdateDiaryRecord {};
+ };
+ class fbcb2_radioFrequencies {
+ file = "functions\fbcb2\radioFrequencies";
+ class formatRadioElementForDiary {};
+ class generateElementFrequencyRecordText {};
};
class client {
@@ -75,6 +82,9 @@ class milsim
class logMissionInfo { postInit = 1; };
class addPlayerInfoToArray {};
class log {};
+ class padString {};
+ class recurseSubclasses {};
+ class getBattalionCfg {};
};
};
diff --git a/functions/definitions/BattalionInfo.hpp b/functions/definitions/BattalionInfo.hpp
new file mode 100644
index 0000000..52ab77a
--- /dev/null
+++ b/functions/definitions/BattalionInfo.hpp
@@ -0,0 +1,253 @@
+// BattalionInfo.hpp
+// Defines the structure of the Battalion, allowing properties to be easily changed and updated
+// This file is included in description.ext
+
+
+// Define the callsigns for the Battalion
+#define COMMAND_CALLSIGN SPARTAN
+#define RRC_CALLSIGN TIGER
+#define MEDIC_CALLSIGN LIFELINE
+#define ALPHA_CALLSIGN BLACKJACK
+#define ECHO_CALLSIGN ZOOMER
+#define WPN_CALLSIGN BLACKFOOT
+
+// Define the frequencies for the Battalion
+#define FREQ_BATTALION 45
+#define FREQ_BATTALION_MEDICAL_INTERCOM 91.1
+#define FREQ_ALL_MEDICAL_SR 121.5
+
+#define FREQ_ALPHA_COMPANY 40
+
+#define FREQ_PLATOON1_SR 100
+#define FREQ_PLATOON1_LR 41
+#define FREQ_PLATOON1_RTO 101
+
+#define FREQ_PLATOON2_SR 200
+#define FREQ_PLATOON2_LR 42
+#define FREQ_PLATOON2_RTO 201
+
+#define FREQ_ECHO_FLIGHT_INTERCOM 30
+#define FREQ_ECHO_FLIGHT_CAS 35
+#define FREQ_ECHO_FLIGHT_LOGISTICS 35.1
+
+#define FREQ_ECHO_GROUND 80
+#define FREQ_ECHO_GROUND_LOGISTICS 81
+#define FREQ_ECHO_ARTY 82
+#define FREQ_ECHO_ARTY_INTERCOM 155
+
+#define FREQ_CONVOY 50
+
+// Define the text colors to appear in diary entries
+#define LVL1_TEXT_COLOR "#7c887e"
+#define LVL2_TEXT_COLOR "#bab79f"
+#define LVL3_TEXT_COLOR "#91967f"
+#define LVL4_TEXT_COLOR "#d3d2cd"
+
+
+// All elements and subclasses should have the following properties:
+// callsign: the callsign of the element
+// textColor: the color of the text for the element
+// frequencies: an array of frequencies for the element in the format:
+// {roleWithinElement, {primarySR, additionalSR}, {primaryLR, additionalLR}}
+
+// Battalion-level elements under Command should have the following additional properties:
+// shortDescription: a short description of the element's place in the Battalion
+
+
+// System macros
+#define CALLSIGN_ELEMENT(callsign,element) callsign##element
+
+
+
+class BattalionInfo {
+ class Command {
+ callsign = COMMAND_CALLSIGN;
+ shortDescription = "Battalion Command";
+ textColor = LVL1_TEXT_COLOR;
+ // frequencies are in format:
+ // {roleWithinElement, {primarySR, additionalSR}, {primaryLR, additionalLR}}
+ frequencies[] = {
+ {"Contact", {}, {FREQ_BATTALION}},
+ {"Actual", {}, {FREQ_BATTALION}},
+ {"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
+ };
+
+
+ class RRC { // WIP
+ callsign = RRC_CALLSIGN;
+ shortDescription = "RRC";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_BATTALION}},
+ {"Actual", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
+ };
+ };
+
+ class BattalionMedical { // WIP
+ callsign = MEDIC_CALLSIGN;
+ shortDescription = "Battalion Medical";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {FREQ_ALL_MEDICAL_SR}, {FREQ_BATTALION}},
+ {"Actual", {FREQ_BATTALION_MEDICAL_INTERCOM, FREQ_ALL_MEDICAL_SR}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_LOGISTICS}},
+ {"General", {FREQ_BATTALION_MEDICAL_INTERCOM, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+
+ class WeaponsSquad { // WIP
+ callsign = WPN_CALLSIGN;
+ shortDescription = "Special Weapons Squad";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_BATTALION}}
+ };
+ };
+
+
+ class AlphaCompany {
+ callsign = ALPHA_CALLSIGN;
+ shortDescription = "Alpha Company";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_ALPHA_COMPANY, FREQ_BATTALION}}
+ };
+
+ class Platoon1 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-6);
+ textColor = LVL3_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {FREQ_PLATOON1_SR, FREQ_PLATOON1_RTO}, {FREQ_PLATOON1_LR, FREQ_ALPHA_COMPANY}},
+ {"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS, FREQ_ECHO_FLIGHT_LOGISTICS}}
+ };
+ class Squad1 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-1);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {110, FREQ_PLATOON1_SR}, {FREQ_PLATOON1_LR}},
+ {"Alpha Team", {111, 110}, {}},
+ {"Bravo Team", {112, 110}, {}},
+ {"Medic", {110, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+ class Squad2 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-2);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {120, FREQ_PLATOON1_SR}, {FREQ_PLATOON1_LR}},
+ {"Alpha Team", {121, 120}, {}},
+ {"Bravo Team", {122, 120}, {}},
+ {"Medic", {120, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+ class Squad3 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-3);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {130, FREQ_PLATOON1_SR}, {FREQ_PLATOON1_LR}},
+ {"Alpha Team", {131, 130}, {}},
+ {"Bravo Team", {132, 130}, {}},
+ {"Medic", {130, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+ };
+
+ class Platoon2 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-6);
+ textColor = LVL3_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {FREQ_PLATOON2_SR, FREQ_PLATOON2_RTO}, {FREQ_PLATOON2_LR, FREQ_ALPHA_COMPANY}}
+ };
+ class Squad1 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-1);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {210, FREQ_PLATOON2_SR}, {FREQ_PLATOON2_LR}},
+ {"Alpha Team", {211, 210}, {}},
+ {"Bravo Team", {212, 210}, {}},
+ {"Medic", {210, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+ class Squad2 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-2);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {220, FREQ_PLATOON2_SR}, {FREQ_PLATOON2_LR}},
+ {"Alpha Team", {221, 220}, {}},
+ {"Bravo Team", {222, 220}, {}},
+ {"Medic", {220, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+ class Squad3 {
+ callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-3);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {230, FREQ_PLATOON2_SR}, {FREQ_PLATOON2_LR}},
+ {"Alpha Team", {231, 230}, {}},
+ {"Bravo Team", {232, 230}, {}},
+ {"Medic", {230, FREQ_ALL_MEDICAL_SR}, {}}
+ };
+ };
+ };
+ };
+
+ class EchoCompany {
+ callsign = ECHO_CALLSIGN;
+ shortDescription = "Echo Company";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_BATTALION}},
+ {"Actual", {}, {FREQ_BATTALION}}
+ };
+
+ class Flight {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, FLIGHT);
+ textColor = LVL3_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_BATTALION}},
+ {"Actual", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_BATTALION}},
+ {"CAS Support", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_ECHO_FLIGHT_CAS}},
+ {"Logistics", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_ECHO_FLIGHT_LOGISTICS}}
+ };
+ };
+
+ class Ground {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, GROUND);
+ textColor = LVL3_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_BATTALION}},
+ {"Actual", {}, {FREQ_ECHO_GROUND, FREQ_BATTALION}}
+ };
+
+ class Logistics {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, LOGISTICS);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_ECHO_GROUND}},
+ {"Actual", {}, {FREQ_ECHO_GROUND_LOGISTICS, FREQ_ECHO_GROUND}},
+ {"General", {}, {FREQ_ECHO_GROUND_LOGISTICS}},
+ {"Convoy", {}, {FREQ_CONVOY}}
+ };
+ };
+
+ class Attack {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ATTACK);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},
+ {"Actual", {}, {FREQ_ECHO_GROUND}},
+ {"General", {}, {FREQ_ECHO_GROUND}},
+ {"Convoy", {}, {FREQ_CONVOY}}
+ };
+ };
+
+ class Artillery {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ARTILLERY);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"General", {FREQ_ECHO_ARTY_INTERCOM}, {FREQ_ECHO_GROUND, FREQ_ECHO_ARTY}}
+ };
+ };
+ };
+ };
+ };
+};
\ No newline at end of file
diff --git a/functions/fbcb2/fn_addFBCB2DiaryEntries.sqf b/functions/fbcb2/fn_addFBCB2DiaryEntries.sqf
deleted file mode 100644
index 10936a4..0000000
--- a/functions/fbcb2/fn_addFBCB2DiaryEntries.sqf
+++ /dev/null
@@ -1,10 +0,0 @@
-if ( !hasInterface ) exitWith {};
-
-player createDiarySubject["Status","FBCB2 - Status"];
-player createDiarySubject["Intel","FBCB2 - Combat Msgs"];
-player createDiarySubject["Messages","FBCB2 - Messages"];
-
-
-diag_log text "[MILSIM] (fbcb2) diary entries added";
-
-nil;
\ No newline at end of file
diff --git a/functions/fbcb2/fn_messageFBCB2AssetStatus.sqf b/functions/fbcb2/fn_hintFBCB2AssetStatus.sqf
similarity index 100%
rename from functions/fbcb2/fn_messageFBCB2AssetStatus.sqf
rename to functions/fbcb2/fn_hintFBCB2AssetStatus.sqf
diff --git a/functions/fbcb2/fn_initFBCB2.sqf b/functions/fbcb2/fn_initFBCB2.sqf
index 4a4d3f4..ba00b91 100644
--- a/functions/fbcb2/fn_initFBCB2.sqf
+++ b/functions/fbcb2/fn_initFBCB2.sqf
@@ -1,8 +1,32 @@
+
if ( !hasInterface ) exitWith {};
waitUntil { !isNil "milsim_complete" };
-[] call milsim_fnc_processFBCB2Callsigns;
+milsim_fbcb2_recordTitleColor = "#ff6666";
+milsim_fbcb2_recordTitleFont = "PuristaMedium";
+milsim_fbcb2_recordTitleSize = 20;
+
+milsim_fbcb2_recordTextHeaderSize = 16;
+milsim_fbcb2_recordTextBodySize = 14;
+
+milsim_fbcb2_subjectStatusID = "FBCB2_Status";
+milsim_fbcb2_subjectIntelID = "FBCB2_Intel";
+milsim_fbcb2_subjectMessagesID = "FBCB2_Messages";
+milsim_fbcb2_subjectFrequenciesID = "FBCB2_Frequencies";
+
+player createDiarySubject[milsim_fbcb2_subjectStatusID, "FBCB2 - Status"];
+player createDiarySubject[milsim_fbcb2_subjectMessagesID, "FBCB2 - Messages"];
+player createDiarySubject[milsim_fbcb2_subjectIntelID, "FBCB2 - Intel"];
+player createDiarySubject[milsim_fbcb2_subjectFrequenciesID, "FBCB2 - Frequencies"];
+
+// store records in format:
+// [subject, [
+// [title, diaryRecord]
+// ]]
+milsim_fbcb2_diaryRecords = createHashMap;
+
+// populate diary
[] call milsim_fnc_processFBCB2FixedWingAssets;
[] call milsim_fnc_processFBCB2RotaryAssets;
[] call milsim_fnc_processFBCB2RadioFrequencies;
diff --git a/functions/fbcb2/fn_processFBCB2Callsigns.sqf b/functions/fbcb2/fn_processFBCB2Callsigns.sqf
deleted file mode 100644
index 0c1083b..0000000
--- a/functions/fbcb2/fn_processFBCB2Callsigns.sqf
+++ /dev/null
@@ -1,22 +0,0 @@
-
-_text = "
-=======------ Mission Data Set ------=======
-
-SPARTAN
-Command
-
-BLACKJACK
-Alpha Platoon
-
-ZOOMER
-Echo
-
-TIGER
-RRC
-
-BLACKFOOT
-Weapons Squad
-
-";
-
-player createDiaryRecord ["Status", ["MDS - COMMAND - CALLSIGNS", _text]];
\ No newline at end of file
diff --git a/functions/fbcb2/fn_processFBCB2Environment.sqf b/functions/fbcb2/fn_processFBCB2Environment.sqf
index 5c700fa..91c8bac 100644
--- a/functions/fbcb2/fn_processFBCB2Environment.sqf
+++ b/functions/fbcb2/fn_processFBCB2Environment.sqf
@@ -1,16 +1,45 @@
-_sunTimes = date call BIS_fnc_sunriseSunsetTime;
+private _recordTitle = "MDS - INTEL - ENVIRONMENT";
-_text = "
-=======------ Mission Data Set ------=======
-
-Local Sunrise
-
-" + ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString) + "
-
-Local Sunset
-
-" + ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString) + "
-
-";
+private _text = [
+ format[
+ "%4
",
+ milsim_fbcb2_recordTitleSize,
+ milsim_fbcb2_recordTitleColor,
+ milsim_fbcb2_recordTitleFont,
+ _recordTitle
+ ]
+];
-player createDiaryRecord ["Status", ["MDS - INTEL - ENVIRONMENT", _text]];
\ No newline at end of file
+private _sunriseColor = "#4A86E8";
+private _sunsetColor = "#6AA84F";
+private _whiteColor = "#FFFFFF";
+
+private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
+
+_text pushBack format[
+ "Local Sunrise
+ %5
",
+ milsim_fbcb2_recordTextHeaderSize,
+ _sunriseColor,
+ milsim_fbcb2_recordTextBodySize,
+ _whiteColor,
+ ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)
+];
+
+_text pushBack format[
+ "Local Sunset
+ %5
",
+ milsim_fbcb2_recordTextHeaderSize,
+ _sunsetColor,
+ milsim_fbcb2_recordTextBodySize,
+ _whiteColor,
+ ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)
+];
+
+_text = _text joinString "";
+
+[
+ milsim_fbcb2_subjectIntelID,
+ _recordTitle,
+ _text
+] call milsim_fnc_createOrUpdateDiaryRecord;
\ No newline at end of file
diff --git a/functions/fbcb2/fn_processFBCB2FixedWingAssets.sqf b/functions/fbcb2/fn_processFBCB2FixedWingAssets.sqf
index 539beb2..773e0e1 100644
--- a/functions/fbcb2/fn_processFBCB2FixedWingAssets.sqf
+++ b/functions/fbcb2/fn_processFBCB2FixedWingAssets.sqf
@@ -1,4 +1,6 @@
- _assetList = missionNamespace getVariable "milsim_var_fixedAssets";
+private _recordTitle = "MDS - ASSETS - FIXED";
+
+private _assetList = missionNamespace getVariable "milsim_var_fixedAssets";
_text = "=======------ Mission Data Set ------=======";
@@ -14,6 +16,11 @@ _text = "=======------ Mission Data Set ----
} foreach _assetList;
-_text = _text + "
Run Report on local node?";
+_text = _text + "
Run Report on local node?";
-player createDiaryRecord ["Status", ["MDS - ASSETS - FIXED", _text]];
\ No newline at end of file
+
+[
+ milsim_fbcb2_subjectStatusID,
+ _recordTitle,
+ _text
+] call milsim_fnc_createOrUpdateDiaryRecord;
\ No newline at end of file
diff --git a/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf b/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf
index 7e58dcf..69270a8 100644
--- a/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf
+++ b/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf
@@ -1,35 +1,50 @@
+// updated 2024-02-01 by IndigoFox
+// now reads from the battalion config structure to generate the diary entries
-_text = "
-=======------ Mission Data Set ------=======
-
-EXODUS
-
-6 - 45
-
-RTO - 45 / 35
-
-RIPTIDE
-
-Actual - 45 / 100
-
-Romeo - 45 / 35
-
-1 - 110 / 100
-
-2 - 120 / 100
-
-3 - 130 / 110
-
-Blackfoot - 150 / 100
-
-ECHO
-
-Impaler - 45 / 35
-
-JTAC - 35 / 82
-
-IDF - 82 / 100
-
-";
+////////////////////////////////////////
+// Get info from missionConfigFile
+////////////////////////////////////////
+private _battalionInfoCfg = call milsim_fnc_getBattalionCfg;
+private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
-player createDiaryRecord ["Status", ["MDS - INTEL - RADIO FREQS", _text]];
\ No newline at end of file
+////////////////////////////////////////
+// Define formatting constants
+////////////////////////////////////////
+private _ELEMENT_NAME_SIZE = 10;
+private _ELEMENT_NAME_FONT = "EtelkaMonospaceProBold";
+private _ELEMENT_FREQ_SIZE = 9;
+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
+////////////////////////////////////////
+
+// 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;
+ [
+ milsim_fbcb2_subjectFrequenciesID,
+ _diaryTitleText#0,
+ _diaryTitleText#1
+ ] call milsim_fnc_createOrUpdateDiaryRecord;
+} forEach _battalionElementCfgs;
+
+// add the battalion command to the top of the list
+// don't process child elements
+private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText;
+[
+ milsim_fbcb2_subjectFrequenciesID,
+ _diaryTitleText#0,
+ _diaryTitleText#1
+] call milsim_fnc_createOrUpdateDiaryRecord;
+
+true;
\ No newline at end of file
diff --git a/functions/fbcb2/fn_processFBCB2RotaryAssets.sqf b/functions/fbcb2/fn_processFBCB2RotaryAssets.sqf
index a9d40bf..95bdeda 100644
--- a/functions/fbcb2/fn_processFBCB2RotaryAssets.sqf
+++ b/functions/fbcb2/fn_processFBCB2RotaryAssets.sqf
@@ -1,4 +1,6 @@
- _assetList = missionNamespace getVariable "milsim_var_rotaryAssets";
+private _recordTitle = "MDS - ASSETS - ROTARY";
+
+_assetList = missionNamespace getVariable "milsim_var_rotaryAssets";
_text = "=======------ Mission Data Set ------=======";
@@ -14,6 +16,11 @@ _text = "=======------ Mission Data Set ----
} foreach _assetList;
-_text = _text + "
Run Report on local node?";
+_text = _text + "
Run Report on local node?";
-player createDiaryRecord ["Status", ["MDS - ASSETS - ROTARY", _text]];
\ No newline at end of file
+
+[
+ milsim_fbcb2_subjectStatusID,
+ _recordTitle,
+ _text
+] call milsim_fnc_createOrUpdateDiaryRecord;
\ No newline at end of file
diff --git a/functions/fbcb2/fn_processFBCB2SmokeColors.sqf b/functions/fbcb2/fn_processFBCB2SmokeColors.sqf
index 14a6212..1797d06 100644
--- a/functions/fbcb2/fn_processFBCB2SmokeColors.sqf
+++ b/functions/fbcb2/fn_processFBCB2SmokeColors.sqf
@@ -1,30 +1,41 @@
+private _recordTitle = "MDS - INTEL - SMOKES";
-_text = "
-=======------ Mission Data Set ------=======
-
-Smoke is a Guideline Not a Rule
-
-WHITE
-Concealment
-
-GREEN
-Friendly Forces
-
-BLUE
-LZ Markers
-
-RED
-Enemy Location
-
-ORANGE
-Resupply Marker
-
-YELLOW
-Medical Emergency
-
-PURPLE
-Broken Arrow - 100m radius
-
-";
+private _text = [
+ // Title
+ format[
+ "%4",
+ milsim_fbcb2_recordTitleSize,
+ milsim_fbcb2_recordTitleColor,
+ milsim_fbcb2_recordTitleFont,
+ _recordTitle
+ ]
+];
-player createDiaryRecord ["Status", ["MDS - INTEL - SMOKES", _text]];
\ No newline at end of file
+private _smokeColors = [
+ ["#FFFFFF", "WHITE", "Concealment"],
+ ["#008800", "GREEN", "Friendly Forces"],
+ ["#0000FF", "BLUE", "LZ Markers"],
+ ["#FF0000", "RED", "Enemy Location"],
+ ["#FFA500", "ORANGE", "Resupply Marker"],
+ ["#FFFF00", "YELLOW", "Medical Emergency"],
+ ["#800080", "PURPLE", "Broken Arrow - 100m radius"]
+];
+
+{
+ _x params ["_color", "_name", "_description"];
+ _text pushBack format[
+ "%3 - %4",
+ milsim_fbcb2_recordTextHeaderSize,
+ _color,
+ _name,
+ _description
+ ];
+} forEach _smokeColors;
+
+_text = _text joinString "
";
+
+[
+ milsim_fbcb2_subjectIntelID,
+ _recordTitle,
+ _text
+] call milsim_fnc_createOrUpdateDiaryRecord;
\ No newline at end of file
diff --git a/functions/fbcb2/radioFrequencies/fn_formatRadioElementForDiary.sqf b/functions/fbcb2/radioFrequencies/fn_formatRadioElementForDiary.sqf
new file mode 100644
index 0000000..8a4bdc0
--- /dev/null
+++ b/functions/fbcb2/radioFrequencies/fn_formatRadioElementForDiary.sqf
@@ -0,0 +1,73 @@
+// called from milsim_fnc_processFBCB2RadioFrequencies
+params ["_cfg", ["_indentCount", 1, [5]]];
+
+//////////////////////////////////////////////////////
+// Define leading space/hyphenation for element name
+//////////////////////////////////////////////////////
+private _leadingSpace = [
+ format["| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
+];
+for "_i" from 1 to _indentCount do {
+ _leadingSpace pushBack "-";
+};
+_leadingSpace pushBack " | ";
+
+/////////////////////////////////////////////////////////
+// Create the header line for the provided config entry
+/////////////////////////////////////////////////////////
+private _lines = [
+ format[
+ "%2%3",
+ getText(_cfg >> "textColor"),
+ _leadingSpace joinString "",
+ getText (_cfg >> "callsign")
+ ]
+];
+
+////////////////////////////////////////////////////////////
+// Create the frequency lines for the provided config entry
+////////////////////////////////////////////////////////////
+
+// Generate 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 "";
+
+// Process config values for frequencies
+{
+ _x params ["_role", "_sr", "_lr"];
+
+
+ private ["_srStr", "_lrStr"];
+ if (count _sr > 0) then {
+ _srStr = format["%1", _sr joinString " / "];
+ } else {
+ _srStr = "----";
+ };
+ if (count _lr > 0) then {
+ _lrStr = format["%1", _lr joinString " / "];
+ } else {
+ _lrStr = "----";
+ };
+
+ // Add formatted line to the array
+ _lines pushBack format[
+ "%1- %5%6%7",
+ _freqLeadingSpace,
+ _ELEMENT_FREQ_SIZE,
+ _ELEMENT_FREQ_FONT,
+ _FREQ_TEXT_COLOR,
+ [_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
+ [_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
+ _lrStr
+ ];
+} forEach (getArray (_cfg >> "frequencies"));
+// diag_log text (_lines joinString endl);
+
+// Return the formatted lines in ARRAY format
+_lines;
\ No newline at end of file
diff --git a/functions/fbcb2/radioFrequencies/fn_generateElementFrequencyRecordText.sqf b/functions/fbcb2/radioFrequencies/fn_generateElementFrequencyRecordText.sqf
new file mode 100644
index 0000000..113ede7
--- /dev/null
+++ b/functions/fbcb2/radioFrequencies/fn_generateElementFrequencyRecordText.sqf
@@ -0,0 +1,87 @@
+// 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];
\ No newline at end of file
diff --git a/functions/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf b/functions/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
new file mode 100644
index 0000000..89380e8
--- /dev/null
+++ b/functions/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
@@ -0,0 +1,18 @@
+params [
+ ["_subjectID", milsim_fbcb2_subjectStatusID, [""]],
+ ["_recordTitle", "", [""]],
+ ["_recordText", "", [""]]
+];
+
+// Check if already created
+private _subjectRecords = milsim_fbcb2_diaryRecords getOrDefault [_subjectID, createHashMap, true];
+private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
+
+if (!isNull _existingRecord) then {
+ player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText]];
+ systemChat format ["Updated diary record: %1", _recordTitle];
+} else {
+ private _new = player createDiaryRecord [_subjectID, [_recordTitle, _recordText]];
+ _subjectRecords set [_recordTitle, _new];
+ milsim_fbcb2_diaryRecords set [_subjectID, _subjectRecords];
+};
\ No newline at end of file
diff --git a/functions/util/fn_getBattalionCfg.sqf b/functions/util/fn_getBattalionCfg.sqf
new file mode 100644
index 0000000..b239a24
--- /dev/null
+++ b/functions/util/fn_getBattalionCfg.sqf
@@ -0,0 +1 @@
+(missionConfigFile >> "BattalionInfo")
\ No newline at end of file
diff --git a/functions/util/fn_log.sqf b/functions/util/fn_log.sqf
index 5b780b4..d80dbc2 100644
--- a/functions/util/fn_log.sqf
+++ b/functions/util/fn_log.sqf
@@ -18,7 +18,11 @@ params [
private _hash = createHashMapFromArray _data;
+// Replace square brackets with round brackets to avoid parsing issues.
+_message regexReplace ["\[", "("];
+_message regexReplace ["\]", ")"];
+
private _json = [_hash] call CBA_fnc_encodeJSON;
-_log = format ["[milsim] (%1) (%2) (%3) :: %4", _component, _fnc_scriptNameParent, _message, _json];
+_log = format ["[milsim] [%1] [%2] [%3] :: %4", _component, _fnc_scriptNameParent, _message, _json];
diag_log text _log;
\ No newline at end of file
diff --git a/functions/util/fn_padString.sqf b/functions/util/fn_padString.sqf
new file mode 100644
index 0000000..e5d3faf
--- /dev/null
+++ b/functions/util/fn_padString.sqf
@@ -0,0 +1,20 @@
+params [
+ ["_text", "", [""]],
+ ["_padSide", "left", ["left", "right"]],
+ ["_padChar", " ", [" "]],
+ ["_padLength", 4, [4]]
+];
+
+// pad a string with a character to a certain length
+if (_padSide == "left") then {
+ for "_i" from 1 to _padLength - count _text do {
+ _text = _padChar + _text;
+ };
+};
+if (_padSide == "right") then {
+ for "_i" from 1 to _padLength - count _text do {
+ _text = _text + _padChar;
+ };
+};
+
+_text
diff --git a/functions/util/fn_recurseSubclasses.sqf b/functions/util/fn_recurseSubclasses.sqf
new file mode 100644
index 0000000..b4ba431
--- /dev/null
+++ b/functions/util/fn_recurseSubclasses.sqf
@@ -0,0 +1,25 @@
+params [
+ ["_cfg", configNull, [configNull]],
+ ["_code", {}, [{}]]
+];
+
+if (isNull _cfg) exitWith {["Provided config is null!"] call BIS_fnc_error};
+
+
+private _recurseFnc = {
+ params ["_cfg", "_code", ["_recurseCounter", 0]];
+ [_cfg, _recurseCounter] call _code;
+ // get children and recurse
+ private _childCfgs = _cfg call BIS_fnc_returnChildren;
+ if (count _childCfgs isEqualTo 0) exitWith {false};
+
+ {
+ [_x, _code, _recurseCounter + 1] call _recurseFnc;
+ } forEach _childCfgs;
+ false;
+};
+
+private _continue = true;
+while {_continue} do {
+ _continue = [_cfg, _code] call _recurseFnc;
+};
\ No newline at end of file