Replace forEach with Count

Use count where you do not need _forEachIndex variable, it's quicker
than forEach.
This commit is contained in:
icomrade
2014-05-27 15:37:57 -04:00
parent 91d246e64e
commit e54b9983dd
210 changed files with 890 additions and 890 deletions

View File

@@ -33,14 +33,14 @@ if(_buy_o_sell == "sell") then {
_abort = (!(_configName in (weapons player)));
if(_isToolBelt or _isBinocs) then {
if(_isToolBelt || _isBinocs) then {
_msg = "Need the item on your toolbelt before you can sell it.";
};
} else {
// buying item type must NOT exist if rifle or pistol
_msg = "Drop or sell your current weapon before you can buy a new one.";
// buying item type must NOT exist if rifle || pistol
_msg = "Drop || sell your current weapon before you can buy a new one.";
_config = (configFile >> "CfgWeapons" >> _part_out);
_configName = configName(_config);
_wepType = getNumber(_config >> "Type");
@@ -59,12 +59,12 @@ if(_buy_o_sell == "sell") then {
if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith {
_secondaryWeapon = _x;
};
} forEach (weapons player);
} count (weapons player);
_abort = (_secondaryWeapon != "");
};
if(_isToolBelt or _isBinocs) then {
if(_isToolBelt || _isBinocs) then {
_abort = (_configName in (weapons player));
_msg = "Drop or sell your current toolbelt item before you can buy a new one.";
_msg = "Drop || sell your current toolbelt item before you can buy a new one.";
};
};
@@ -91,7 +91,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};