SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RandSync.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAND_SYNC_H
23 #define __RAND_SYNC_H
24
25 #include "Export.h"
26 #include "Rand.h"
27 #include "DS_Queue.h"
28 #include "NativeTypes.h"
29
30 namespace SLNet {
31
32 class BitStream;
33
34 class RAK_DLL_EXPORT RakNetRandomSync
35 {
36 public:
37 RakNetRandomSync();
38 virtual ~RakNetRandomSync();
39 void SeedMT( uint32_t _seed );
40 void SeedMT( uint32_t _seed, uint32_t skipValues );
41 float FrandomMT( void );
42 unsigned int RandomMT( void );
43 uint32_t GetSeed( void ) const;
44 uint32_t GetCallCount( void ) const;
45 void SetCallCount( uint32_t i );
46
47 virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream);
48 virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream);
49 virtual void Serialize(SLNet::BitStream *outputBitstream);
50 virtual void Deserialize(SLNet::BitStream *outputBitstream);
51
52 protected:
53 void Skip( uint32_t count );
54 DataStructures::Queue<unsigned int> usedValues;
55 uint32_t seed;
56 uint32_t callCount;
57 uint32_t usedValueBufferCount;
58 RakNetRandom rnr;
59 };
60 } // namespace SLNet
61
62
63 #endif