From b77c4d4667720062185a0a0d07ccf8c6e15f14cb Mon Sep 17 00:00:00 2001 From: ulteq Date: Thu, 14 Dec 2017 13:43:32 +0100 Subject: [PATCH] Rangecard - Fixes broken bore height display (#5907) * Reverts the getBoreHeight API change from:https://github.com/acemod/ACE3/commit/91425f857682e2b69973c77120664cde117bc1d3 --- addons/scopes/functions/fnc_getBoreHeight.sqf | 13 ++++++++----- addons/scopes/functions/fnc_inventoryCheck.sqf | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/addons/scopes/functions/fnc_getBoreHeight.sqf b/addons/scopes/functions/fnc_getBoreHeight.sqf index 5c0d216acc..b76a9c7f9e 100644 --- a/addons/scopes/functions/fnc_getBoreHeight.sqf +++ b/addons/scopes/functions/fnc_getBoreHeight.sqf @@ -1,24 +1,27 @@ /* * Author: Ruthberg - * Gets the bore height of the currently used weapon & optic combination + * Gets the bore height of the weapon & optic combination with the given weapon index * * Arguments: * 0: Unit * 1: Weapon index - * 2: Weapon - * 3: Optic * * Return Value: * bore height * * Example: - * [player, 0, "srifle_LRR_F", "optic_LRPS"] call ace_scopes_fnc_getBoreHeight + * [player, 0] call ace_scopes_fnc_getBoreHeight * * Public: Yes */ #include "script_component.hpp" -params ["_player", "_weaponIndex", "_weaponClass", "_opticsClass"]; +params ["_unit", "_weaponIndex"]; + +if (_weaponIndex < 0 || {_weaponIndex > 2}) exitWith { 0 }; + +private _weaponClass = [primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] select _weaponIndex; +private _opticsClass = ([_unit] call FUNC(getOptics)) select _weaponIndex; if (_opticsClass == "") then { _opticsClass = _weaponClass; }; diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index c7f6ab9fcb..03d73ecfda 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -82,8 +82,8 @@ private _newOptics = [_player] call FUNC(getOptics); private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player]; { if ((_newOptics select _x) != (GVAR(Optics) select _x) || (_newGuns select _x != GVAR(Guns) select _x)) then { - GVAR(baseAngle) set [_x, [_player, _x, _newGuns select _x, _newOptics select _x] call FUNC(getBaseAngle)]; - GVAR(boreHeight) set [_x, [_player, _x, _newGuns select _x, _newOptics select _x] call FUNC(getBoreHeight)]; + GVAR(baseAngle) set [_x, [_player, _x] call FUNC(getBaseAngle)]; + GVAR(boreHeight) set [_x, [_player, _x] call FUNC(getBoreHeight)]; if ((_newOptics select _x) == "") then { // Check if the weapon comes with an integrated optic