|
28 | 28 | #endif
|
29 | 29 |
|
30 | 30 | struct ISyncStructure;
|
31 |
| -class NetBitStreamInterface; |
32 | 31 |
|
33 |
| -class NetBitStreamInterfaceNoVersion : public CRefCountable |
| 32 | +// eBitStreamVersion allows us to track what BitStream version is being used without placing magic numbers everywhere. |
| 33 | +// It also helps us know what code branches can be removed when we increment a major version of MTA. |
| 34 | +// Make sure you only add new items to the end of the list, above the "Latest" entry. |
| 35 | +enum class eBitStreamVersion : unsigned short |
34 | 36 | {
|
35 |
| -public: |
36 |
| - virtual operator NetBitStreamInterface&() = 0; |
| 37 | + Unk = 0x030, |
| 38 | + |
| 39 | + // DESCRIPTION |
| 40 | + // YYYY-MM-DD |
| 41 | + // Name, |
| 42 | + |
| 43 | + // This allows us to automatically increment the BitStreamVersion when things are added to this enum. |
| 44 | + // Make sure you only add things above this comment. |
| 45 | + Next, |
| 46 | + Latest = Next - 1, |
| 47 | +}; |
37 | 48 |
|
| 49 | +class NetBitStreamInterface : public CRefCountable |
| 50 | +{ |
| 51 | +public: |
38 | 52 | virtual int GetReadOffsetAsBits() = 0;
|
39 | 53 | virtual void SetReadOffsetAsBits(int iOffset) = 0;
|
40 | 54 |
|
@@ -128,6 +142,10 @@ class NetBitStreamInterfaceNoVersion : public CRefCountable
|
128 | 142 |
|
129 | 143 | virtual unsigned char* GetData() const = 0;
|
130 | 144 |
|
| 145 | + virtual unsigned short Version() const = 0; |
| 146 | + |
| 147 | + bool Can(eBitStreamVersion query) { return static_cast<eBitStreamVersion>(Version()) >= query; } |
| 148 | + |
131 | 149 | // Force long types to use 4 bytes
|
132 | 150 | bool Read(unsigned long& e)
|
133 | 151 | {
|
@@ -394,39 +412,6 @@ class NetBitStreamInterfaceNoVersion : public CRefCountable
|
394 | 412 | }
|
395 | 413 | };
|
396 | 414 |
|
397 |
| -// eBitStreamVersion allows us to track what BitStream version is being used without placing magic numbers everywhere. |
398 |
| -// It also helps us know what code branches can be removed when we increment a major version of MTA. |
399 |
| -// Make sure you only add new items to the end of the list, above the "Latest" entry. |
400 |
| -enum class eBitStreamVersion : unsigned short |
401 |
| -{ |
402 |
| - Unk = 0x030, |
403 |
| - |
404 |
| - // DESCRIPTION |
405 |
| - // YYYY-MM-DD |
406 |
| - // Name, |
407 |
| - |
408 |
| - // This allows us to automatically increment the BitStreamVersion when things are added to this enum. |
409 |
| - // Make sure you only add things above this comment. |
410 |
| - Next, |
411 |
| - Latest = Next - 1, |
412 |
| -}; |
413 |
| - |
414 |
| -class NetBitStreamInterface : public NetBitStreamInterfaceNoVersion |
415 |
| -{ |
416 |
| - NetBitStreamInterface(const NetBitStreamInterface&); |
417 |
| - const NetBitStreamInterface& operator=(const NetBitStreamInterface&); |
418 |
| - |
419 |
| -protected: |
420 |
| - NetBitStreamInterface() { DEBUG_CREATE_COUNT("NetBitStreamInterface"); } |
421 |
| - virtual ~NetBitStreamInterface() { DEBUG_DESTROY_COUNT("NetBitStreamInterface"); } |
422 |
| - |
423 |
| -public: |
424 |
| - virtual operator NetBitStreamInterface&() { return *this; } |
425 |
| - virtual unsigned short Version() const = 0; |
426 |
| - |
427 |
| - bool Can(eBitStreamVersion query) { return static_cast<eBitStreamVersion>(Version()) >= query; } |
428 |
| -}; |
429 |
| - |
430 | 415 | // Interface for all sync structures
|
431 | 416 | struct ISyncStructure
|
432 | 417 | {
|
|
0 commit comments