diff --git a/description.ext b/description.ext
index 5bc6cb1..f319951 100644
--- a/description.ext
+++ b/description.ext
@@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "mission_settings.hpp"
+#include "functions\definitions\BattalionInfo.hpp"
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/functions/CfgFunctions.hpp b/functions/CfgFunctions.hpp
index 7e8f088..fcb9e91 100644
--- a/functions/CfgFunctions.hpp
+++ b/functions/CfgFunctions.hpp
@@ -75,6 +75,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..b4a3bff
--- /dev/null
+++ b/functions/definitions/BattalionInfo.hpp
@@ -0,0 +1,243 @@
+// 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[] = {
+ {"Actual", {}, {FREQ_BATTALION}},
+ {"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
+ };
+
+
+ class RRC { // WIP
+ callsign = RRC_CALLSIGN;
+ shortDescription = "RRC";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
+ };
+ };
+
+ class BattalionMedical { // WIP
+ callsign = MEDIC_CALLSIGN;
+ shortDescription = "Battalion Medical";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"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 WeaponsPlatoon { // WIP
+ // callsign = WPN_CALLSIGN;
+ // textColor = LVL2_TEXT_COLOR;
+ // frequencies[] = {
+ // {"Actual", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
+ // };
+ // };
+
+
+ class AlphaCompany {
+ callsign = ALPHA_CALLSIGN;
+ shortDescription = "Alpha Company";
+ textColor = LVL2_TEXT_COLOR;
+ frequencies[] = {
+ {"Actual", {}, {FREQ_COMPANY, FREQ_BATTALION}},
+ {"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS, FREQ_ECHO_FLIGHT_LOGISTICS}}
+ };
+
+ 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_COMPANY}}
+ };
+ 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, FREQ_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[] = {
+ {"Actual", {}, {FREQ_BATTALION}}
+ };
+
+ class Flight {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, FLIGHT);
+ textColor = LVL3_TEXT_COLOR;
+ frequencies[] = {
+ {"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[] = {
+ {"Actual", {}, {FREQ_ECHO_GROUND, FREQ_BATTALION}}
+ };
+
+ class Logistics {
+ callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, LOGISTICS);
+ textColor = LVL4_TEXT_COLOR;
+ frequencies[] = {
+ {"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[] = {
+ {"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_processFBCB2Callsigns.sqf b/functions/fbcb2/fn_processFBCB2Callsigns.sqf
index 0c1083b..545511c 100644
--- a/functions/fbcb2/fn_processFBCB2Callsigns.sqf
+++ b/functions/fbcb2/fn_processFBCB2Callsigns.sqf
@@ -19,4 +19,20 @@ Weapons Squad
";
+
+private _text = [];
+
+private _battalionCfg = call milsim_fnc_getBattalionCfg;
+private _commandCfg = _battalionCfg >> "Command";
+private _battalionLevelElements = [_commandCfg] call BIS_fnc_returnChildren;
+
+{
+ private _cfg = _x;
+ private _callsign = getText (_cfg >> "callsign");
+ private _desc = getText (_cfg >> "shortDescription");
+ _text pushBack format ["%1
%2", _callsign, _desc];
+} forEach _battalionLevelElements;
+
+_text = _text joinString "
";
+
player createDiaryRecord ["Status", ["MDS - COMMAND - CALLSIGNS", _text]];
\ No newline at end of file
diff --git a/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf b/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf
index 7e58dcf..8902d03 100644
--- a/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf
+++ b/functions/fbcb2/fn_processFBCB2RadioFrequencies.sqf
@@ -1,35 +1,108 @@
+// updated 2024-02-01 by IndigoFox
+// now reads from the battalion config structure
-_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
-
-";
+private _formatElementForDiary = {
+ params ["_cfg", "_indentCount"];
-player createDiaryRecord ["Status", ["MDS - INTEL - RADIO FREQS", _text]];
\ No newline at end of file
+ private _leadingSpace = [
+ format["| ", _ELEMENT_NAME_SIZE]
+ ];
+ for "_i" from 1 to _indentCount do {
+ _leadingSpace pushBack "-";
+ };
+ _leadingSpace pushBack " | ";
+
+ // make header line
+ private _lines = [
+ format[
+ "%3%4",
+ _ELEMENT_NAME_SIZE,
+ getText(_cfg >> "textColor"),
+ _leadingSpace joinString "",
+ getText (_cfg >> "callsign")
+ ]
+ ];
+
+ // make frequency lines
+ private _freqLeadingSpace = [
+ format["| ", _ELEMENT_NAME_SIZE]
+ ];
+ for "_i" from 1 to _indentCount + 4 do {
+ _freqLeadingSpace pushBack " ";
+ };
+ _freqLeadingSpace pushBack "";
+ _freqLeadingSpace = _freqLeadingSpace joinString "";
+
+ {
+ _x params ["_role", "_sr", "_lr"];
+
+
+ private ["_srStr", "_lrStr"];
+ if (count _sr > 0) then {
+ _srStr = format["SR [%1]", _sr joinString "/"];
+ } else {
+ _srStr = "----";
+ };
+ if (count _lr > 0) then {
+ _lrStr = format["LR [%1]", _lr joinString "/"];
+ } else {
+ _lrStr = "----";
+ };
+
+
+ _lines pushBack format[
+ "%1- %4%5%6 -",
+ _freqLeadingSpace,
+ _ELEMENT_FREQ_SIZE,
+ _FREQ_TEXT_COLOR,
+ [_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
+ [_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
+ [_lrStr, "right", " ", 8] call milsim_fnc_padString
+ ];
+ } forEach (getArray (_cfg >> "frequencies"));
+
+ _lines;
+};
+
+private _addToAllText = {
+ params [["_lines", []]];
+
+ _allText = format[
+ "%1%2
",
+ _allText,
+ _lines joinString "
"
+ ];
+};
+
+private _recurseAddElements = {
+ params ["_cfg", ["_indentCount", 1]];
+
+ // add config
+ private _lines = [_cfg, _indentCount] call _formatElementForDiary;
+ [_lines] call _addToAllText;
+
+ // get children and recurse
+ _childCfgs = _cfg call BIS_fnc_returnChildren;
+ {
+ [_x, _indentCount+1] call _recurseAddElements;
+ } forEach _childCfgs;
+};
+
+////////////////////////////////////////
+_allText = "
+=======------ Mission Data Set ------=======
+
";
+
+private _battalionInfoCfgs = [call milsim_fnc_getBattalionCfg] call BIS_fnc_returnChildren;
+private _ELEMENT_NAME_SIZE = 10;
+private _ELEMENT_FREQ_SIZE = 8;
+private _FREQ_PAD_LENGTH = 14;
+private _FREQ_TEXT_COLOR = "#CCCCCC";
+
+{
+ _x call _recurseAddElements;
+} forEach _battalionInfoCfgs;
+
+_allText = format["%1", _allText];
+
+player createDiaryRecord ["Status", ["MDS - INTEL - RADIO FREQS", _allText]];
\ 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_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..6d483f5
--- /dev/null
+++ b/functions/util/fn_recurseSubclasses.sqf
@@ -0,0 +1,14 @@
+params [
+ ["_cfg", configNull, [configNull]],
+ ["_code", {}, [{}]]
+];
+
+if (isNull _cfg) exitWith {["Provided config is null!"] call BIS_fnc_error};
+
+[_cfg] call _code;
+
+// get children and recurse
+private _childCfgs = _cfg call BIS_fnc_returnChildren;
+{
+ [_x, _code] call milsim_fnc_recurseSubclasses;
+} forEach _childCfgs;
\ No newline at end of file