Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CallsignPlatoonData.c
Go to the documentation of this file.
1 
5 {
6  protected ref array<int> m_mSquadCallsigns = new array<int>;
7 
8  //---------------------------------------- On Init ----------------------------------------\\
9 
13  void Init(SCR_FactionCallsignInfo factionCallsignInfo)
14  {
15  array<ref SCR_CallsignInfo> squadArray = new array<ref SCR_CallsignInfo>;
16  factionCallsignInfo.GetSquadArray(squadArray);
17  int count = squadArray.Count();
18 
19  for(int i = 0; i < count; i++)
20  {
21  m_mSquadCallsigns.Insert(i);
22  }
23  }
24 
25  //---------------------------------------- Get random squad Callsign ----------------------------------------\\
26 
30  int GetRandomSquad()
31  {
32  return m_mSquadCallsigns[Math.RandomInt(0, m_mSquadCallsigns.Count())];
33  }
34 
39  int GetFirstAvailibleSquad()
40  {
41  int firstAvailible = int.MAX;
42 
43  foreach (int squad: m_mSquadCallsigns)
44  {
45  if (squad < firstAvailible)
46  firstAvailible = squad;
47  }
48 
49  return firstAvailible;
50  }
51 
52  //---------------------------------------- Add availible squad Callsign ----------------------------------------\\
53 
57  void AddSquad(int squadIndex)
58  {
59  if (!m_mSquadCallsigns.Contains(squadIndex))
60  m_mSquadCallsigns.Insert(squadIndex);
61  }
62 
63  //---------------------------------------- Remove availible squad Callsign ----------------------------------------\\
64 
68  bool RemoveSquad(int squadIndex)
69  {
70  int count = m_mSquadCallsigns.Count();
71 
72  for(int i = 0; i < count; i++)
73  {
74  if (m_mSquadCallsigns[i] == squadIndex)
75  {
76  m_mSquadCallsigns.Remove(i);
77  break;
78  }
79  }
80 
81  return m_mSquadCallsigns.IsEmpty();
82  }
83 };
SCR_FactionCallsignInfo
Definition: SCR_FactionCallsignInfo.c:5
SCR_CallsignPlatoonData
Definition: SCR_CallsignPlatoonData.c:4