|
|
@@ -0,0 +1,91 @@
|
|
|
+function tag_add(_inst, _tag){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ _inst.itags = [];
|
|
|
+ }
|
|
|
+ if (!has_tag(_inst, _tag)){
|
|
|
+ array_push(_inst.itags, _tags);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function tag_has(_inst, _tag){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (var _index = 0; _index < array_length(_inst.itags); _index++){
|
|
|
+ if (_inst.itags[_index] == _tag){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+function tag_has_any(_inst, _tags_array){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (var _index = 0; _index < array_length(_tags_array); _index++){
|
|
|
+ if (tag_has(_inst, _tags_array[_index])){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+function tag_has_all(_inst, _tags_array){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (var _index = 0; _index < array_length(_tags_array); _index++){
|
|
|
+ if (!tag_has(_inst, _tags_array[_index])){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+function tag_has_without(_inst, _tags_array){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (var _index = 0; _index < array_length(_tags_array); _index++){
|
|
|
+ if (tag_has(_inst, _tags_array[_index])){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function tag_remove(_inst, _tag){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ _inst.itags = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (has_tag(_inst, _tag)){
|
|
|
+ for (var _index = 0; _index < array_length(_inst.itags); _index++){
|
|
|
+ if (_inst.itags[_index] == _tag){
|
|
|
+ array_delete(_inst.itags, _index, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function tag_clear(_inst){
|
|
|
+ if (!variable_instance_exists(_inst, "itags")) {
|
|
|
+ _inst.itags = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _inst.itags = [];
|
|
|
+}
|
|
|
+
|
|
|
+function tag_get_all(_tag){
|
|
|
+ var _res =[];
|
|
|
+ with (all){
|
|
|
+ if (tag_has(id, _tag)){
|
|
|
+ array_push(_res, id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return _res;
|
|
|
+}
|