Remove duplicate fnc_inString

This commit is contained in:
ebaydayz
2016-05-01 11:01:26 -04:00
parent ab7254a121
commit 6187006ece
3 changed files with 3 additions and 33 deletions

View File

@@ -1,30 +0,0 @@
/*
* Author: Killzone_Kid
*
* Description:
* Find a string within a string (case insensitive)
*
* Parameter(s):
* _this select 0: <string> string to be found
* _this select 1: <string> string to search in
*
* Returns:
* Boolean (true when string is found)
*
* How to use:
* _found = ["needle", "Needle in Haystack"] call KK_fnc_inString;
*/
private ["_needle","_haystack","_needleLen","_hay","_found"];
_needle = [_this, 0, "", [""]] call BIS_fnc_param;
_haystack = toArray ([_this, 1, "", [""]] call BIS_fnc_param);
_needleLen = count toArray _needle;
_hay = +_haystack;
_hay resize _needleLen;
_found = false;
for "_i" from _needleLen to count _haystack do {
if (toString _hay == _needle) exitWith {_found = true};
_hay set [_needleLen, _haystack select _i];
_hay set [0, "x"];
_hay = _hay - ["x"]
};
_found

View File

@@ -24,7 +24,7 @@ if(count _this > 0) then {
}else {
_newSellArray = [];
{
if(( [_query,(_x select 0)] call KK_fnc_inString) || ([_query,(_x select 3)] call KK_fnc_inString) ) then {
if(( [_query,(_x select 0)] call fnc_inString) || ([_query,(_x select 3)] call fnc_inString) ) then {
if( _x find Z_SellArray < 0 ) then {
_newSellArray set [count(_newSellArray), _x];
};
@@ -42,7 +42,7 @@ if(count _this > 0) then {
}else {
_newBuyArray = [];
{
if(( [_query,(_x select 0)] call KK_fnc_inString) || ([_query,(_x select 3)] call KK_fnc_inString) ) then {
if(( [_query,(_x select 0)] call fnc_inString) || ([_query,(_x select 3)] call fnc_inString) ) then {
_newBuyArray set [count(_newBuyArray), _x];
};
} forEach Z_OriginalBuyableArray;

View File

@@ -54,7 +54,7 @@ if(isNil "Z_AdvancedTradingInit")then{
/* end script config */
KK_fnc_inString = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\KK_fnc_inString.sqf");
fnc_inString = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\fnc_inString.sqf");
ZUPA_fnc_removeWeaponsAndMagazinesCargo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\zupa_fnc_removeWeaponsAndMagazinesCargo.sqf");
Z_filleTradeTitle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_filleTradeTitle.sqf");