many changes. includes rework of baselocation-asset storage format
This commit is contained in:
75
framework/fbcb2_main/util/fn_formatRadioElementForDiary.sqf
Normal file
75
framework/fbcb2_main/util/fn_formatRadioElementForDiary.sqf
Normal file
@@ -0,0 +1,75 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||
#include "../script_component.hpp"
|
||||
|
||||
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]
|
||||
];
|
||||
for "_i" from 1 to _indentCount do {
|
||||
_leadingSpace pushBack "-";
|
||||
};
|
||||
_leadingSpace pushBack " | </font>";
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Create the header line for the provided config entry
|
||||
/////////////////////////////////////////////////////////
|
||||
private _lines = [
|
||||
format[
|
||||
"<font color='%1'>%2%3</font>",
|
||||
getText(_cfg >> "textColor"),
|
||||
_leadingSpace joinString "",
|
||||
getText (_cfg >> "callsign")
|
||||
]
|
||||
];
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// 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]
|
||||
];
|
||||
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
|
||||
_freqLeadingSpace pushBack " ";
|
||||
};
|
||||
_freqLeadingSpace pushBack "</font>";
|
||||
_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<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 EFUNC(util,padString),
|
||||
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
|
||||
_lrStr
|
||||
];
|
||||
} forEach (getArray (_cfg >> "frequencies"));
|
||||
// diag_log text (_lines joinString endl);
|
||||
|
||||
// Return the formatted lines in ARRAY format
|
||||
_lines;
|
||||
Reference in New Issue
Block a user