2015-02-21 20:53:07 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Add an entry to the specified log
|
2015-02-21 20:47:10 +00:00
|
|
|
*
|
2015-02-21 20:53:07 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: The patient <OBJECT>
|
|
|
|
* 1: The log type <STRING>
|
|
|
|
* 2: The message <STRING>
|
|
|
|
* 3: The arguments for localization <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* nil
|
|
|
|
*
|
|
|
|
* Public: Yes
|
2015-02-21 20:47:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
private ["_unit", "_type", "_message", "_arguments", "_lastNumber", "_moment", "_logVarName", "_log","_newLog"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_type = _this select 1;
|
|
|
|
_message = _this select 2;
|
|
|
|
_arguments = _this select 3;
|
|
|
|
|
|
|
|
if (!local _unit) exitwith {
|
2015-02-28 12:02:05 +00:00
|
|
|
[_this, QUOTE(DFUNC(addToLog)), _unit] call EFUNC(common,execRemoteFnc);
|
2015-02-21 20:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_lastNumber = date select 4;
|
|
|
|
_moment = format["%1:%2",date select 3, _lastNumber];
|
|
|
|
if (_lastNumber < 10) then {
|
|
|
|
_moment = format["%1:0%2",date select 3, _lastNumber];
|
|
|
|
};
|
|
|
|
_logVarName = format[QGVAR(logFile_%1), _type];
|
|
|
|
|
|
|
|
_log = _unit getvariable [_logVarName, []];
|
|
|
|
if (count _log >= 8) then {
|
|
|
|
_newLog = [];
|
|
|
|
{
|
|
|
|
// ensure the first element will not be added
|
|
|
|
if (_foreachIndex > 0) then {
|
|
|
|
_newLog pushback _x;
|
|
|
|
};
|
|
|
|
}foreach _log;
|
|
|
|
_log = _newLog;
|
|
|
|
};
|
|
|
|
_log pushback [_message,_moment,_type, _arguments];
|
|
|
|
|
|
|
|
_unit setvariable [_logVarName, _log, true];
|
|
|
|
["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call ace_common_fnc_localEvent;
|
2015-02-28 10:47:35 +00:00
|
|
|
|
|
|
|
_logs = _unit getvariable [QGVAR(allLogs), []];
|
|
|
|
if !(_logVarName in _logs) then {
|
|
|
|
_logs pushback _logVarName;
|
|
|
|
_unit setvariable [QGVAR(allLogs), _logs, true];
|
|
|
|
};
|