move-battalion-struct-to-missioncfg #15
@@ -15,9 +15,7 @@ class milsim
|
||||
};
|
||||
|
||||
class fbcb2 {
|
||||
class addFBCB2DiaryEntries { postInit = 1; };
|
||||
class initFBCB2 { postInit = 1; };
|
||||
class processFBCB2Callsigns {};
|
||||
class processFBCB2FixedWingAssets {};
|
||||
class processFBCB2RotaryAssets {};
|
||||
class processFBCB2RadioFrequencies {};
|
||||
@@ -25,6 +23,15 @@ class milsim
|
||||
class processFBCB2Environment {};
|
||||
class messageFBCB2AssetStatus {};
|
||||
};
|
||||
class fbcb2_util {
|
||||
file = "functions\fbcb2\util";
|
||||
class createOrUpdateDiaryRecord {};
|
||||
};
|
||||
class fbcb2_radioFrequencies {
|
||||
file = "functions\fbcb2\radioFrequencies";
|
||||
class formatRadioElementForDiary {};
|
||||
class generateElementFrequencyRecordText {};
|
||||
};
|
||||
|
||||
class client {
|
||||
class addZenModules { postInit = 1; };
|
||||
|
||||
@@ -67,6 +67,7 @@ class BattalionInfo {
|
||||
// frequencies are in format:
|
||||
// {roleWithinElement, {primarySR, additionalSR}, {primaryLR, additionalLR}}
|
||||
frequencies[] = {
|
||||
{"Contact", {}, {FREQ_BATTALION}},
|
||||
{"Actual", {}, {FREQ_BATTALION}},
|
||||
{"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
|
||||
};
|
||||
@@ -77,6 +78,7 @@ class BattalionInfo {
|
||||
shortDescription = "RRC";
|
||||
textColor = LVL2_TEXT_COLOR;
|
||||
frequencies[] = {
|
||||
{"Contact", {}, {FREQ_BATTALION}},
|
||||
{"Actual", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
|
||||
};
|
||||
};
|
||||
@@ -86,18 +88,20 @@ class BattalionInfo {
|
||||
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 WeaponsPlatoon { // WIP
|
||||
// callsign = WPN_CALLSIGN;
|
||||
// textColor = LVL2_TEXT_COLOR;
|
||||
// frequencies[] = {
|
||||
// {"Actual", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
|
||||
// };
|
||||
// };
|
||||
class WeaponsSquad { // WIP
|
||||
callsign = WPN_CALLSIGN;
|
||||
shortDescription = "Special Weapons Squad";
|
||||
textColor = LVL2_TEXT_COLOR;
|
||||
frequencies[] = {
|
||||
{"Contact", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class AlphaCompany {
|
||||
@@ -105,15 +109,15 @@ class BattalionInfo {
|
||||
shortDescription = "Alpha Company";
|
||||
textColor = LVL2_TEXT_COLOR;
|
||||
frequencies[] = {
|
||||
{"Actual", {}, {FREQ_COMPANY, FREQ_BATTALION}},
|
||||
{"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS, FREQ_ECHO_FLIGHT_LOGISTICS}}
|
||||
{"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_COMPANY}}
|
||||
{"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);
|
||||
@@ -151,7 +155,7 @@ class BattalionInfo {
|
||||
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-6);
|
||||
textColor = LVL3_TEXT_COLOR;
|
||||
frequencies[] = {
|
||||
{"Actual", {FREQ_PLATOON2_SR, FREQ_PLATOON2_RTO}, {FREQ_PLATOON2, FREQ_COMPANY}}
|
||||
{"Actual", {FREQ_PLATOON2_SR, FREQ_PLATOON2_RTO}, {FREQ_PLATOON2_LR, FREQ_ALPHA_COMPANY}}
|
||||
};
|
||||
class Squad1 {
|
||||
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-1);
|
||||
@@ -191,6 +195,7 @@ class BattalionInfo {
|
||||
shortDescription = "Echo Company";
|
||||
textColor = LVL2_TEXT_COLOR;
|
||||
frequencies[] = {
|
||||
{"Contact", {}, {FREQ_BATTALION}},
|
||||
{"Actual", {}, {FREQ_BATTALION}}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -1,8 +1,29 @@
|
||||
|
||||
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_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;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
_text = "
|
||||
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>SPARTAN</font><br/>
|
||||
Command
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>BLACKJACK</font><br/>
|
||||
Alpha Platoon
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>ZOOMER</font><br/>
|
||||
Echo
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>TIGER</font><br/>
|
||||
RRC
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>BLACKFOOT</font><br/>
|
||||
Weapons Squad
|
||||
<br/><br/>
|
||||
";
|
||||
|
||||
|
||||
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 ["<font color='#00FF00' size='16'>%1</font><br/>%2", _callsign, _desc];
|
||||
} forEach _battalionLevelElements;
|
||||
|
||||
_text = _text joinString "<br/><br/>";
|
||||
|
||||
player createDiaryRecord ["Status", ["MDS - COMMAND - CALLSIGNS", _text]];
|
||||
@@ -1,8 +1,16 @@
|
||||
_sunTimes = date call BIS_fnc_sunriseSunsetTime;
|
||||
private _recordTitle = "MDS - INTEL - ENVIRONMENT";
|
||||
|
||||
_text = "
|
||||
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
|
||||
<br/><br/>
|
||||
|
||||
_sunTimes = date call BIS_fnc_sunriseSunsetTime;
|
||||
|
||||
_text = format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
];
|
||||
_text = _text + "
|
||||
<font size='16' color='#4A86E8'>Local Sunrise</font>
|
||||
<br/>
|
||||
<font size='20' color='#FF0000'>" + ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString) + "</font>
|
||||
@@ -13,4 +21,10 @@ _text = "
|
||||
<br/><br/>
|
||||
";
|
||||
|
||||
player createDiaryRecord ["Status", ["MDS - INTEL - ENVIRONMENT", _text]];
|
||||
player createDiaryRecord ["Status", ["MDS - INTEL - ENVIRONMENT", _text]];
|
||||
|
||||
[
|
||||
milsim_fbcb2_subjectIntelID,
|
||||
_recordTitle,
|
||||
_text
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
@@ -1,108 +1,53 @@
|
||||
// updated 2024-02-01 by IndigoFox
|
||||
// now reads from the battalion config structure
|
||||
|
||||
private _formatElementForDiary = {
|
||||
params ["_cfg", "_indentCount"];
|
||||
|
||||
private _leadingSpace = [
|
||||
format["<font size='%1'>| ", _ELEMENT_NAME_SIZE]
|
||||
];
|
||||
for "_i" from 1 to _indentCount do {
|
||||
_leadingSpace pushBack "-";
|
||||
};
|
||||
_leadingSpace pushBack " | </font>";
|
||||
|
||||
// make header line
|
||||
private _lines = [
|
||||
format[
|
||||
"<font size='%1' face='EtelkaMonospaceProBold' color='%2'>%3%4</font>",
|
||||
_ELEMENT_NAME_SIZE,
|
||||
getText(_cfg >> "textColor"),
|
||||
_leadingSpace joinString "",
|
||||
getText (_cfg >> "callsign")
|
||||
]
|
||||
];
|
||||
|
||||
// make frequency lines
|
||||
private _freqLeadingSpace = [
|
||||
format["<font size='%1'>| ", _ELEMENT_NAME_SIZE]
|
||||
];
|
||||
for "_i" from 1 to _indentCount + 4 do {
|
||||
_freqLeadingSpace pushBack " ";
|
||||
};
|
||||
_freqLeadingSpace pushBack "</font>";
|
||||
_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<font size='%2' color='%3'>- %4%5%6 -</font>",
|
||||
_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<br/>",
|
||||
_allText,
|
||||
_lines joinString "<br/>"
|
||||
];
|
||||
};
|
||||
|
||||
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 pushBack (_lines joinString "<br/>");
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
_allText = "
|
||||
<font size='16' color='#ff0000'>=======------ Mission Data Set ------=======</font>
|
||||
<font face='EtelkaMonospacePro'><br/><br/>";
|
||||
|
||||
private _battalionInfoCfgs = [call milsim_fnc_getBattalionCfg] call BIS_fnc_returnChildren;
|
||||
private _battalionInfoCfg = call milsim_fnc_getBattalionCfg;
|
||||
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
|
||||
private _ELEMENT_NAME_SIZE = 10;
|
||||
private _ELEMENT_FREQ_SIZE = 8;
|
||||
private _FREQ_PAD_LENGTH = 14;
|
||||
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";
|
||||
|
||||
|
||||
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
|
||||
reverse _battalionElementCfgs;
|
||||
{
|
||||
_x call _recurseAddElements;
|
||||
} forEach _battalionInfoCfgs;
|
||||
// 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;
|
||||
|
||||
_allText = format["%1</font>", _allText];
|
||||
|
||||
player createDiaryRecord ["Status", ["MDS - INTEL - RADIO FREQS", _allText]];
|
||||
// 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;
|
||||
@@ -0,0 +1,62 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||
params ["_cfg", ["_indentCount", 1, [5]]];
|
||||
|
||||
private _leadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _indentCount do {
|
||||
_leadingSpace pushBack "-";
|
||||
};
|
||||
_leadingSpace pushBack " | </font>";
|
||||
|
||||
// make header line
|
||||
private _lines = [
|
||||
format[
|
||||
"<font color='%1'>%2%3</font>",
|
||||
getText(_cfg >> "textColor"),
|
||||
_leadingSpace joinString "",
|
||||
getText (_cfg >> "callsign")
|
||||
]
|
||||
];
|
||||
|
||||
// make frequency lines
|
||||
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 "";
|
||||
|
||||
{
|
||||
_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 = "----";
|
||||
};
|
||||
|
||||
|
||||
_lines pushBack format[
|
||||
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
|
||||
_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);
|
||||
|
||||
_lines;
|
||||
@@ -0,0 +1,60 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||
params [
|
||||
["_elementCfg", configNull, [configNull]],
|
||||
["_shouldProcessChildCfgs", true]
|
||||
];
|
||||
|
||||
if (isNull _elementCfg) exitWith {
|
||||
["_elementCfg parameter is NULL"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _battalionElement = _elementCfg;
|
||||
|
||||
private _recordTitle = format[
|
||||
"%1 (%2)",
|
||||
getText(_battalionElement >> "callsign"),
|
||||
getText(_battalionElement >> "shortDescription")
|
||||
];
|
||||
// systemChat _recordTitle;
|
||||
|
||||
private _headers = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
|
||||
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/>",
|
||||
_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"
|
||||
]
|
||||
];
|
||||
|
||||
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 "<br/>");
|
||||
}] call milsim_fnc_recurseSubclasses;
|
||||
} else {
|
||||
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
};
|
||||
|
||||
|
||||
_allText = format["%1<font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/>"];
|
||||
|
||||
[_recordTitle, _allText];
|
||||
18
functions/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
18
functions/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
@@ -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];
|
||||
};
|
||||
@@ -5,10 +5,21 @@ params [
|
||||
|
||||
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;
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user