2424#endif
2525
2626#ifdef __cpp_lib_string_view
27- #include < string_view>
27+ #include < string_view>
2828#endif
2929
3030struct ISyncStructure ;
@@ -372,26 +372,26 @@ class NetBitStreamInterface : public CRefCountable
372372 return ReadStringCharacters (result, uiLength);
373373 }
374374
375- #ifdef MTA_CLIENT
376- #define MAX_ELEMENTS MAX_CLIENT_ELEMENTS
377- #else
378- #define MAX_ELEMENTS MAX_SERVER_ELEMENTS
379- #endif
375+ #ifdef MTA_CLIENT
376+ #define MAX_ELEMENTS MAX_CLIENT_ELEMENTS
377+ #else
378+ #define MAX_ELEMENTS MAX_SERVER_ELEMENTS
379+ #endif
380380
381381 // Write an element ID
382382 void Write (const ElementID& ID)
383383 {
384384 static const unsigned int bitcount = NumberOfSignificantBits<(MAX_ELEMENTS - 1 )>::COUNT;
385385 const unsigned int & IDref = ID.Value ();
386- #ifdef MTA_CLIENT
386+ #ifdef MTA_CLIENT
387387 if (IDref != INVALID_ELEMENT_ID && IDref >= MAX_SERVER_ELEMENTS)
388388 {
389389 dassert (" Sending client side element id to server" && 0 );
390390 uint uiInvalidId = INVALID_ELEMENT_ID;
391391 WriteBits (reinterpret_cast <const unsigned char *>(&uiInvalidId), bitcount);
392392 return ;
393393 }
394- #endif
394+ #endif
395395 WriteBits (reinterpret_cast <const unsigned char *>(&IDref), bitcount);
396396 }
397397
@@ -412,271 +412,10 @@ class NetBitStreamInterface : public CRefCountable
412412 }
413413};
414414
415- // eBitStreamVersion allows us to track what BitStream version is being used without placing magic numbers everywhere.
416- // It also helps us know what code branches can be removed when we increment a major version of MTA.
417- // Make sure you only add new items to the end of the list, above the "Latest" entry.
418- enum class eBitStreamVersion : unsigned short
419- {
420- Unk = 0x030 ,
421-
422-
423- //
424- // 1.5.0 UNSTABLE - 2015-01-17
425- //
426-
427- // Add "quickstand" to setGlitchEnabled
428- // 2015-07-13 0x063 209837dcdc30d267519abc12e1361a1d18cd1553
429- QuickStandGlitch,
430-
431- //
432- // 1.5.0 RC RELEASED - 2015-07-15
433- //
434-
435- //
436- // 1.5.1 RELEASED - 2015-11-05
437- //
438-
439- // Update fix #9038 (bugged shotgun with bullet sync) to only work if all connected clients support it
440- // 2015-10-17 0x064 edbc6d37a734914b7349c693edf9a087a5a78a3d
441- ShotgunDamageFix,
442-
443- //
444- // 1.5.2 RELEASED - 2016-01-24
445- //
446-
447- // Add blend parameter to setPedAnimation (#62)
448- // 2016-09-05 0x065 f51983c3e3385b4de8d754e11efe329acaee9301
449- SetPedAnimation_Blend,
450-
451- // Update net module version
452- // 2016-09-24 0x066 3de7e5bd2d425747617a24350f2974e02cddc6dc
453- NetUpdate_0x09E,
454-
455- //
456- // 1.5.3 RELEASED - 2016-10-20
457- //
458-
459- // Fix player nametag unicode characters missing on player join
460- // 2016-12-09 0x067 2e582453b476c1183bd9fae5363a7cffdb531834
461- UnicodeNametags,
462-
463- // Add -1 parameter to setElementDimension (only to objects) (#111)
464- // 2017-02-22 0x068 2e319aa823929360da9e1f48c7eb233f1d6f29e5
465- DimensionOmnipresence,
466-
467- // Add support for more special detections
468- // 2017-02-26 0x069 9b6187b3c2eaa655624254f8d83acb35b31243e7
469- MoreSpecialDetections_Nice69,
470-
471- // Add option to enable fakelag command for testing sync issues
472- // 2017-03-08 0x06A a99fa0afa3b55e84f15aed335ab542520f39126d
473- FakeLagCommand,
474-
475- //
476- // 1.5.4 RELEASED - 2017-04-17
477- //
478-
479- // Add player element for onClientChatMessage (#138)
480- // 2017-07-04 0x06B 8c7095599c6d54784692bf93a1e6c7f56392c323
481- OnClientChatMessage_PlayerSource,
482-
483- //
484- // 1.5.5 RELEASED - 2017-08-07
485- //
486-
487- // Add bShallow argument for server-side water as well (#240)
488- // 2018-08-05 0x06C 1321b538559efe6d70deb5b784c2d392d52658f5
489- Water_bShallow_ServerSide,
490-
491- //
492- // 1.5.6 RELEASED - 2018-09-07
493- // 1.5.7 RELEASED - 2019-08-31
494- //
495-
496- // Add option to disable spawning components by setVehicleDoorState
497- // 2019-10-11 0x06D e79d97195439f70ac66ece1859152b4c4896af31
498- SetVehicleDoorState_SpawnFlyingComponent,
499-
500- // Increment BitStream version for Discord update (#1330)
501- // 2020-03-27 0x06E a0ce68f284487ba636e839b06c103bc2442d95e0
502- Discord_InitialImplementation,
503-
504- // Add analog control sync for accelerate and brake_reverse (#1164)
505- // 2020-04-02 0x06F 41e36cc67520dded2a5203727a726c4261c65e31
506- AnalogControlSync_AccelBrakeReverse,
507-
508- //
509- // 1.5.8 RELEASED - 2020-10-11
510- //
511-
512- // setWaterLevel: add bIncludeWorldSeaLevel and bIncludeOutsideWorldLevel
513- // 2020-11-03 0x70
514- SetWaterLevel_ChangeOutsideWorldLevel,
515-
516- // Implement entering/exiting/jacking for peds #1748
517- // 2020-11-10 0x71
518- PedEnterExit,
519-
520- // Add height for colpolygon (#1908)
521- // 2021-01-16 0x72
522- SetColPolygonHeight,
523-
524- // Support for vehicle blow without explosion and blow state synchronisation
525- // 2021-02-26 0x73
526- VehicleBlowStateSupport,
527-
528- // Implement messageType parameter to onClientChatMessage (#1020)
529- // 2021-05-15 0x74
530- OnClientChatMessage_MessageType,
531-
532- // Add serverside event "onPlayerResourceStart" (#2150)
533- // 2021-08-30 0x75
534- OnPlayerResourceStart,
535-
536- //
537- // 1.5.9 RELEASED - 2021-10-01
538- //
539-
540- // Remove "old" Discord implementation (#2499)
541- // 2022-01-16 0x76
542- Discord_Cleanup,
543-
544- //
545- // 1.6.0 RELEASED - 2023-04-07
546- //
547-
548- CEntityAddPacket_ObjectBreakable,
549-
550- // Add serverside setWorldSpecialPropertyEnabled
551- // 2023-08-17
552- WorldSpecialProperties,
553-
554- // Add "fireballdestruct" to setWorldSpecialPropertyEnabled
555- // 2023-09-09
556- WorldSpecialProperty_FireballDestruct,
557-
558- // Send server name to player in CPlayerJoinCompletePacket
559- // 2023-10-12
560- CPlayerJoinCompletePacket_ServerName,
561-
562- // Add "roadsignstext" to setWorldSpecialPropertyEnabled
563- // 2024-05-17
564- WorldSpecialProperty_RoadSignsText,
565-
566- // Add "extendedwatercannons" to setWorldSpecialPropertyEnabled
567- // 2024-05-23
568- WorldSpecialProperty_ExtendedWaterCannons,
569-
570- // Add breakObject to serverside as well
571- // 2024-05-31
572- BreakObject_Serverside,
573-
574- // Ped syncronization revision
575- // 2024-06-16
576- PedSync_Revision,
577-
578- // Add "tunnelweatherblend" to setWorldSpecialPropertyEnabled
579- // 2024-06-30
580- WorldSpecialProperty_TunnelWeatherBlend,
581-
582- // Checkpoint & arrow alpha fix
583- // 2024-07-03
584- Marker_IgnoreAlphaLimits,
585-
586- // Add "setMarkerTargetArrowProperties"
587- // 2024-07-05
588- SetMarkerTargetArrowProperties,
589-
590- // Add respawnObject and toggleObjectRespawn to serverside
591- // 2024-09-04
592- RespawnObject_Serverside,
593-
594- // Add check_duplicate_serials
595- // 2024-09-04
596- CheckDuplicateSerials,
597-
598- // Add ignorefirestate special world property
599- // 2024-11-07
600- WorldSpecialProperty_IgnoreFireState,
601-
602- // Fix iPedSyncerDistance and iUnoccupiedVehicleSyncerDistance sync
603- // 2024-11-22
604- FixSyncerDistance,
605-
606- // Add onPlayerChangesWorldSpecialProperty
607- // 2024-11-26
608- WorldSpecialPropertyEvent,
609-
610- // Add setElementOnFire function
611- // 2024-12-30
612- SetElementOnFire,
613-
614- // Add "spawnFlyingComponent" to setVehiclePanelState
615- // 2024-12-31
616- SetVehiclePanelState_SpawnFlyingComponent,
617-
618- // Ped animations synchronization
619- // 2025-01-01
620- AnimationsSync,
621-
622- // Add server side isPedReloadingWeapon
623- // 2025-01-09
624- IsPedReloadingWeapon,
625-
626- // Add "flyingcomponents" to setWorldSpecialPropertyEnabled
627- // 2025-01-10
628- WorldSpecialProperty_FlyingComponents,
629-
630- // Ped's camera synchronization
631- // 2025-01-29
632- PedSync_CameraRotation,
633-
634- // Add "vehicleburnexplosions" to setWorldSpecialPropertyEnabled
635- // 2025-02-20
636- WorldSpecialProperty_VehicleBurnExplosions,
637-
638- // Add setElementCollidableWith serverside
639- // 2025-03-14
640- SetElementCollidableWith_Serverside,
641-
642- // Add serverside building support
643- // 2025-05-26
644- ServersideBuildingElement,
645-
646- // Add "vehenginemanualmode" to setWorldSpecialPropertyEnabled
647- // 2025-06-02
648- WorldSpecialProperty_VehicleEngineAutoStart,
649-
650- // DESCRIPTION
651- // YYYY-MM-DD
652- // Name,
653-
654- // This allows us to automatically increment the BitStreamVersion when things are added to this enum.
655- // Make sure you only add things above this comment.
656- Next,
657- Latest = Next - 1 ,
658- };
659-
660- class NetBitStreamInterface : public NetBitStreamInterfaceNoVersion
661- {
662- NetBitStreamInterface (const NetBitStreamInterface&);
663- const NetBitStreamInterface& operator =(const NetBitStreamInterface&);
664-
665- protected:
666- NetBitStreamInterface () { DEBUG_CREATE_COUNT (" NetBitStreamInterface" ); }
667- virtual ~NetBitStreamInterface () { DEBUG_DESTROY_COUNT (" NetBitStreamInterface" ); }
668-
669- public:
670- virtual operator NetBitStreamInterface&() { return *this ; }
671- virtual unsigned short Version () const = 0;
672-
673- bool Can (eBitStreamVersion query) { return static_cast <eBitStreamVersion>(Version ()) >= query; }
674- };
675-
676415// Interface for all sync structures
677416struct ISyncStructure
678417{
679418 virtual ~ISyncStructure () {}
680419 virtual bool Read (NetBitStreamInterface& bitStream) = 0;
681420 virtual void Write (NetBitStreamInterface& bitStream) const = 0;
682- };
421+ };
0 commit comments