Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove productVersion checks/ IS_LINUX macros #432

Merged
merged 6 commits into from
Jul 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions addons/ai/fnc_taskDefend.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,15 @@ private _buildings = _position nearObjects ["Building", _radius];
[_statics,{(_x emptyPositions "Gunner") > 0},true] call CBA_fnc_filter;

// Filter out buildings below the size threshold (and store positions for later use)
{
if ((_x buildingPos _threshold) isEqualto [0,0,0]) then {
_buildings set [_forEachIndex,nil];
} else {
private _positions = _x buildingPos -1;

if (isNil {_x getVariable "CBA_taskDefend_positions"}) then {
_x setVariable ["CBA_taskDefend_positions",_positions];
};
};
} forEach _buildings;
_buildings = _buildings arrayIntersect _buildings;

// v1.56 version of the above
/*_buildings = _buildings select {
_buildings = _buildings select {
private _positions = _x buildingPos -1;

if (isNil {_x getVariable "CBA_taskDefend_positions"}) then {
_x setVariable ["CBA_taskDefend_positions",_positions];
_x setVariable ["CBA_taskDefend_positions", _positions];
};

count (_positions) > _threshold
};*/
};

private _units = units _group;
private _assigned = 0;
Expand Down
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.

26 changes: 1 addition & 25 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,7 @@
#include "script_component.hpp"

//Install PFEH:
if (isNil {canSuspend}) then {
// pre 1.58
["CBA_PFH", "onEachFrame", {
call FUNC(onFrame);
GVAR(lastFrameRender) = diag_frameNo;
}] call BIS_fnc_addStackedEventHandler;

FUNC(monitorFrameRender) = {
if (abs (diag_frameno - GVAR(lastFrameRender)) > DELAY_MONITOR_THRESHOLD) then {
// Restores the onEachFrame handler
["CBA_PFH", "onEachFrame", {
call FUNC(onFrame);
GVAR(lastFrameRender) = diag_frameNo;
}] call BIS_fnc_addStackedEventHandler;
TRACE_1("PFH restored",nil);
};
};

// Use a trigger, runs every 0.5s, unscheduled execution
GVAR(perFrameTrigger) = createTrigger ["EmptyDetector", [0,0,0], false];
GVAR(perFrameTrigger) setTriggerStatements ['FUNC(monitorFrameRender) call CBA_fnc_directCall', "", ""];
} else {
// 1.58 and later
addMissionEventHandler ["EachFrame", FUNC(onFrame)];
};
addMissionEventHandler ["EachFrame", FUNC(onFrame)];

LOG(MSG_INIT);

Expand Down
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.

2 changes: 0 additions & 2 deletions addons/common/fnc_addBinocularMagazine_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.

12 changes: 1 addition & 11 deletions addons/common/fnc_getMagazineIndex.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,4 @@ private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "di

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

2 changes: 1 addition & 1 deletion addons/common/fnc_players.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Author:
#include "script_component.hpp"
SCRIPT(players);

[allUnits + allDead, {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}] call BIS_fnc_conditionalSelect
(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.

6 changes: 1 addition & 5 deletions addons/common/fnc_turretPath.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ 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
(allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []]
6 changes: 1 addition & 5 deletions addons/common/fnc_turretPathWeapon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ 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
(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []]
2 changes: 0 additions & 2 deletions addons/common/fnc_turretPathWeapon_Linux.sqf

This file was deleted.

2 changes: 0 additions & 2 deletions addons/common/fnc_turretPath_Linux.sqf

This file was deleted.

6 changes: 1 addition & 5 deletions addons/common/fnc_vehicleRole.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ SCRIPT(vehicleRole);

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

#ifndef LINUX_BUILD
fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1
#else
([fullCrew vehicle _unit, {(_x select 0) isEqualTo _unit}] call BIS_fnc_conditionalSelect) param [0, [nil, ""]] select 1
#endif
fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1
2 changes: 0 additions & 2 deletions addons/common/fnc_vehicleRole_Linux.sqf

This file was deleted.

14 changes: 3 additions & 11 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,9 @@ if (isMultiplayer) then {
GVAR(lastTickTime) = _tickTime;
};

if (isNil {canSuspend}) then {
// pre v1.58
["CBA_SynchMissionTime", "onPlayerConnected", {
_owner publicVariableClient "CBA_missionTime";
}] call BIS_fnc_addStackedEventHandler;
} else {
// v1.58 and later
addMissionEventHandler ["PlayerConnected", {
(_this select 4) publicVariableClient "CBA_missionTime";
}];
};
addMissionEventHandler ["PlayerConnected", {
(_this select 4) publicVariableClient "CBA_missionTime";
}];
} else {
CBA_missionTime = -1;

Expand Down
13 changes: 2 additions & 11 deletions addons/events/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ if (!isNull (uiNamespace getVariable ["CBA_missionDisplay", displayNull])) then
};

