Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseEditorAttributeVar.c
Go to the documentation of this file.
2 {
3  static const int SNAPSHOT_SIZE_VALUE = 12; //--- Vector
4 
5  protected vector m_vValue; //--- All variables are saved as a vector in the end (ToDo: Find lighter solution?)
6 
7  //--- Integer
12  void SetInt(int value)
13  {
14  m_vValue[0] = value;
15  }
20  int GetInt()
21  {
22  return m_vValue[0];
23  }
24 
25  //--- Float
30  void SetFloat(float value)
31  {
32  m_vValue[0] = value;
33  }
38  float GetFloat()
39  {
40  return m_vValue[0];
41  }
42 
43  //--- Bool
48  void SetBool(bool value)
49  {
50  m_vValue[0] = value;
51  }
56  bool GetBool()
57  {
58  return m_vValue[0] != 0;
59  }
60 
61  //--- Vector
66  void SetVector(vector value)
67  {
68  m_vValue = value;
69  }
74  vector GetVector()
75  {
76  return m_vValue;
77  }
78 
79  //--- Network functions
80  static void Encode(SSnapSerializerBase snapshot, ScriptCtx hint, ScriptBitSerializer packet)
81  {
82  snapshot.Serialize(packet, SNAPSHOT_SIZE_VALUE);
83  }
84  static bool Decode(ScriptBitSerializer packet, ScriptCtx hint, SSnapSerializerBase snapshot)
85  {
86  return snapshot.Serialize(packet, SNAPSHOT_SIZE_VALUE);
87  }
88  static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx hint)
89  {
90  return lhs.CompareSnapshots(rhs, SNAPSHOT_SIZE_VALUE);
91  }
92  static bool PropCompare(SCR_BaseEditorAttributeVar prop, SSnapSerializerBase snapshot, ScriptCtx hint)
93  {
94  return snapshot.Compare(prop.m_vValue, SNAPSHOT_SIZE_VALUE);
95  }
96  static bool Extract(SCR_BaseEditorAttributeVar prop, ScriptCtx hint, SSnapSerializerBase snapshot)
97  {
98  snapshot.SerializeBytes(prop.m_vValue, SNAPSHOT_SIZE_VALUE);
99  return true;
100  }
101  static bool Inject(SSnapSerializerBase snapshot, ScriptCtx hint, SCR_BaseEditorAttributeVar prop)
102  {
103  return Extract(prop, hint, snapshot);
104  }
105 
106  //--- Default functions
107  static SCR_BaseEditorAttributeVar CreateInt(int value)
108  {
110  var.SetInt(value);
111  return var;
112  }
113  static SCR_BaseEditorAttributeVar CreateFloat(float value)
114  {
116  var.SetFloat(value);
117  return var;
118  }
119  static SCR_BaseEditorAttributeVar CreateBool(bool value)
120  {
122  var.SetBool(value);
123  return var;
124  }
125  static SCR_BaseEditorAttributeVar CreateVector(vector value)
126  {
128  var.SetVector(value);
129  return var;
130  }
131 };
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1