mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix #211
This commit is contained in:
29
addons/interact_menu/functions/fnc_isSubPath.sqf
Normal file
29
addons/interact_menu/functions/fnc_isSubPath.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: CAA-Picard
|
||||
* Check if the first path is a subpath of the other
|
||||
*
|
||||
* Argument:
|
||||
* 0: LongPath <ARRAY>
|
||||
* 1: ShortPath <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Bool
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_2_PVT(_this,_longPath,_shortPath);
|
||||
|
||||
private ["_isSubPath","_i"];
|
||||
_isSubPath = true;
|
||||
|
||||
if (count _shortPath > count _longPath) exitWith {false};
|
||||
|
||||
for [{_i = 0},{_i < (count _shortPath) - 1},{_i = _i + 1}] do {
|
||||
if !((_longPath select _i) isEqualTo (_shortPath select _i)) exitWith {
|
||||
_isSubPath = false;
|
||||
};
|
||||
};
|
||||
|
||||
_isSubPath
|
Reference in New Issue
Block a user