From 84685f4a84d22a130f5d583ef24eabe7a36f5055 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Fri, 14 Aug 2015 02:22:15 +0200 Subject: [PATCH] add dayOfWeek and updateMemory to Own File Update some Comments Fixing Spelling Issue --- addons/kestrel4500/XEH_preInit.sqf | 21 ++-------------- .../functions/fnc_createKestrelDialog.sqf | 3 ++- .../kestrel4500/functions/fnc_dayOfWeek.sqf | 25 +++++++++++++++++++ .../functions/fnc_displayKestrel.sqf | 4 +-- .../functions/fnc_generateOutputData.sqf | 2 +- .../functions/fnc_onCloseDialog.sqf | 2 +- .../functions/fnc_onCloseDisplay.sqf | 2 +- .../functions/fnc_updateMemory.sqf | 20 +++++++++++++++ .../functions/script_component.hpp | 2 +- 9 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 addons/kestrel4500/functions/fnc_dayOfWeek.sqf create mode 100644 addons/kestrel4500/functions/fnc_updateMemory.sqf diff --git a/addons/kestrel4500/XEH_preInit.sqf b/addons/kestrel4500/XEH_preInit.sqf index b7d66cbb94..b89f07173f 100644 --- a/addons/kestrel4500/XEH_preInit.sqf +++ b/addons/kestrel4500/XEH_preInit.sqf @@ -15,23 +15,6 @@ PREP(restoreUserData); PREP(storeUserData); PREP(updateDisplay); PREP(updateImpellerState); - +PREP(updateMemory); +PREP(dayOfWeek) ADDON = true; - -FUNC(updateMemory) = { - params ["_slot", "_value"]; - GVAR(MIN) set [_slot, (GVAR(MIN) select _slot) min _value]; - GVAR(MAX) set [_slot, _value max (GVAR(MAX) select _slot)]; - GVAR(TOTAL) set [_slot, (GVAR(TOTAL) select _slot) + _value]; -}; - -FUNC(dayOfWeek) = { - private "_table"; - params ["_year", "_month", "_day"]; - - _table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; - if (_month < 3) then { - _year = _year - 1; - }; - (_year + floor(_year/4) - floor(_year/100) + floor(_year/400) + (_table select (_month - 1)) + _day) % 7 -}; diff --git a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf index 23ca70543b..a11982968c 100644 --- a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf +++ b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf @@ -6,9 +6,10 @@ * None * * Return Value: - * Nothing + * None * * Example: + * call ace_kestrel4500_fnc_createKestrelDialog * * Public: No */ diff --git a/addons/kestrel4500/functions/fnc_dayOfWeek.sqf b/addons/kestrel4500/functions/fnc_dayOfWeek.sqf new file mode 100644 index 0000000000..9e142f661c --- /dev/null +++ b/addons/kestrel4500/functions/fnc_dayOfWeek.sqf @@ -0,0 +1,25 @@ +/* + * Author: Ruthberg + * Calculate Current Day in the Week + * + * Arguments: + * 0: Year + * 1: Month + * 2: Day + * + * Return Value: + * Day of The Week + * + * Example: + * [1995, 10, 21] call ace_kestrel4500_fnc_buttonPressed + * + * Public: No + */ +private "_table"; +params ["_year", "_month", "_day"]; + +_table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; +if (_month < 3) then { + _year = _year - 1; +}; +(_year + floor(_year/4) - floor(_year/100) + floor(_year/400) + (_table select (_month - 1)) + _day) % 7 diff --git a/addons/kestrel4500/functions/fnc_displayKestrel.sqf b/addons/kestrel4500/functions/fnc_displayKestrel.sqf index 63a162a7b0..770347ec71 100644 --- a/addons/kestrel4500/functions/fnc_displayKestrel.sqf +++ b/addons/kestrel4500/functions/fnc_displayKestrel.sqf @@ -6,10 +6,10 @@ * None * * Return Value: - * Nothing + * None * * Example: - * call ace_kestrel4500_fnc_displayKestrell + * call ace_kestrel4500_fnc_displayKestrel * * Public: No */ diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index de62da31ff..016baebef7 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -25,7 +25,7 @@ * 15: Center Line 6 * * Example: - * _var = call ace_kestrell4500_fnc_generateOutputData + * _var = call ace_kestrel4500_fnc_generateOutputData * * Public: No */ diff --git a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf index 11fa76ff18..2474f30d94 100644 --- a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf +++ b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf @@ -1,6 +1,6 @@ /* * Author: Ruthberg - * Called if Kestrell Dialog is closed + * Called if Kestrel Dialog is closed * * Arguments: * None diff --git a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf index 9228aedcef..bdc701ddb1 100644 --- a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf +++ b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf @@ -1,6 +1,6 @@ /* * Author: Ruthberg - * Called if Kestrell Display is closed + * Called if Kestrel Display is closed * * Arguments: * None diff --git a/addons/kestrel4500/functions/fnc_updateMemory.sqf b/addons/kestrel4500/functions/fnc_updateMemory.sqf new file mode 100644 index 0000000000..f38e9ee6df --- /dev/null +++ b/addons/kestrel4500/functions/fnc_updateMemory.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ruthberg + * Update Memory of Kestrel + * + * Arguments: + * 0: Slot + * 1: Value + * + * Return Value: + * None + * + * Example: + * [1, "test"] call ace_kestrel4500_fnc_updateMemory + * + * Public: No + */ +params ["_slot", "_value"]; +GVAR(MIN) set [_slot, (GVAR(MIN) select _slot) min _value]; +GVAR(MAX) set [_slot, _value max (GVAR(MAX) select _slot)]; +GVAR(TOTAL) set [_slot, (GVAR(TOTAL) select _slot) + _value]; diff --git a/addons/kestrel4500/functions/script_component.hpp b/addons/kestrel4500/functions/script_component.hpp index 32c774cd89..bc42218de7 100644 --- a/addons/kestrel4500/functions/script_component.hpp +++ b/addons/kestrel4500/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\kestrel4500\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\kestrel4500\script_component.hpp"