Permalink
Fetching contributors…
Cannot retrieve contributors at this time
72 lines (64 sloc) 2.43 KB
/*
* Author: ACRE2Team
* Wrapper function for calling the signal calculation (extension).
*
* Arguments:
* 0: Frequency <NUMBER>
* 1: Power <NUMBER>
* 2: Receiving Radio ID <STRING>
* 3: Transmitting Radio ID <STRING>
*
* Return Value:
* Tuple of power and maximum signal strength <ARRAY>
*
* Example:
* [30, 5000, "ACRE_PRC343_ID_1", "ACRE_PRC343_ID_2"] call acre_sys_signal_fnc_getSignal
*
* Public: No
*/
#include "script_component.hpp"
if (!isNil QGVAR(customSignalFunc)) exitWith { _this call GVAR(customSignalFunc); };
params ["_f", "_mW", "_receiverClass", "_transmitterClass"];
private _count = (missionNamespace getVariable [_transmitterClass + "_running_count", 0]) max 0;
if (_count == 0) then {
private _rxAntennas = [_receiverClass] call EFUNC(sys_components,findAntenna);
private _txAntennas = [_transmitterClass] call EFUNC(sys_components,findAntenna);
{
private _txAntenna = _x;
{
private _rxAntenna = _x;
_count = _count + 1;
private _id = format["%1_%2_%3_%4", _transmitterClass, (_txAntenna select 0), _receiverClass, (_rxAntenna select 0)];
[
"process_signal",
[
_id,
(_txAntenna select 2),
(_txAntenna select 3),
(_txAntenna select 0),
(_rxAntenna select 2),
(_rxAntenna select 3),
(_rxAntenna select 0),
_f,
_mW,
GVAR(terrainScaling),
diag_tickTime,
ACRE_SIGNAL_DEBUGGING,
GVAR(omnidirectionalRadios)
],
true,
FUNC(handleSignalReturn),
[_transmitterClass, _receiverClass]
] call EFUNC(sys_core,callExt);
} forEach _rxAntennas;
} forEach _txAntennas;
missionNamespace setVariable [_transmitterClass + "_running_count", _count];
};
private _maxSignal = missionNamespace getVariable [_transmitterClass + "_best_signal", -992];
private _Px = missionNamespace getVariable [_transmitterClass + "_best_px", 0];
if (ACRE_SIGNAL_DEBUGGING > 0) then {
private _signalTrace = missionNamespace getVariable [_transmitterClass + "_signal_trace", []];
_signalTrace pushBack _maxSignal;
missionNamespace setVariable [_transmitterClass + "_signal_trace", _signalTrace];
};
[_Px, _maxSignal];