Skip to content

Commit

Permalink
remove productVersion checks/ IS_LINUX macros
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 committed Jul 13, 2016
1 parent a4ea809 commit 8fc68a4
Show file tree
Hide file tree
Showing 54 changed files with 577 additions and 836 deletions.
6 changes: 0 additions & 6 deletions addons/arrays/fnc_sortNestedArray.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ SCRIPT(sortNestedArray);

params [["_array", [], [[]]], ["_index", 0, [0]], ["_order", true, [false]]];

#ifndef LINUX_BUILD
private _helperArray = _array apply {
[_x select _index, _x]
};
#else
private _helperArray = [_array, {
[_x select _index, _x]
}] call CBA_fnc_filter;
#endif

_helperArray sort _order;

Expand Down
2 changes: 0 additions & 2 deletions addons/arrays/fnc_sortNestedArray_Linux.sqf

This file was deleted.

6 changes: 1 addition & 5 deletions addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ call COMPILE_FILE(init_perFrameHandler);
call COMPILE_FILE(init_delayLess);

// Due to activateAddons being overwritten by eachother (only the last executed command will be active), we apply this bandaid
#ifndef LINUX_BUILD
private _addons = ("true" configClasses (configFile >> "CfgPatches")) apply {configName _x};
#else
private _addons = ["true" configClasses (configFile >> "CfgPatches"), {configName _x}] call CBA_fnc_filter;
#endif
private _addons = ("true" configClasses (configFile >> "CfgPatches")) apply {configName _x};

activateAddons _addons;
GVAR(addons) = _addons;
Expand Down
2 changes: 0 additions & 2 deletions addons/common/XEH_preInit_Linux.sqf

This file was deleted.

6 changes: 1 addition & 5 deletions addons/common/fnc_dropMagazine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ params [["_unit", objNull, [objNull]], ["_item", "", [""]], ["_ammo", -1, [0]]];

// random mag mode
if (_ammo < 0) then {
#ifndef LINUX_BUILD
_ammo = ((magazinesAmmoFull _unit select {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}) call BIS_fnc_selectRandom) param [1, "null"];
#else
_ammo = (([magazinesAmmoFull _unit, {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}] call BIS_fnc_conditionalSelect) call BIS_fnc_selectRandom) param [1, "null"];
#endif
_ammo = (selectRandom (magazinesAmmoFull _unit select {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}})) param [1, "null"];
};

// no mag of this type in units inventory
Expand Down
2 changes: 0 additions & 2 deletions addons/common/fnc_dropMagazine_Linux.sqf

This file was deleted.

6 changes: 1 addition & 5 deletions addons/common/fnc_dropWeapon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ SCRIPT(dropWeapon);

params [["_unit", objNull, [objNull]], ["_item", "", [""]]];

#ifndef LINUX_BUILD
private _weaponInfo = (weaponsItems _unit select {_x select 0 == _item}) param [0, []];
#else
private _weaponInfo = ([weaponsItems _unit, {_x select 0 == _item}] call BIS_fnc_conditionalSelect) param [0, []];
#endif
private _weaponInfo = (weaponsItems _unit select {_x select 0 == _item}) param [0, []];
private _return = [_unit, _item] call CBA_fnc_removeWeapon;

