comparison mm7_data.h @ 1708:f8414042db1f

Moving NZIArray to a separate class, fixing a few inventory bugs
author Grumpy7
date Mon, 23 Sep 2013 07:07:06 +0200
parents 33c7cc2d48d5
children 1c072d19e397
comparison
equal deleted inserted replaced
1702:5cbd88f8a2eb 1708:f8414042db1f
2 #include <string> 2 #include <string>
3 #include "VectorTypes.h" 3 #include "VectorTypes.h"
4 #include "OSAPI.h" 4 #include "OSAPI.h"
5 #include <array> 5 #include <array>
6 #include <assert.h> 6 #include <assert.h>
7 #include "NZIArray.h"
7 8
8 typedef char _UNKNOWN; 9 typedef char _UNKNOWN;
9 typedef unsigned int uint; 10 typedef unsigned int uint;
10 11
11 12
281 if ( size == 4 ) 282 if ( size == 4 )
282 return uint32(x) > uint32(x+y); 283 return uint32(x) > uint32(x+y);
283 return uint64(x) > uint64(x+y); 284 return uint64(x) > uint64(x+y);
284 } 285 }
285 286
286 template<class _Ty,
287 size_t _Size>
288 class NZIArray : std::array<_Ty, _Size>
289 {
290 public:
291 reference ZerothIndex()
292 {
293 return std::array<_Ty, _Size>::operator [](0);
294 }
295
296 reference operator[](size_type _Pos)
297 { // subscript nonmutable sequence
298 #if _ITERATOR_DEBUG_LEVEL == 2
299 assert(_Pos != 0 && "not allowed to access zeroth element");
300
301 #elif _ITERATOR_DEBUG_LEVEL == 1
302 _SCL_SECURE_VALIDATE_RANGE(_Pos != 0);
303 #endif /* _ITERATOR_DEBUG_LEVEL */
304
305 __analysis_assume(_Pos != 0);
306
307 return std::array<_Ty, _Size>::operator [](_Pos);
308 }
309
310 const_reference operator[](size_type _Pos) const
311 { // subscript nonmutable sequence
312 #if _ITERATOR_DEBUG_LEVEL == 2
313 assert(_Pos != 0 && "not allowed to access zeroth element");
314
315 #elif _ITERATOR_DEBUG_LEVEL == 1
316 _SCL_SECURE_VALIDATE_RANGE(_Pos != 0);
317 #endif /* _ITERATOR_DEBUG_LEVEL */
318
319 __analysis_assume(_Pos != 0);
320
321 return std::array<_Ty, _Size>::operator [](_Pos);
322 }
323 };
324 287
325 //------------------------------------------------------------------------- 288 //-------------------------------------------------------------------------
326 // Data declarations 289 // Data declarations
327 290
328 extern int game_starting_year; 291 extern int game_starting_year;