Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MatrixRow.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 {
4 
5  private ref array<int> m_iRow = new array<int>();
6  private string m_sDebugOutput = "";
7 // private int m_iDefaultElementValue;
8 
9 
10  //------------------------------------------------------------------------------------------------
11  // ! checks for the free place of the size sizeCols in the row starting on position col. Returns true if succeeded
12  bool CheckFreePlaceInRow( int sizeCols, int col )
13  {
14  if( ( col + sizeCols ) > m_iRow.Count() )
15  return false;
16 
17  for( int i = col; i < ( col + sizeCols ); i++ )
18  {
19  if( m_iRow.Get( i ) != 0 )
20  return false;
21  }
22 
23 
24  return true;
25  }
26 
27  //------------------------------------------------------------------------------------------------
28  // ! reserves the place of the size sizeCols in the row starting on position col. Returns column if succeeded
29  bool ReservePlaceInRow( int sizeCols, int col )
30  {
31  if( ( col + sizeCols ) > m_iRow.Count() )
32  return false;
33 
34  for( int i = col; i < ( col + sizeCols ); i++ )
35  m_iRow.Set( i, 1 );
36 
37  return true;
38  }
39 
40  //------------------------------------------------------------------------------------------------
41  // ! reserves the place of the size sizeCols in the row starting on position col. Returns true if succeeded
42  bool ClearPlaceInRow( int sizeCols, int col )
43  {
44  if( ( col + sizeCols ) <= m_iRow.Count() )
45  return false;
46 
47  for( int i = col; i < ( col + sizeCols ); i++ )
48  m_iRow.Set( i, 1 );
49 
50  return true;
51  }
52 
53  //------------------------------------------------------------------------------------------------
54  void Debug()
55  {
56  m_sDebugOutput = "| ";
57  for( int i = 0; i < m_iRow.Count(); i++ )
58  {
59  m_sDebugOutput += (m_iRow.Get( i ) ).ToString();
60  m_sDebugOutput += " | ";
61  }
62  Print( m_sDebugOutput );
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  int GetElement( int index )
67  {
68  int i = m_iRow.Get( index );
69  return i;
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  void InsertElement( int element )
74  {
75  m_iRow.Insert( element );
76  }
77 
78  //------------------------------------------------------------------------------------------------
79  void SetElement( int index, int element )
80  {
81  m_iRow.Set( index, element );
82  }
83 
84 
85  //------------------------------------------------------------------------------------------------
86 /*
87  void SCR_Array( out notnull array<int> from )
88  {
89  m_iRow.Copy( from );
90  }
91  */
92 
93  //------------------------------------------------------------------------------------------------
94  void SCR_MatrixRow( int size, int defaulElementValue = 0 )
95  {
96  if( !size )
97  size = 4;
98  //m_iRow.Resize( size );
99  for( int i = 0; i < size; i++)
100  m_iRow.Insert( defaulElementValue );
101  }
102 
103 
104  //------------------------------------------------------------------------------------------------
105  void ~SCR_MatrixRow()
106  {
107  }
108 
109 };
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_MatrixRow
Definition: SCR_MatrixRow.c:2