Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIGroupFireteamLock.c
Go to the documentation of this file.
1 
6 typedef array<ref SCR_AIGroupFireteamLock> TFireteamLockRefArray;
7 typedef array<SCR_AIGroupFireteamLock> TFireteamLockArray;
8 
9 class SCR_AIGroupFireteamLock : Managed
10 {
11  protected ref SCR_AIGroupFireteam m_Fireteam;
12 
13  //--------------------------------------------------------------------------------------------------------
15  {
16  m_Fireteam = ft;
17  }
18 
19  //--------------------------------------------------------------------------------------------------------
21  {
22  if (m_Fireteam)
23  m_Fireteam.Internal_OnLockDestroyed();
24  }
25 
26  //--------------------------------------------------------------------------------------------------------
27  SCR_AIGroupFireteam GetFireteam()
28  {
29  return m_Fireteam;
30  }
31 
32 
33 
34  //--------------------------------------------------------------------------------------------------------
36 
37  //--------------------------------------------------------------------------------------------------------
40  static int FindFireteamLock(notnull TFireteamLockRefArray locksArray, SCR_AIGroupFireteam ft)
41  {
42  foreach (int i, SCR_AIGroupFireteamLock l : locksArray)
43  {
44  if (l.m_Fireteam == ft)
45  return i;
46  }
47  return -1;
48  }
49  static int FindFireteamLock(notnull TFireteamLockArray locksArray, SCR_AIGroupFireteam ft)
50  {
51  foreach (int i, SCR_AIGroupFireteamLock l : locksArray)
52  {
53  if (l.m_Fireteam == ft)
54  return i;
55  }
56  return -1;
57  }
58 
59  //--------------------------------------------------------------------------------------------------------
62  static int FindFireteamLock(notnull TFireteamLockRefArray locksArray, SCR_AIGroupFireteamLock ft)
63  {
64  foreach (int i, SCR_AIGroupFireteamLock l : locksArray)
65  {
66  if (l == ft)
67  return i;
68  }
69  return -1;
70  }
71  static int FindFireteamLock(notnull TFireteamLockArray locksArray, SCR_AIGroupFireteamLock ft)
72  {
73  foreach (int i, SCR_AIGroupFireteamLock l : locksArray)
74  {
75  if (l == ft)
76  return i;
77  }
78  return -1;
79  }
80 
81  //--------------------------------------------------------------------------------------------------------
85  static bool RemoveFireteamLock(TFireteamLockRefArray locksArray, SCR_AIGroupFireteam ft)
86  {
87  int id = FindFireteamLock(locksArray, ft);
88  if (id == -1)
89  return false;
90 
91  locksArray.Remove(id);
92  return true;
93  }
94  static bool RemoveFireteamLock(TFireteamLockArray locksArray, SCR_AIGroupFireteam ft)
95  {
96  int id = FindFireteamLock(locksArray, ft);
97  if (id == -1)
98  return false;
99 
100  locksArray.Remove(id);
101  return true;
102  }
103 
104  //--------------------------------------------------------------------------------------------------------
106  static void TryLockFireteams(notnull array<SCR_AIGroupFireteam> fireteams, notnull TFireteamLockRefArray locks, bool clearLockArray)
107  {
108  if (clearLockArray)
109  locks.Clear();
110 
111  foreach (SCR_AIGroupFireteam ft : fireteams)
112  {
113  SCR_AIGroupFireteamLock lock = ft.TryLock();
114  if (lock)
115  locks.Insert(lock);
116  }
117  }
118 
119  //--------------------------------------------------------------------------------------------------------
121  static TFireteamLockRefArray CopyLockArray(TFireteamLockRefArray other)
122  {
123  TFireteamLockRefArray a = {};
124  foreach (auto l : other)
125  a.Insert(l);
126  return a;
127  }
128 };
SCR_AIGroupFireteam
Definition: SCR_AIGroupFireteam.c:1
TFireteamLockArray
array< SCR_AIGroupFireteamLock > TFireteamLockArray
Definition: SCR_AIGroupFireteamLock.c:7
TFireteamLockRefArray
array< ref SCR_AIGroupFireteamLock > TFireteamLockRefArray
Definition: SCR_AIGroupFireteamLock.c:6
SCR_AIGroupFireteamLock
Definition: SCR_AIGroupFireteamLock.c:9