ACE3/addons/interact_menu/functions/fnc_isSubPath.sqf

30 lines
556 B
Plaintext
Raw Normal View History

2015-03-21 12:37:01 +00:00
/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
2015-03-21 12:37:01 +00:00
* 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"
params ["_longPath", "_shortPath"];
2015-03-21 12:37:01 +00:00
private ["_isSubPath","_i"];
_isSubPath = true;
if (count _shortPath > count _longPath) exitWith {false};
2015-03-21 17:28:17 +00:00
for [{_i = 0},{_i < count _shortPath},{_i = _i + 1}] do {
2015-03-21 12:37:01 +00:00
if !((_longPath select _i) isEqualTo (_shortPath select _i)) exitWith {
_isSubPath = false;
};
};
_isSubPath