From a078d732308ed55df5c2ec3dc334fa15bf1daf6b Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 27 Sep 2015 08:51:42 +0200 Subject: [PATCH] Code Cleanup WeaponSelect --- addons/common/XEH_postInit.sqf | 4 ++-- addons/weaponselect/ACE_Settings.hpp | 1 + addons/weaponselect/CfgEventHandlers.hpp | 4 ++-- addons/weaponselect/XEH_postInit.sqf | 2 +- .../fnc_displayGrenadeTypeAndNumber.sqf | 16 ++++++++-------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index e374a7a716..54bf79d61f 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -375,8 +375,8 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { // @todo still needed? [QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable); -["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler); -["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler); +["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler); +["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler); ["medical_onUnconscious", { params ["_unit", "_isUnconscious"]; diff --git a/addons/weaponselect/ACE_Settings.hpp b/addons/weaponselect/ACE_Settings.hpp index 7b60527449..2214451247 100644 --- a/addons/weaponselect/ACE_Settings.hpp +++ b/addons/weaponselect/ACE_Settings.hpp @@ -1,3 +1,4 @@ + class ACE_Settings { class GVAR(DisplayText) { typeName = "BOOL"; diff --git a/addons/weaponselect/CfgEventHandlers.hpp b/addons/weaponselect/CfgEventHandlers.hpp index f409a36e5a..fd928fde2a 100644 --- a/addons/weaponselect/CfgEventHandlers.hpp +++ b/addons/weaponselect/CfgEventHandlers.hpp @@ -13,8 +13,8 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { - class GVAR(ThrowGrenade) { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)};); + class GVAR(throwGrenade) { + clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)}); }; }; }; diff --git a/addons/weaponselect/XEH_postInit.sqf b/addons/weaponselect/XEH_postInit.sqf index 3da7fda785..4d0df68f52 100644 --- a/addons/weaponselect/XEH_postInit.sqf +++ b/addons/weaponselect/XEH_postInit.sqf @@ -3,7 +3,7 @@ if (!hasInterface) exitWith {}; -// Add keybinds +// add keybinds ["ACE3 Weapons", QGVAR(SelectPistolNew), localize LSTRING(SelectPistol), { // Conditions: canInteract diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 37956d2121..6ae945e2fd 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -1,10 +1,10 @@ /* - * Author: esteldunedain + * Author: esteldunedain, commy2 * Display a grenade type and quantity. * * Arguments: - * 0: magazine class - * 1: number of magazines + * 0: grenade magazine class + * 1: number of grenades * * Return Value: * None @@ -18,14 +18,14 @@ if !(GVAR(DisplayText)) exitwith {}; +params ["_magazine", "_numberofGrenades"]; + private ["_color", "_name", "_text", "_picture"]; -params ["_magazine", "_numberofMagazines"]; - -_color = [[1, 0, 0], [1, 1, 1]] select (_numberofMagazines > 0); +_color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0); _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); -_text = [format["%1 x%2", _name, _numberofMagazines], _color] call EFUNC(common,stringToColoredText); +_text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); -[_text, _picture] call EFUNC(common,displayTextPicture); +["displayTextPicture", [_text, _picture]] call EFUNC(common,localEvent);