NWNX:EE  8193.36.12
nwnx_data.nss
Go to the documentation of this file.
1 
6 #include "inc_array"
7 
8 // All these calls just pass through to the Array code in inc_array to provide
9 // an NWNX_Data compatible API for ease of transition.
10 
16 
25 string NWNX_Data_Array_At_Str(object obj, string tag, int index);
26 float NWNX_Data_Array_At_Flt(object obj, string tag, int index);
27 int NWNX_Data_Array_At_Int(object obj, string tag, int index);
28 object NWNX_Data_Array_At_Obj(object obj, string tag, int index);
30 
31 
33 void NWNX_Data_Array_Clear(int type, object obj, string tag);
34 
43 int NWNX_Data_Array_Contains_Flt(object obj, string tag, float element);
44 int NWNX_Data_Array_Contains_Int(object obj, string tag, int element);
45 int NWNX_Data_Array_Contains_Obj(object obj, string tag, object element);
46 int NWNX_Data_Array_Contains_Str(object obj, string tag, string element);
48 
50 void NWNX_Data_Array_Copy(int type, object obj, string tag, string otherTag);
51 
53 void NWNX_Data_Array_Erase(int type, object obj, string tag, int index);
54 
63 int NWNX_Data_Array_Find_Flt(object obj, string tag, float element);
64 int NWNX_Data_Array_Find_Int(object obj, string tag, int element);
65 int NWNX_Data_Array_Find_Obj(object obj, string tag, object element);
66 int NWNX_Data_Array_Find_Str(object obj, string tag, string element);
68 
77 void NWNX_Data_Array_Insert_Flt(object obj, string tag, int index, float element);
78 void NWNX_Data_Array_Insert_Int(object obj, string tag, int index, int element);
79 void NWNX_Data_Array_Insert_Obj(object obj, string tag, int index, object element);
80 void NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element);
82 
91 void NWNX_Data_Array_PushBack_Flt(object obj, string tag, float element);
92 void NWNX_Data_Array_PushBack_Int(object obj, string tag, int element);
93 void NWNX_Data_Array_PushBack_Obj(object obj, string tag, object element);
94 void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element);
96 
98 void NWNX_Data_Array_Resize(int type, object obj, string tag, int size);
99 
101 void NWNX_Data_Array_Shuffle(int type, object obj, string tag);
102 
104 int NWNX_Data_Array_Size(int type, object obj, string tag);
105 
107 void NWNX_Data_Array_SortAscending(int type, object obj, string tag);
108 
110 void NWNX_Data_Array_SortDescending(int type, object obj, string tag);
111 
120 void NWNX_Data_Array_Set_Flt(object obj, string tag, int index, float element);
121 void NWNX_Data_Array_Set_Int(object obj, string tag, int index, int element);
122 void NWNX_Data_Array_Set_Obj(object obj, string tag, int index, object element);
123 void NWNX_Data_Array_Set_Str(object obj, string tag, int index, string element);
125 
127 
129 // return the value contained in location "index"
130 string NWNX_Data_Array_At_Str(object obj, string tag, int index)
131 {
132  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
133  return Array_At_Str(tag, index, obj);
134 }
135 
136 float NWNX_Data_Array_At_Flt(object obj, string tag, int index)
137 {
138  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
139  return Array_At_Flt(tag, index, obj);
140 }
141 
142 int NWNX_Data_Array_At_Int(object obj, string tag, int index)
143 {
144  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
145  return Array_At_Int(tag, index, obj);
146 }
147 
148 object NWNX_Data_Array_At_Obj(object obj, string tag, int index)
149 {
150  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
151  return Array_At_Obj(tag, index, obj);
152 }
153 
154 void NWNX_Data_Array_Clear(int type, object obj, string tag)
155 {
156  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
157  Array_Clear(tag, obj);
158 }
159 
161 // Return true/value (1/0) if the array contains the value "element"
162 int NWNX_Data_Array_Contains_Str(object obj, string tag, string element)
163 {
164  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
165  return Array_Contains_Str(tag, element, obj);
166 }
167 
168 int NWNX_Data_Array_Contains_Flt(object obj, string tag, float element)
169 {
170  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
171  return Array_Contains_Flt(tag, element, obj);
172 }
173 
174 int NWNX_Data_Array_Contains_Int(object obj, string tag, int element)
175 {
176  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
177  return Array_Contains_Int(tag, element, obj);
178 }
179 
180 int NWNX_Data_Array_Contains_Obj(object obj, string tag, object element)
181 {
182  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
183  return Array_Contains_Obj(tag, element, obj);
184 }
185 
186 
188 void NWNX_Data_Array_Copy(int type, object obj, string tag, string otherTag)
189 {
190  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
191  Array_Copy(tag, otherTag, obj);
192 }
193 
195 void NWNX_Data_Array_Erase(int type, object obj, string tag, int index)
196 {
197  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
198  Array_Erase(tag, index, obj);
199 }
200 
202 // return the index in the array containing "element"
203 // if not found, return NWNX_DATA_INVALID_INDEX
204 int NWNX_Data_Array_Find_Str(object obj, string tag, string element)
205 {
206  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
207  return Array_Find_Str(tag, element, obj);
208 }
209 
210 int NWNX_Data_Array_Find_Flt(object obj, string tag, float element)
211 {
212  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
213  return Array_Find_Flt(tag, element, obj);
214 }
215 
216 int NWNX_Data_Array_Find_Int(object obj, string tag, int element)
217 {
218  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
219  return Array_Find_Int(tag, element, obj);
220 }
221 
222 int NWNX_Data_Array_Find_Obj(object obj, string tag, object element)
223 {
224  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
225  return Array_Find_Obj(tag, element, obj);
226 }
227 
229 // Insert a new element into position 'index'. If index is beyond the number of rows in the array,
230 // this will quietly fail. This could be changed if you wanted to support sparse
231 // arrays.
232 void NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element)
233 {
234  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
235  Array_Insert_Str(tag, index, element, obj);
236 }
237 
238 void NWNX_Data_Array_Insert_Flt(object obj, string tag, int index, float element)
239 {
240  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
241  Array_Insert_Flt(tag, index, element, obj);
242 }
243 
244 void NWNX_Data_Array_Insert_Int(object obj, string tag, int index, int element)
245 {
246  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
247  Array_Insert_Int(tag, index, element, obj);
248 }
249 
250 void NWNX_Data_Array_Insert_Obj(object obj, string tag, int index, object element)
251 {
252  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
253  Array_Insert_Obj(tag, index, element, obj);
254 }
255 
257 // Insert a new element at the end of the array.
258 void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element)
259 {
260  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
261  Array_PushBack_Str(tag, element, obj);
262 }
263 
264 void NWNX_Data_Array_PushBack_Flt(object obj, string tag, float element)
265 {
266  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
267  Array_PushBack_Flt(tag, element, obj);
268 }
269 
270 void NWNX_Data_Array_PushBack_Int(object obj, string tag, int element)
271 {
272  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
273  Array_PushBack_Int(tag, element, obj);
274 }
275 
276 void NWNX_Data_Array_PushBack_Obj(object obj, string tag, object element)
277 {
278  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
279  Array_PushBack_Obj(tag, element, obj);
280 }
281 
283 // Cuts the array off at size 'size'. Elements beyond size are removed.
284 void NWNX_Data_Array_Resize(int type, object obj, string tag, int size)
285 {
286  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
287  Array_Resize(tag, size, obj);
288 }
289 
291 void NWNX_Data_Array_Shuffle(int type, object obj, string tag)
292 {
293  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
294  Array_Shuffle(tag, obj);
295 }
296 
298 int NWNX_Data_Array_Size(int type, object obj, string tag)
299 {
300  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
301  return Array_Size(tag, obj);
302 }
303 
305 // Sort the array by value according to 'direciton' (ASC or DESC)
306 // Note that this is a lexical sort, so sorting an array of ints or floats will have
307 // odd results
308 void NWNX_Data_Array_Sort(object obj, string tag, string direction)
309 {
310  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
311  Array_Sort(tag, direction, TYPE_STRING, obj);
312 }
313 
314 void NWNX_Data_Array_SortAscending(int type, object obj, string tag)
315 {
316  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
317  Array_SortAscending(tag, TYPE_STRING, obj);
318 }
319 
320 void NWNX_Data_Array_SortDescending(int type, object obj, string tag)
321 {
322  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
324 }
325 
327 // Set the value of array index 'index' to a 'element'
328 // This will quietly eat values if index > array size
329 void NWNX_Data_Array_Set_Str(object obj, string tag, int index, string element)
330 {
331  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
332  Array_Set_Str(tag, index, element, obj);
333 }
334 
335 void NWNX_Data_Array_Set_Flt(object obj, string tag, int index, float element)
336 {
337  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
338  Array_Set_Flt(tag, index, element, obj);
339 }
340 
341 void NWNX_Data_Array_Set_Int(object obj, string tag, int index, int element)
342 {
343  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
344  Array_Set_Int(tag, index, element, obj);
345 }
346 
347 void NWNX_Data_Array_Set_Obj(object obj, string tag, int index, object element)
348 {
349  WriteTimestampedLogEntry("WARNING: NWNX_Data is deprecated. You should migrate to Array (see inc_array)");
350  Array_Set_Obj(tag, index, element, obj);
351 }
NWNX_Data_Array_Set_Obj
void NWNX_Data_Array_Set_Obj(object obj, string tag, int index, object element)
Definition: nwnx_data.nss:347
NWNX_DATA_TYPE_OBJECT
const int NWNX_DATA_TYPE_OBJECT
Definition: nwnx_data.nss:14
Array_SortDescending
void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID)
Sorts the collection based on descending order.
Definition: inc_array.nss:463
NWNX_Data_Array_PushBack_Str
void NWNX_Data_Array_PushBack_Str(object obj, string tag, string element)
Definition: nwnx_data.nss:258
NWNX_Data_Array_PushBack_Obj
void NWNX_Data_Array_PushBack_Obj(object obj, string tag, object element)
Definition: nwnx_data.nss:276
NWNX_Data_Array_Insert_Obj
void NWNX_Data_Array_Insert_Obj(object obj, string tag, int index, object element)
Definition: nwnx_data.nss:250
NWNX_Data_Array_Find_Int
int NWNX_Data_Array_Find_Int(object obj, string tag, int element)
Definition: nwnx_data.nss:216
Array_At_Flt
float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:205
Array_Resize
void Array_Resize(string tag, int size, object obj=OBJECT_INVALID)
Resizes the array. If the array is shrinking, it chops off elements at the ned.
Definition: inc_array.nss:407
Array_Set_Flt
void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:483
Array_Set_Obj
void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:493
Array_Copy
void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID)
Copies the array of name otherTag over the array of name tag.
Definition: inc_array.nss:274
NWNX_Data_Array_Set_Str
void NWNX_Data_Array_Set_Str(object obj, string tag, int index, string element)
Definition: nwnx_data.nss:329
Array_Contains_Flt
int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:257
Array_Shuffle
void Array_Shuffle(string tag, object obj=OBJECT_INVALID)
Reorders the array such each possible permutation of elements has equal probability of appearance.
Definition: inc_array.nss:414
NWNX_Data_Array_Insert_Int
void NWNX_Data_Array_Insert_Int(object obj, string tag, int index, int element)
Definition: nwnx_data.nss:244
NWNX_Data_Array_Resize
void NWNX_Data_Array_Resize(int type, object obj, string tag, int size)
Resizes the array. If the array is shrinking, it chops off elements at the ned.
Definition: nwnx_data.nss:284
Array_Insert_Str
void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:339
NWNX_Data_Array_PushBack_Int
void NWNX_Data_Array_PushBack_Int(object obj, string tag, int element)
Definition: nwnx_data.nss:270
Array_Set_Str
void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:471
Array_At_Obj
object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:223
Array_Insert_Flt
void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:358
NWNX_Data_Array_Find_Flt
int NWNX_Data_Array_Find_Flt(object obj, string tag, float element)
Definition: nwnx_data.nss:210
Array_Find_Str
int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:301
NWNX_DATA_TYPE_FLOAT
const int NWNX_DATA_TYPE_FLOAT
Definition: nwnx_data.nss:12
Array_Insert_Obj
void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:368
Array_At_Str
string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:191
Array_Clear
void Array_Clear(string tag, object obj=OBJECT_INVALID)
Clears the entire array, such that size==0.
Definition: inc_array.nss:232
NWNX_Data_Array_SortAscending
void NWNX_Data_Array_SortAscending(int type, object obj, string tag)
Sorts the collection based on descending order.
Definition: nwnx_data.nss:314
NWNX_DATA_INVALID_INDEX
const int NWNX_DATA_INVALID_INDEX
Definition: nwnx_data.nss:11
Array_Insert_Int
void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:363
Array_PushBack_Flt
void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:390
NWNX_Data_Array_Contains_Str
int NWNX_Data_Array_Contains_Str(object obj, string tag, string element)
Definition: nwnx_data.nss:162
Array_PushBack_Str
void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:375
NWNX_Data_Array_Contains_Obj
int NWNX_Data_Array_Contains_Obj(object obj, string tag, object element)
Definition: nwnx_data.nss:180
NWNX_Data_Array_SortDescending
void NWNX_Data_Array_SortDescending(int type, object obj, string tag)
Sorts the collection based on descending order.
Definition: nwnx_data.nss:320
NWNX_Data_Array_Contains_Int
int NWNX_Data_Array_Contains_Int(object obj, string tag, int element)
Definition: nwnx_data.nss:174
NWNX_Data_Array_Find_Obj
int NWNX_Data_Array_Find_Obj(object obj, string tag, object element)
Definition: nwnx_data.nss:222
NWNX_Data_Array_Shuffle
void NWNX_Data_Array_Shuffle(int type, object obj, string tag)
Reorders the array such each possible permutation of elements has equal probability of appearance.
Definition: nwnx_data.nss:291
NWNX_Data_Array_Contains_Flt
int NWNX_Data_Array_Contains_Flt(object obj, string tag, float element)
Definition: nwnx_data.nss:168
NWNX_Data_Array_Copy
void NWNX_Data_Array_Copy(int type, object obj, string tag, string otherTag)
Copies the array of name otherTag over the array of name tag.
Definition: nwnx_data.nss:188
Array_Set_Int
void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:488
Array_PushBack_Obj
void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:400
TYPE_STRING
const int TYPE_STRING
Definition: inc_array.nss:10
NWNX_Data_Array_Insert_Flt
void NWNX_Data_Array_Insert_Flt(object obj, string tag, int index, float element)
Definition: nwnx_data.nss:238
NWNX_Data_Array_Size
int NWNX_Data_Array_Size(int type, object obj, string tag)
Returns the size of the array.
Definition: nwnx_data.nss:298
TYPE_INTEGER
const int TYPE_INTEGER
Definition: inc_array.nss:8
NWNX_Data_Array_At_Str
string NWNX_Data_Array_At_Str(object obj, string tag, int index)
Definition: nwnx_data.nss:130
NWNX_Data_Array_At_Int
int NWNX_Data_Array_At_Int(object obj, string tag, int index)
Definition: nwnx_data.nss:142
INVALID_INDEX
const int INVALID_INDEX
Definition: inc_array.nss:6
NWNX_Data_Array_PushBack_Flt
void NWNX_Data_Array_PushBack_Flt(object obj, string tag, float element)
Definition: nwnx_data.nss:264
NWNX_Data_Array_Insert_Str
void NWNX_Data_Array_Insert_Str(object obj, string tag, int index, string element)
Definition: nwnx_data.nss:232
Array_Contains_Obj
int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:267
Array_Erase
void Array_Erase(string tag, int index, object obj=OBJECT_INVALID)
Erases the element at index, and shuffles any elements from index size-1 to index + 1 left.
Definition: inc_array.nss:281
Array_Contains_Int
int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:262
NWNX_Data_Array_Find_Str
int NWNX_Data_Array_Find_Str(object obj, string tag, string element)
Definition: nwnx_data.nss:204
NWNX_Data_Array_At_Flt
float NWNX_Data_Array_At_Flt(object obj, string tag, int index)
Definition: nwnx_data.nss:136
TYPE_OBJECT
const int TYPE_OBJECT
Definition: inc_array.nss:9
NWNX_DATA_TYPE_INTEGER
const int NWNX_DATA_TYPE_INTEGER
Definition: nwnx_data.nss:13
NWNX_Data_Array_Set_Int
void NWNX_Data_Array_Set_Int(object obj, string tag, int index, int element)
Definition: nwnx_data.nss:341
Array_At_Int
int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:214
NWNX_Data_Array_At_Obj
object NWNX_Data_Array_At_Obj(object obj, string tag, int index)
Definition: nwnx_data.nss:148
Array_Sort
void Array_Sort(string tag, string dir="ASC", int type=TYPE_STRING, object obj=OBJECT_INVALID)
Definition: inc_array.nss:432
NWNX_DATA_TYPE_STRING
const int NWNX_DATA_TYPE_STRING
Definition: nwnx_data.nss:15
NWNX_Data_Array_Erase
void NWNX_Data_Array_Erase(int type, object obj, string tag, int index)
Erases the element at index, and shuffles any elements from index size-1 to index + 1 left.
Definition: nwnx_data.nss:195
Array_Find_Obj
int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:330
Array_Find_Flt
int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:320
NWNX_Data_Array_Sort
void NWNX_Data_Array_Sort(object obj, string tag, string direction)
Definition: nwnx_data.nss:308
TYPE_FLOAT
const int TYPE_FLOAT
Definition: inc_array.nss:7
Array_Size
int Array_Size(string tag, object obj=OBJECT_INVALID)
Returns the size of the array.
Definition: inc_array.nss:424
NWNX_Data_Array_Set_Flt
void NWNX_Data_Array_Set_Flt(object obj, string tag, int index, float element)
Definition: nwnx_data.nss:335
Array_Find_Int
int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:325
Array_SortAscending
void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID)
Sorts the collection based on descending order.
Definition: inc_array.nss:458
Array_Contains_Str
int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:239
Array_PushBack_Int
void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:395
NWNX_Data_Array_Clear
void NWNX_Data_Array_Clear(int type, object obj, string tag)
Clears the entire array, such that size==0.
Definition: nwnx_data.nss:154