Skip to content

Commit

Permalink
Merge pull request #3809 from acemod/improve_getTurretX
Browse files Browse the repository at this point in the history
fullCrew new parameter to improve FUNC(getTurretX)
  • Loading branch information
commy2 committed May 22, 2016
2 parents 3911912 + bb52c55 commit 36205e3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 86 deletions.
17 changes: 1 addition & 16 deletions addons/common/functions/fnc_getTurretCommander.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,4 @@

params [["_vehicle", objNull, [objNull]]];

private _turrets = allTurrets [_vehicle, true];

private _turret = [];

{
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;

_config = [_config, _x] call FUNC(getTurretConfigPath);

if (getNumber (_config >> "primaryObserver") == 1) exitWith {
_turret = _x;
};
false
} count _turrets;

_turret
fullCrew [_vehicle, "commander", true] apply {_x select 3} param [0, []] // return
19 changes: 3 additions & 16 deletions addons/common/functions/fnc_getTurretCopilot.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@

params [["_vehicle", objNull, [objNull]]];

private _turrets = allTurrets [_vehicle, true];

private _turret = [];

{
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;

_config = [_config, _x] call FUNC(getTurretConfigPath);

if (getNumber (_config >> "isCopilot") == 1 && {getNumber (_config >> "primaryGunner") != 1} && {getNumber (_config >> "primaryObserver") != 1}) exitWith {
_turret = _x;
};
false
} count _turrets;

_turret
fullCrew [_vehicle, "turret", true] apply {_x select 3} select {
getNumber ([_vehicle, _x] call CBA_fnc_getTurret >> "isCopilot") == 1
} param [0, []] // return
17 changes: 1 addition & 16 deletions addons/common/functions/fnc_getTurretGunner.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,4 @@

params [["_vehicle", objNull, [objNull]]];

private _turrets = allTurrets [_vehicle, true];

private _turret = [];

{
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;

_config = [_config, _x] call FUNC(getTurretConfigPath);

if (getNumber (_config >> "primaryGunner") == 1) exitWith {
_turret = _x;
};
false
} count _turrets;

_turret
fullCrew [_vehicle, "gunner", true] apply {_x select 3} param [0, []] // return
4 changes: 3 additions & 1 deletion addons/common/functions/fnc_getTurrets.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
* Return Value:
* Turret Indecies <ARRAY>
*
* Public: Yes
* Public: No
*
* Note: It's advised to use allTurrets [_vehicle, true] instead whenever possible
*/
#include "script_component.hpp"

ACE_DEPRECATED("ace_common_fnc_getTurrets","3.7.0","allTurrets [_vehicle, true]");

params ["_type"];

private _varName = format [QGVAR(CachedTurrets_%1), _type];
Expand Down
17 changes: 1 addition & 16 deletions addons/common/functions/fnc_getTurretsFFV.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,4 @@

params [["_vehicle", objNull, [objNull]]];

private _turrets = allTurrets [_vehicle, true];

private _turret = [];

{
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;

_config = [_config, _x] call FUNC(getTurretConfigPath);

if (getNumber (_config >> "isPersonTurret") == 1) then {
_turret pushBack _x;
};
false
} count _turrets;

_turret
fullCrew [_vehicle, "turret", true] select {_x select 4} apply {_x select 3} // return
24 changes: 3 additions & 21 deletions addons/common/functions/fnc_getTurretsOther.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,6 @@

params [["_vehicle", objNull, [objNull]]];

private _turrets = allTurrets [_vehicle, true];

private _turret = [];

{
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;

_config = [_config, _x] call FUNC(getTurretConfigPath);

if (
getNumber (_config >> "isCopilot") != 1
&& {getNumber (_config >> "primaryGunner") != 1}
&& {getNumber (_config >> "primaryObserver") != 1}
&& {getNumber (_config >> "isPersonTurret") != 1}
) then {
_turret pushBack _x;
};
false
} count _turrets;

_turret
fullCrew [_vehicle, "turret", true] select {!(_x select 4)} apply {_x select 3} select {
getNumber ([_vehicle, _x] call CBA_fnc_getTurret >> "isCopilot") != 1
} // return

0 comments on commit 36205e3

Please sign in to comment.