2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2020-10-29 16:36:59 +00:00
|
|
|
/*
|
2024-01-07 18:06:35 +00:00
|
|
|
* Author: Freddo, Daniël H.
|
2020-10-29 16:36:59 +00:00
|
|
|
* When the confirm button is pressed.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Confirm button <CONTROL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_buttonOk] call ACE_markers_fnc_onButtonClickConfirm
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
params ["_buttonOk"];
|
|
|
|
|
|
|
|
private _display = ctrlParent _buttonOk;
|
2024-01-07 18:06:35 +00:00
|
|
|
private _description = _display displayCtrl IDC_INSERT_MARKER;
|
2020-10-29 16:36:59 +00:00
|
|
|
private _aceTimestamp = _display displayCtrl IDC_ACE_INSERT_MARKER_TIMESTAMP;
|
|
|
|
|
2021-02-26 23:17:00 +00:00
|
|
|
// handle timestamp
|
|
|
|
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
|
2024-01-07 18:06:35 +00:00
|
|
|
// determine marker timestamp based on time settings
|
|
|
|
private _time = switch (GVAR(timestampTimezone)) do {
|
|
|
|
case 1: {
|
|
|
|
systemTime params ["", "", "", "_hour", "_min", "_sec"];
|
|
|
|
_hour + _min/60 + _sec/3600
|
|
|
|
};
|
|
|
|
case 2: {
|
|
|
|
systemTimeUTC params ["", "", "", "_hour", "_min", "_sec"];
|
|
|
|
_hourOffset = round (GVAR(timestampUTCOffset));
|
|
|
|
_hour = _hour + _hourOffset;
|
|
|
|
|
|
|
|
// add or subtract minutes offset based on the negative or positive timezone
|
|
|
|
_min = if (_hourOffset < 0) then { _min - GVAR(timestampUTCMinutesOffset) } else { _min + GVAR(timestampUTCMinutesOffset) };
|
|
|
|
|
|
|
|
// prevent the timestamp from exceeding 24 hours or going below 0 hours
|
|
|
|
_time = ((_hour + _min/60 + _sec/3600) % 24 + 24) % 24;
|
|
|
|
_time
|
|
|
|
};
|
|
|
|
default {
|
|
|
|
dayTime
|
|
|
|
};
|
|
|
|
};
|
2021-02-26 23:17:00 +00:00
|
|
|
|
|
|
|
// add timestamp suffix
|
|
|
|
private _periodPostfix = "";
|
|
|
|
if (GVAR(timestampHourFormat) == 12) then {
|
|
|
|
if (floor _time == 0) exitWith {
|
|
|
|
_time = _time + 12;
|
|
|
|
_periodPostfix = " am";
|
|
|
|
};
|
|
|
|
|
|
|
|
if (floor _time == 12) exitWith {
|
|
|
|
_periodPostfix = " pm";
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_time < 12) then {
|
|
|
|
_periodPostfix = " am";
|
|
|
|
} else {
|
|
|
|
_time = _time - 12;
|
|
|
|
_periodPostfix = " pm";
|
|
|
|
};
|
2020-10-29 16:36:59 +00:00
|
|
|
};
|
|
|
|
|
2021-02-26 23:17:00 +00:00
|
|
|
_description ctrlSetText format [
|
|
|
|
"%1 [%2%3]",
|
2020-10-29 16:36:59 +00:00
|
|
|
ctrlText _description,
|
|
|
|
[_time, GVAR(timestampFormat)] call BIS_fnc_timeToString,
|
2021-02-26 23:17:00 +00:00
|
|
|
_periodPostfix
|
2020-10-29 16:36:59 +00:00
|
|
|
];
|
|
|
|
};
|