Rangecard - Fixes broken bore height display (#5907)

* Reverts the getBoreHeight API change from:91425f8576
This commit is contained in:
ulteq 2017-12-14 13:43:32 +01:00 committed by jonpas
parent 0a87bd134b
commit b77c4d4667
2 changed files with 10 additions and 7 deletions

View File

@ -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 <OBJECT>
* 1: Weapon index <NUMBER>
* 2: Weapon <CLASS>
* 3: Optic <CLASS>
*
* Return Value:
* bore height <NUMBER>
*
* 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; };

View File

@ -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