if (_return) then {
Expand Down
2 changes: 0 additions & 2 deletions addons/common/fnc_dropWeapon_Linux.sqf

This file was deleted.

6 changes: 1 addition & 5 deletions addons/common/fnc_getAlive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@ if (_entities isEqualType grpNull) then {
_entities = units _entities;
};

#ifndef LINUX_BUILD
_entities select {alive _x} // return
#else
[_entities, {alive _x}] call BIS_fnc_conditionalSelect // return
#endif
_entities select {alive _x} // return
2 changes: 0 additions & 2 deletions addons/common/fnc_getAlive_Linux.sqf

This file was deleted.

62 changes: 26 additions & 36 deletions addons/common/fnc_getMagazineIndex.sqf
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
/* ----------------------------------------------------------------------------
Function: CBA_fnc_getMagazineIndex
Description:
Finds out the magazine ID of all magazines of given type in the inventory of given unit.
Parameters:
_unit - Unit to check <OBJECT>
_magazine - Magazines to check <OBJECT>
Returns:
Magazine IDs <ARRAY of STRINGS>
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(getMagazineIndex);

params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]];

private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName");

if (_displayName isEqualTo "") exitWith {[]};

#ifndef LINUX_BUILD
magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)};
#else
[magazinesDetail _unit, {
if (_x find _displayName == 0) then {
_x = _x splitString "[:]";
_x = _x select (count _x - 1);
true
} else {false};
}] call BIS_fnc_conditionalSelect;
#endif
/* ----------------------------------------------------------------------------
Function: CBA_fnc_getMagazineIndex
Description:
Finds out the magazine ID of all magazines of given type in the inventory of given unit.
Parameters:
_unit - Unit to check <OBJECT>
_magazine - Magazines to check <OBJECT>
Returns:
Magazine IDs <ARRAY of STRINGS>
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(getMagazineIndex);

params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]];

private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName");

if (_displayName isEqualTo "") exitWith {[]};

magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)};
2 changes: 0 additions & 2 deletions addons/common/fnc_getMagazineIndex_Linux.sqf

This file was deleted.

6 changes: 2 additions & 4 deletions addons/common/fnc_headDir.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,13 @@ if (_unit != call CBA_fnc_currentUnit) then {
private _diff = -_azimuth;

if !(_offset isEqualTo "") then {
#ifndef LINUX_BUILD
ADD(_diff,_unit getDir ([_offset] call CBA_fnc_getPos));
#else
ADD(_diff,[ARR_2(_unit,[_offset] call CBA_fnc_getPos)] call BIS_fnc_dirTo);
#endif
};

if (_diff < 0) then {
ADD(_diff,360);
};

if (_diff > 180) then {
SUB(_diff,360);
};
Expand Down
2 changes: 0 additions & 2 deletions addons/common/fnc_headDir_Linux.sqf

This file was deleted.

52 changes: 26 additions & 26 deletions addons/common/fnc_players.sqf
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
/* ----------------------------------------------------------------------------
Function: CBA_fnc_players
Description:
Reports all (human) player objects. Does not include headless client entities.
Unlike "BIS_fnc_listPlayers", this function will not report the game logics of headless clients.
Parameters:
None
Returns:
List of all player objects <ARRAY>
Examples:
(begin example)
[] call CBA_fnc_players
(end)
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(players);

[allUnits + allDead, {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}] call BIS_fnc_conditionalSelect
/* ----------------------------------------------------------------------------
Function: CBA_fnc_players
Description:
Reports all (human) player objects. Does not include headless client entities.
Unlike "BIS_fnc_listPlayers", this function will not report the game logics of headless clients.
Parameters:
None
Returns:
List of all player objects <ARRAY>
Examples:
(begin example)
[] call CBA_fnc_players
(end)
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(players);

(allUnits + allDead) select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}
32 changes: 9 additions & 23 deletions addons/common/fnc_removeMagazine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,17 @@ if (_ammo < 0) then {
private _backpack = backpackContainer _unit;

// magazinesAmmoCargo bugged. returns nil for objNull.
#ifndef LINUX_BUILD
if (!isNull _uniform) then {
_uniformMagazines = magazinesAmmoCargo _uniform select {_x select 0 == _item};
};

if (!isNull _vest) then {
_vestMagazines = magazinesAmmoCargo _vest select {_x select 0 == _item};
};

if (!isNull _backpack) then {
_backpackMagazines = magazinesAmmoCargo _backpack select {_x select 0 == _item};
};
#else
if (!isNull _uniform) then {
_uniformMagazines = [magazinesAmmoCargo _uniform, {_x select 0 == _item}] call BIS_fnc_conditionalSelect;
};
if (!isNull _uniform) then {
_uniformMagazines = magazinesAmmoCargo _uniform select {_x select 0 == _item};
};

if (!isNull _vest) then {
_vestMagazines = [magazinesAmmoCargo _vest, {_x select 0 == _item}] call BIS_fnc_conditionalSelect;
};
if (!isNull _vest) then {
_vestMagazines = magazinesAmmoCargo _vest select {_x select 0 == _item};
};

if (!isNull _backpack) then {
_backpackMagazines = [magazinesAmmoCargo _backpack, {_x select 0 == _item}] call BIS_fnc_conditionalSelect;
};
#endif
if (!isNull _backpack) then {
_backpackMagazines = magazinesAmmoCargo _backpack select {_x select 0 == _item};
};

{
if (_x select 1 == _ammo) exitWith {
Expand Down
2 changes: 0 additions & 2 deletions addons/common/fnc_removeMagazine_Linux.sqf

This file was deleted.

64 changes: 30 additions & 34 deletions addons/common/fnc_turretPath.sqf
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
/* ----------------------------------------------------------------------------
Function: CBA_fnc_turretPath
Description:
Get a unit's turret path in the current vehicle.
Reverse version of the turretUnit scripting command.
Parameters:
_unit - a soldier in a vehicle <OBJECT>
Example:
(begin example)
_turretPath = player call CBA_fnc_turretPath
(end)
Returns:
Soldiers turret path. [] when on foot, driver or in cargo <ARRAY>
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(turretPath);

params [["_unit", objNull, [objNull]]];

private _vehicle = vehicle _unit;

#ifndef LINUX_BUILD
(allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []]
#else
([allTurrets [_vehicle, true], {(_vehicle turretUnit _x) isEqualTo _unit}] call BIS_fnc_conditionalSelect) param [0, []]
#endif
/* ----------------------------------------------------------------------------
Function: CBA_fnc_turretPath
Description:
Get a unit's turret path in the current vehicle.
Reverse version of the turretUnit scripting command.
Parameters:
_unit - a soldier in a vehicle <OBJECT>
Example:
(begin example)
_turretPath = player call CBA_fnc_turretPath
(end)
Returns:
Soldiers turret path. [] when on foot, driver or in cargo <ARRAY>
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(turretPath);

params [["_unit", objNull, [objNull]]];

private _vehicle = vehicle _unit;

(allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []]
68 changes: 32 additions & 36 deletions addons/common/fnc_turretPathWeapon.sqf
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
/* ----------------------------------------------------------------------------
Function: CBA_fnc_turretPathWeapon
Description:
Get the turret path belonging to a weapon of given vehicle.
Reverse version of the weaponsTurret scripting command.
Parameters:
_vehicle - a vehicle with turrets <OBJECT>
_weapon - a weapon in the vehicles turret <STRING>
Example:
(begin example)
_turretPath = [cameraOn, "HMG_127_mbt"] call CBA_fnc_turretPathWeapon
(end)
Returns:
Weapons turret path. [-1] for driver weapon. [] when weapon not found. <ARRAY>
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(turretPathWeapon);

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

private _turrets = allTurrets _vehicle;
_turrets pushBack [-1];

#ifndef LINUX_BUILD
(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []]
#else
([_turrets, {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}] call BIS_fnc_conditionalSelect) param [0, []]
#endif
/* ----------------------------------------------------------------------------
Function: CBA_fnc_turretPathWeapon
Description:
Get the turret path belonging to a weapon of given vehicle.
Reverse version of the weaponsTurret scripting command.
Parameters:
_vehicle - a vehicle with turrets <OBJECT>
_weapon - a weapon in the vehicles turret <STRING>
Example:
(begin example)
_turretPath = [cameraOn, "HMG_127_mbt"] call CBA_fnc_turretPathWeapon
(end)
Returns:
Weapons turret path. [-1] for driver weapon. [] when weapon not found. <ARRAY>
Author:
commy2
---------------------------------------------------------------------------- */
#include "script_component.hpp"
SCRIPT(turretPathWeapon);

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

private _turrets = allTurrets _vehicle;
_turrets pushBack [-1];

(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []]
Loading

0 comments on commit 8fc68a4

Please sign in to comment.