PREP(keyHandler);
#ifndef LINUX_BUILD
PREP(keyHandlerDown);
#else
PREP(keyHandlerDown_Linux);
FUNC(keyHandlerDown) = FUNC(keyHandlerDown_Linux);
#endif
PREP(keyHandlerDown);
PREP(keyHandlerUp);

["keyDown", FUNC(keyHandlerDown)] call CBA_fnc_addDisplayHandler;
Expand All @@ -64,11 +59,7 @@ PREP(keyHandlerUp);
private _keyHandlers = [];
_keyHandlers resize 250;

#ifndef LINUX_BUILD
GVAR(keyDownStates) = _keyHandlers apply {[]};
#else
GVAR(keyDownStates) = [_keyHandlers, {[]}] call CBA_fnc_filter;
#endif
GVAR(keyDownStates) = _keyHandlers apply {[]};
GVAR(keyUpStates) = + GVAR(keyDownStates);

GVAR(keyHandlersDown) = call CBA_fnc_createNamespace;
Expand Down
2 changes: 0 additions & 2 deletions addons/events/XEH_preInit_Linux.sqf

This file was deleted.

7 changes: 1 addition & 6 deletions addons/events/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#include "script_component.hpp"

PREP(keyHandler);
#ifndef LINUX_BUILD
PREP(keyHandlerDown);
#else
PREP(keyHandlerDown_Linux);
FUNC(keyHandlerDown) = FUNC(keyHandlerDown_Linux);
#endif
PREP(keyHandlerDown);
PREP(keyHandlerUp);
2 changes: 0 additions & 2 deletions addons/events/XEH_preStart_Linux.sqf

This file was deleted.

7 changes: 2 additions & 5 deletions addons/events/fnc_addKeyHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@ _hash setVariable [_hashKey, [_key, _settings, _code, _allowHold, _holdDelay]];
private _keyHandlers = [GVAR(keyDownStates), GVAR(keyUpStates)] select (_type == "keyup");

private _hashKeys = _keyHandlers param [_key, []];
#ifndef LINUX_BUILD
_hashKeys pushBackUnique _hashKey; // pushBackUnique. Fixes using addKeyHander twice with the same keyHash/id executing the newly added action twice.
#else
_hashKeys pushBack _hashKey;
#endif
_hashKeys pushBackUnique _hashKey; // pushBackUnique. Fixes using addKeyHander twice with the same keyHash/id executing the newly added action twice.

_keyHandlers set [_key, _hashKeys];

_hashKey
2 changes: 0 additions & 2 deletions addons/events/fnc_addKeyHandler_Linux.sqf

This file was deleted.

2 changes: 0 additions & 2 deletions addons/events/fnc_addPlayerEventHandler_Linux.sqf

This file was deleted.

15 changes: 2 additions & 13 deletions addons/events/fnc_keyHandlerDown.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ private _blockInput = false;
};

// check if either holding down a key is enabled or if the key wasn't already held down
#ifndef LINUX_BUILD
if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then {
#else
if (_execute && {_allowHold || {!(_xUp in GVAR(keyUpActiveList))}}) then {
GVAR(keyUpActiveList) pushBack _xUp;
#endif
if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then {
private _params = + _this;
_params pushBack + _keybindParams;
_params pushBack _x;
Expand All @@ -74,13 +69,7 @@ private _blockInput = false;

// Verify if the required modifier keys are present
if (_keybindSettings isEqualTo _inputSettings) then {
#ifndef LINUX_BUILD
GVAR(keyDownActiveList) pushBackUnique _x;
#else
if !(_x in GVAR(keyDownActiveList)) then {
GVAR(keyDownActiveList) pushBack _x;
};
#endif
GVAR(keyDownActiveList) pushBackUnique _x;
};
} forEach (GVAR(keyUpStates) param [_inputKey, []]);

Expand Down
2 changes: 0 additions & 2 deletions addons/events/fnc_keyHandlerDown_Linux.sqf

This file was deleted.

Loading