replace more map with apply

This commit is contained in:
commy2 2016-02-06 12:08:04 +01:00
parent 41e39c9c3a
commit ac007e6995
5 changed files with 9 additions and 15 deletions

View File

@ -18,7 +18,7 @@ GVAR(Grenades_ItemList) = [];
} count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles");
// make list case insensitive
GVAR(Grenades_ItemList) = [GVAR(Grenades_ItemList), {toLower _this}] call EFUNC(common,map);
GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) apply {toLower _x};
// filter duplicates
GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) arrayIntersect GVAR(Grenades_ItemList);
@ -42,7 +42,9 @@ GVAR(Medical_ItemList) = [];
);
// make list case insensitive
GVAR(Medical_ItemList) = [GVAR(Medical_ItemList), {if (_this isEqualType "") then {toLower _this}}] call EFUNC(common,map);
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {
if (_x isEqualType "") then {toLower _x};
};
// filter duplicates
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList);

View File

@ -47,8 +47,7 @@ if !(_selection in _selections) exitWith {
_unit setHitPointDamage [_selection, _damage];
};
GVAR(unit) = _unit;
_damages = [_selections, {GVAR(unit) getHitPointDamage _this}] call EFUNC(common,map);
_damages = _selections apply {_unit getHitPointDamage _x};
_damageOld = damage _unit;
_damageSumOld = 0;

View File

@ -18,23 +18,19 @@
private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"];
_player = ACE_player;
_vehicle = vehicle _player;
_type = typeOf _vehicle;
_config = configFile >> "CfgVehicles" >> _type;
_text = format["<t size='1.4'><img image='%1'></t> <t size='1.7' shadow='true'>%2</t><br/>", getText(_config>>"picture"), getText (_config >> "DisplayName")];
_data = [_type] call FUNC(getVehicleData);
_isAir = _data select 0;
_data = _data select 1;
_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(common,map);
_turretRoles = [_data, { _x select 1 } ] call EFUNC(common,map);
_turretUnits = _data apply {_vehicle turretUnit (_x select 0)};
_turretRoles = _data apply {_x select 1};
_roleType = CARGO;
_toShow = [];
@ -61,7 +57,6 @@ _toShow = [];
_toShow pushBack [_x, _roleType];
} forEach crew _vehicle;
_toShow = [
_toShow,
[],
@ -75,7 +70,6 @@ _toShow = [
}
] call BIS_fnc_sortBy;
_roleImages = ROLE_IMAGES;
{
_unit = _x select 0;
@ -83,7 +77,6 @@ _roleImages = ROLE_IMAGES;
_text = _text + format["<t size='1.5' shadow='true'>%1</t> <t size='1.3'><img image='%2'></t><br/>", [_unit] call EFUNC(common,getName), _roleImages select _roleType];
} forEach _toShow;
("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["ACE_CrewInfo_dialog", "PLAIN", 1, false];
terminate (missionNamespace getVariable [QGVAR(hideCrewInfoHandle), scriptNull]);

View File

@ -22,7 +22,7 @@ private "_magazines";
_magazines = magazines _unit;
// case sensitvity
_magazines = [_magazines, {toLower _this}] call EFUNC(common,map);
_magazines = _magazines apply {toLower _x};
// get reloaders magazine types compatible with targets launcher. No duplicates.
getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select {toLower _x in _magazines} // return

View File

@ -42,7 +42,7 @@ playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] se
// slightly rotate the player if looking through optic
if (cameraView == "GUNNER") then {
// Convert adjustmentDifference from mils to degrees
_adjustmentDifference = [_adjustmentDifference, {_this * 0.05625}] call EFUNC(common,map);
_adjustmentDifference = _adjustmentDifference apply {_x * 0.05625};
_adjustmentDifference params ["_elevationDifference", "_windageDifference"];
_pitchBankYaw = [_unit] call EFUNC(common,getPitchBankYaw);
_pitchBankYaw params ["_pitch", "_bank", "_yaw"];