FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_networkType.hpp
1/*
2 * Copyright 2025 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _FGE_C_NETWORKTYPE_HPP_INCLUDED
18#define _FGE_C_NETWORKTYPE_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "C_identity.hpp"
22#include "C_packet.hpp"
23#include "FastEngine/C_callback.hpp"
24#include "FastEngine/C_dataAccessor.hpp"
25#include "FastEngine/C_flag.hpp"
26#include "FastEngine/C_propertyList.hpp"
27#include <deque>
28#include <memory>
29#include <string>
30#include <unordered_map>
31#include <vector>
32
33#define FGE_NET_WAITING_UPDATE_DELAY std::chrono::milliseconds(800)
34
35namespace fge
36{
37
38class Scene;
39class TagList;
40
41namespace net
42{
43
44enum PerClientConfigs : uint32_t
45{
46 CLIENTCONFIG_MODIFIED_FLAG = 1 << 0,
47 CLIENTCONFIG_REQUIRE_EXPLICIT_UPDATE_FLAG = 1 << 1,
48
49 CLIENTCONFIG_CUSTOM_FLAG_START = 1 << 2,
50
51 CLIENTCONFIG_DEFAULT = 0
52};
53
54struct PerClientData
55{
56 inline constexpr PerClientData() = default;
57 inline explicit constexpr PerClientData(fge::EnumFlags_t<PerClientConfigs> config) :
58 _config(config)
59 {}
60
61 fge::EnumFlags<PerClientConfigs> _config{CLIENTCONFIG_DEFAULT};
62 std::shared_ptr<void> _data{nullptr};
63};
64
65class ClientList;
66
67class FGE_API PerClientSyncContext
68{
69public:
70 using SyncTable = std::unordered_map<Identity, PerClientData, IdentityHash>;
71
72 PerClientSyncContext() = default;
73 PerClientSyncContext(PerClientSyncContext const&) = delete;
74 PerClientSyncContext(PerClientSyncContext&&) noexcept = default;
75 virtual ~PerClientSyncContext() = default;
76
77 PerClientSyncContext& operator=(PerClientSyncContext const&) = delete;
78 PerClientSyncContext& operator=(PerClientSyncContext&&) noexcept = default;
79
80 void clear();
81 void clientsCheckup(ClientList const& clients,
82 bool force,
83 fge::EnumFlags_t<PerClientConfigs> config = CLIENTCONFIG_DEFAULT);
84
85 void setModificationFlag();
86 bool setModificationFlag(Identity const& client);
87 bool clearModificationFlag(Identity const& client);
88 [[nodiscard]] bool isModified(Identity const& client) const;
89
90 void setRequireExplicitUpdateFlag(Identity const& client);
91 [[nodiscard]] bool isRequiringExplicitUpdate(Identity const& client) const;
92
93 PerClientData& newClient(Identity const& client, fge::EnumFlags_t<PerClientConfigs> config = CLIENTCONFIG_DEFAULT);
94 void delClient(Identity const& client);
95
96 [[nodiscard]] bool hasClient(Identity const& client) const;
97
98 [[nodiscard]] PerClientData const* getClientData(Identity const& client) const;
99 [[nodiscard]] PerClientData* getClientData(Identity const& client);
100
101 [[nodiscard]] SyncTable::const_iterator begin() const;
102 [[nodiscard]] SyncTable::iterator begin();
103 [[nodiscard]] SyncTable::const_iterator end() const;
104 [[nodiscard]] SyncTable::iterator end();
105
106protected:
107 virtual void createClientData([[maybe_unused]] std::shared_ptr<void>& ptr) const {}
108 virtual void applyClientData([[maybe_unused]] std::shared_ptr<void>& ptr) const {}
109
110private:
111 SyncTable g_syncTable;
112};
113
124class FGE_API NetworkTypeBase : protected PerClientSyncContext
125{
126protected:
127 NetworkTypeBase() = default;
128
129public:
130 ~NetworkTypeBase() override = default;
131
137 virtual void const* getSource() const = 0;
138
145 virtual bool applyData(Packet const& pck) = 0;
152 virtual void packData(Packet& pck, Identity const& id) = 0;
158 virtual void packData(Packet& pck) = 0;
159
172 virtual bool clientsCheckup(ClientList const& clients, bool force);
173
180 virtual bool checkClient(Identity const& id) const;
186 virtual void forceCheckClient(Identity const& id);
192 virtual void forceUncheckClient(Identity const& id);
200 virtual void requireExplicitUpdateClient(Identity const& id);
201
207 virtual bool check() const = 0;
211 virtual void forceCheck() = 0;
215 virtual void forceUncheck() = 0;
221 [[nodiscard]] bool isForced() const;
222
223 void clearExplicitUpdateFlag();
228 bool isNeedingExplicitUpdate() const;
229
230 void clearWaitingUpdateFlag();
242 bool isWaitingUpdate() const;
243
244 [[nodiscard]] std::chrono::microseconds getLastUpdateTime() const;
245 void setLastUpdateTime();
246
251
252protected:
253 bool _g_needExplicitUpdate{false};
254 bool _g_waitingUpdate{false};
255 bool _g_force{false};
256 std::chrono::microseconds _g_lastUpdateTime{0};
257};
258
266template<class T>
267class NetworkType : public NetworkTypeBase
268{
269public:
271 ~NetworkType() override = default;
272
273 void const* getSource() const override;
274
275 bool applyData(Packet const& pck) override;
276 void packData(Packet& pck, Identity const& id) override;
277 void packData(Packet& pck) override;
278
279 bool check() const override;
280 void forceCheck() override;
281 void forceUncheck() override;
282
283private:
284 T g_typeCopy;
285 fge::DataAccessor<T> g_typeSource;
286};
287
293class FGE_API NetworkTypeScene : public NetworkTypeBase
294{
295public:
296 NetworkTypeScene(fge::Scene* source);
297 ~NetworkTypeScene() override = default;
298
299 void const* getSource() const override;
300
301 bool applyData(Packet const& pck) override;
302 void packData(Packet& pck, Identity const& id) override;
303 void packData(Packet& pck) override;
304
305 bool clientsCheckup(ClientList const& clients, bool force) override;
306
307 bool checkClient(Identity const& id) const override;
308 void forceCheckClient(Identity const& id) override;
309 void forceUncheckClient(Identity const& id) override;
310
311 bool check() const override;
312 void forceCheck() override;
313 void forceUncheck() override;
314
315private:
316 fge::Scene* g_typeSource;
317};
318
324class FGE_API NetworkTypeTag : public NetworkTypeBase
325{
326public:
327 NetworkTypeTag(fge::TagList* source, std::string tag);
328 ~NetworkTypeTag() override = default;
329
330 void const* getSource() const override;
331
332 bool applyData(Packet const& pck) override;
333 void packData(Packet& pck, Identity const& id) override;
334 void packData(Packet& pck) override;
335
336 bool check() const override;
337 void forceCheck() override;
338 void forceUncheck() override;
339
340private:
341 fge::TagList* g_typeSource;
342 std::string g_tag;
343};
344
351class FGE_API NetworkTypeSmoothVec2Float : public NetworkTypeBase
352{
353public:
354 NetworkTypeSmoothVec2Float(fge::DataAccessor<fge::Vector2f> source, float errorRange);
355 ~NetworkTypeSmoothVec2Float() override = default;
356
357 void const* getSource() const override;
358
359 bool applyData(Packet const& pck) override;
360 void packData(Packet& pck, Identity const& id) override;
361 void packData(Packet& pck) override;
362
363 bool check() const override;
364 void forceCheck() override;
365 void forceUncheck() override;
366
367 fge::Vector2f const& getCache() const;
368 void setErrorRange(float range);
369 float getErrorRange() const;
370
371private:
372 fge::Vector2f g_typeCopy;
374 float g_errorRange;
375};
376
381class FGE_API NetworkTypeSmoothFloat : public NetworkTypeBase
382{
383public:
384 NetworkTypeSmoothFloat(fge::DataAccessor<float> source, float errorRange);
385 ~NetworkTypeSmoothFloat() override = default;
386
387 void const* getSource() const override;
388
389 bool applyData(Packet const& pck) override;
390 void packData(Packet& pck, Identity const& id) override;
391 void packData(Packet& pck) override;
392
393 bool check() const override;
394 void forceCheck() override;
395 void forceUncheck() override;
396
397 float getCache() const;
398 void setErrorRange(float range);
399 float getErrorRange() const;
400
401private:
402 float g_typeCopy;
403 fge::DataAccessor<float> g_typeSource;
404 float g_errorRange;
405};
406
414template<class T>
415class NetworkTypeProperty : public NetworkTypeBase
416{
417public:
419 ~NetworkTypeProperty() override = default;
420
421 void const* getSource() const override;
422
423 bool applyData(Packet const& pck) override;
424 void packData(Packet& pck, Identity const& id) override;
425 void packData(Packet& pck) override;
426
427 bool check() const override;
428 void forceCheck() override;
429 void forceUncheck() override;
430
431private:
432 fge::Property* g_typeSource;
433};
434
442template<class T>
443class NetworkTypePropertyList : public NetworkTypeBase
444{
445public:
446 NetworkTypePropertyList(fge::PropertyList* source, std::string const& vname);
447 ~NetworkTypePropertyList() override = default;
448
449 void const* getSource() const override;
450
451 bool applyData(Packet const& pck) override;
452 void packData(Packet& pck, Identity const& id) override;
453 void packData(Packet& pck) override;
454
455 bool check() const override;
456 void forceCheck() override;
457 void forceUncheck() override;
458
459 std::string const& getValueName() const;
460
461private:
462 fge::PropertyList* g_typeSource;
463 std::string g_vname;
464};
465
473template<class T>
474class NetworkTypeManual : public NetworkTypeBase
475{
476public:
477 NetworkTypeManual(T* source);
478 ~NetworkTypeManual() override = default;
479
480 void const* getSource() const override;
481
482 bool applyData(Packet const& pck) override;
483 void packData(Packet& pck, Identity const& id) override;
484 void packData(Packet& pck) override;
485
486 bool check() const override;
487 void forceCheck() override;
488 void forceUncheck() override;
489
490 void trigger();
491
492private:
493 T* g_typeSource;
494 bool g_trigger;
495};
496
497template<class T>
498class RecordedVector;
499
500template<class T>
501Packet& operator<<(Packet& pck, RecordedVector<T> const& vec);
502template<class T>
503Packet const& operator>>(Packet const& pck, RecordedVector<T>& vec);
504
505enum class RecordedEventTypes : uint8_t
506{
507 ADD,
508 REMOVE,
509 REMOVE_ALL,
510 MODIFY
511};
513{
514 RecordedEventTypes _type;
515 SizeType _index;
516};
517
518inline Packet& operator<<(Packet& pck, RecordedEvent const& event);
519inline Packet const& operator>>(Packet const& pck, RecordedEvent& event);
520
521template<class T>
522class RecordedVector
523{
524public:
525 using const_iterator = typename std::vector<T>::const_iterator;
526 using iterator = typename std::vector<T>::iterator;
527 using const_reverse_iterator = typename std::vector<T>::const_reverse_iterator;
528 using const_reference = typename std::vector<T>::const_reference;
529 using reference = typename std::vector<T>::reference;
530
531 using EventQueue = std::vector<RecordedEvent>;
532
533 RecordedVector() = default;
534 ~RecordedVector() = default;
535
536 [[nodiscard]] const_reference at(SizeType index) const;
537 [[nodiscard]] const_reference operator[](SizeType index) const;
538 [[nodiscard]] const_reference front() const;
539 [[nodiscard]] const_reference back() const;
540 [[nodiscard]] T const* data() const;
541
542 [[nodiscard]] const_iterator begin() const;
543 [[nodiscard]] const_iterator end() const;
544 [[nodiscard]] const_iterator cbegin() const;
545 [[nodiscard]] const_iterator cend() const;
546 [[nodiscard]] const_reverse_iterator rbegin() const;
547 [[nodiscard]] const_reverse_iterator rend() const;
548 [[nodiscard]] const_reverse_iterator crbegin() const;
549 [[nodiscard]] const_reverse_iterator crend() const;
550
551 [[nodiscard]] SizeType size() const;
552 [[nodiscard]] bool empty() const;
553
554 void reserve(SizeType n);
555
556 void clear();
557 iterator insert(const_iterator pos, T const& value);
558 iterator insert(const_iterator pos, T&& value);
559 template<class... TArgs>
560 iterator emplace(const_iterator pos, TArgs&&... value);
561 template<class TArg>
562 void push_back(TArg&& arg);
563 template<class... TArgs>
564 reference emplace_back(TArgs&&... arg);
565 const_iterator erase(const_iterator pos);
566 void pop_back();
567
568 [[nodiscard]] reference modify(SizeType index);
569 [[nodiscard]] reference modify(const_iterator pos);
570
571 void clearEvents();
572 [[nodiscard]] SizeType eventsSize() const;
573 [[nodiscard]] EventQueue const& getEventQueue() const;
574 [[nodiscard]] bool isRegisteringEvents() const;
575 void registerEvents(bool enable);
576
577private:
578 void pushEvent(RecordedEvent event);
579
580 std::vector<T> g_container;
581 EventQueue g_events;
582#ifdef FGE_DEF_SERVER
583 bool g_registerEvents{true};
584#else
585 bool g_registerEvents{false};
586#endif
587
588 friend Packet& operator<< <T>(Packet& pck, RecordedVector const& vec);
589 friend Packet const& operator>> <T>(Packet const& pck, RecordedVector& vec);
590};
591
597template<class T>
598class NetworkTypeVector : public NetworkTypeBase
599{
600public:
601 NetworkTypeVector(RecordedVector<T>* source);
602 ~NetworkTypeVector() override = default;
603
604 void const* getSource() const override;
605
606 bool applyData(Packet const& pck) override;
607 void packData(Packet& pck, Identity const& id) override;
608 void packData(Packet& pck) override;
609
610 void forceCheckClient(Identity const& id) override;
611 void forceUncheckClient(Identity const& id) override;
612
613 bool check() const override;
614 void forceCheck() override;
615 void forceUncheck() override;
616
617private:
618 void createClientData(std::shared_ptr<void>& ptr) const override;
619 void applyClientData(std::shared_ptr<void>& ptr) const override;
620
621 struct DataDeleter
622 {
623 inline void operator()(void* ptr) const { delete static_cast<typename RecordedVector<T>::EventQueue*>(ptr); }
624 };
625
626 enum class PackTypes : uint8_t
627 {
628 FULL,
629 PARTIAL
630 };
631
632 RecordedVector<T>* g_typeSource;
633};
634
640template<class TEnum, class TData = void>
641class NetworkTypeEvents : public NetworkTypeBase
642{
643public:
644 using Event = std::conditional_t<std::is_void_v<TData>, TEnum, std::pair<TEnum, TData>>;
645
646 NetworkTypeEvents() = default;
647 ~NetworkTypeEvents() override = default;
648
649 void const* getSource() const override;
650
651 bool applyData(Packet const& pck) override;
652 void packData(Packet& pck, Identity const& id) override;
653 void packData(Packet& pck) override;
654
655 void forceCheckClient(Identity const& id) override;
656 void forceUncheckClient(Identity const& id) override;
657
658 bool check() const override;
659 void forceCheck() override;
660 void forceUncheck() override;
661
662 void pushEvent(Event const& event);
663 void pushEventIgnore(Event const& event, Identity const& ignoreId);
664
666
667private:
668 void createClientData(std::shared_ptr<void>& ptr) const override;
669 void applyClientData(std::shared_ptr<void>& ptr) const override;
670
671 using EventQueue = std::deque<Event>;
672
673 struct DataDeleter
674 {
675 inline void operator()(void* ptr) const { delete static_cast<EventQueue*>(ptr); }
676 };
677
678 bool g_modified{false};
679};
680
689class FGE_API NetworkTypeHandler
690{
691public:
692 NetworkTypeHandler() = default;
693 ~NetworkTypeHandler() = default;
694
695 //Copy function that does nothing
696 NetworkTypeHandler([[maybe_unused]] NetworkTypeHandler const& n) {}
697 NetworkTypeHandler& operator=([[maybe_unused]] NetworkTypeHandler const& n) { return *this; }
698
699 void clear();
700
701 void clientsCheckup(ClientList const& clients, bool force = false) const;
702 void forceCheckClient(Identity const& id) const;
703 void forceUncheckClient(Identity const& id) const;
704
705 NetworkTypeBase* push(std::unique_ptr<NetworkTypeBase>&& newNet);
706 template<class T, class... TArgs>
707 T* push(TArgs&&... args)
708 {
709 static_assert(std::is_base_of_v<NetworkTypeBase, T>, "T must inherit from NetworkTypeBase");
710 return static_cast<T*>(this->push(std::make_unique<T>(std::forward<TArgs>(args)...)));
711 }
712 template<class T, class... TArgs>
713 NetworkType<T>* pushTrivial(TArgs&&... args)
714 {
715 return static_cast<NetworkType<T>*>(
716 this->push(std::make_unique<NetworkType<T>>(fge::DataAccessor<T>{std::forward<TArgs>(args)...})));
717 }
718
719 std::size_t packNeededUpdate(Packet& pck) const;
720 void unpackNeededUpdate(Packet const& pck, Identity const& id) const;
721
722 [[nodiscard]] inline std::size_t size() const { return this->g_data.size(); }
723 [[nodiscard]] inline NetworkTypeBase* get(std::size_t index) const { return this->g_data[index].get(); }
724 template<class T>
725 [[nodiscard]] inline T* get(std::size_t index) const
726 {
727 static_assert(std::is_base_of_v<NetworkTypeBase, T>, "T must inherit from NetworkTypeBase");
728 return static_cast<T*>(this->g_data[index].get());
729 }
730 [[nodiscard]] inline NetworkTypeBase* operator[](std::size_t index) const { return this->g_data[index].get(); }
731
732 void ignoreClient(Identity const& id);
733 void unignoreClient(Identity const& id);
734 [[nodiscard]] bool isIgnored(Identity const& id) const;
735 void clearIgnoredClients();
736
737private:
738 std::vector<std::unique_ptr<NetworkTypeBase>> g_data;
739 std::unordered_set<Identity, IdentityHash> g_ignoredClients;
740};
741
742} // namespace net
743} // namespace fge
744
745#include "C_networkType.inl"
746
747#endif // _FGE_C_NETWORKTYPE_HPP_INCLUDED
This class is used to handle callbacks in a safe way.
Definition C_callback.hpp:189
A class to handle "flags" for an enum type.
Definition C_flag.hpp:104
A class that map a string to a Property.
Definition C_propertyList.hpp:35
A class that can store any type of data.
Definition C_property.hpp:54
A scene contain a collection of object and handle them.
Definition C_scene.hpp:465
Definition C_tagList.hpp:28
A list of clients used by a server.
Definition C_clientList.hpp:60
Base class for a network type.
Definition C_networkType.hpp:125
virtual bool checkClient(Identity const &id) const
Check if the modification flag is set for the specified client identity.
void waitingUpdate()
Tell that this network type is waiting for an update.
virtual bool clientsCheckup(ClientList const &clients, bool force)
Do a clients checkup with the specified client list.
virtual bool check() const =0
Check if the value have been modified.
virtual void packData(Packet &pck, Identity const &id)=0
Pack the data into a packet and reset the modification flag of the identity.
virtual void forceUncheck()=0
Remove the forced modification of the value.
virtual void forceUncheckClient(Identity const &id)
Reset the modification flag for the specified client identity.
virtual bool applyData(Packet const &pck)=0
Apply the data packed by the same network type from a server.
virtual void requireExplicitUpdateClient(Identity const &id)
Ask for an explicit update of the value for the specified client identity.
bool isForced() const
Check if the value is forced to be modified.
virtual void const * getSource() const =0
Get the source pointer that have been used to create this network type.
void needExplicitUpdate()
Tell that this network type need an explicit update from the server.
fge::CallbackHandler _onApplied
Callback called when the value have been applied.
Definition C_networkType.hpp:250
virtual void forceCheck()=0
Force the value to be modified (even if it is not)
virtual void packData(Packet &pck)=0
Pack the data without any client identity.
virtual void forceCheckClient(Identity const &id)
Force the modification flag to be set for the specified client identity.
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
Definition C_networkType.inl:713
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
Definition C_networkType.inl:681
void forceCheck() override
Force the value to be modified (even if it is not)
Definition C_networkType.inl:775
bool check() const override
Check if the value have been modified.
Definition C_networkType.inl:770
void const * getSource() const override
Get the source pointer that have been used to create this network type.
Definition C_networkType.inl:675
void forceUncheckClient(Identity const &id) override
Reset the modification flag for the specified client identity.
Definition C_networkType.inl:758
void forceCheckClient(Identity const &id) override
Force the modification flag to be set for the specified client identity.
Definition C_networkType.inl:749
fge::CallbackHandler< Event > _onEvent
Callback called when an event is received.
Definition C_networkType.hpp:665
void forceUncheck() override
Remove the forced modification of the value.
Definition C_networkType.inl:780
void const * getSource() const override
Get the source pointer that have been used to create this network type.
Definition C_networkType.inl:206
void forceCheck() override
Force the value to be modified (even if it is not)
Definition C_networkType.inl:243
void forceUncheck() override
Remove the forced modification of the value.
Definition C_networkType.inl:248
NetworkTypeManual(T *source)
NetworkTypeManual.
Definition C_networkType.inl:200
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
Definition C_networkType.inl:212
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
Definition C_networkType.inl:224
bool check() const override
Check if the value have been modified.
Definition C_networkType.inl:238
void const * getSource() const override
Get the source pointer that have been used to create this network type.
Definition C_networkType.inl:142
bool check() const override
Check if the value have been modified.
Definition C_networkType.inl:177
void forceUncheck() override
Remove the forced modification of the value.
Definition C_networkType.inl:187
NetworkTypePropertyList(fge::PropertyList *source, std::string const &vname)
NetworkTypePropertyList.
Definition C_networkType.inl:133
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
Definition C_networkType.inl:148
void forceCheck() override
Force the value to be modified (even if it is not)
Definition C_networkType.inl:182
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
Definition C_networkType.inl:160
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
Definition C_networkType.inl:102
void forceUncheck() override
Remove the forced modification of the value.
Definition C_networkType.inl:126
void forceCheck() override
Force the value to be modified (even if it is not)
Definition C_networkType.inl:121
void const * getSource() const override
Get the source pointer that have been used to create this network type.
Definition C_networkType.inl:86
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
Definition C_networkType.inl:92
bool check() const override
Check if the value have been modified.
Definition C_networkType.inl:116
NetworkTypeProperty(fge::Property *source)
NetworkTypeProperty.
Definition C_networkType.inl:79
void forceUncheckClient(Identity const &id) override
Reset the modification flag for the specified client identity.
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
void forceCheckClient(Identity const &id) override
Force the modification flag to be set for the specified client identity.
void const * getSource() const override
Get the source pointer that have been used to create this network type.
bool clientsCheckup(ClientList const &clients, bool force) override
Do a clients checkup with the specified client list.
void packData(Packet &pck) override
Pack the data without any client identity.
bool check() const override
Check if the value have been modified.
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
bool checkClient(Identity const &id) const override
Check if the modification flag is set for the specified client identity.
void forceCheck() override
Force the value to be modified (even if it is not)
void forceUncheck() override
Remove the forced modification of the value.
void forceUncheck() override
Remove the forced modification of the value.
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
bool check() const override
Check if the value have been modified.
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
void forceCheck() override
Force the value to be modified (even if it is not)
void packData(Packet &pck) override
Pack the data without any client identity.
void const * getSource() const override
Get the source pointer that have been used to create this network type.
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
bool check() const override
Check if the value have been modified.
void const * getSource() const override
Get the source pointer that have been used to create this network type.
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
void packData(Packet &pck) override
Pack the data without any client identity.
void forceCheck() override
Force the value to be modified (even if it is not)
void forceUncheck() override
Remove the forced modification of the value.
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
void const * getSource() const override
Get the source pointer that have been used to create this network type.
void forceUncheck() override
Remove the forced modification of the value.
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
void forceCheck() override
Force the value to be modified (even if it is not)
bool check() const override
Check if the value have been modified.
void packData(Packet &pck) override
Pack the data without any client identity.
void forceCheck() override
Force the value to be modified (even if it is not)
Definition C_networkType.inl:638
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
Definition C_networkType.inl:552
void forceUncheck() override
Remove the forced modification of the value.
Definition C_networkType.inl:643
void const * getSource() const override
Get the source pointer that have been used to create this network type.
Definition C_networkType.inl:480
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
Definition C_networkType.inl:486
void forceCheckClient(Identity const &id) override
Force the modification flag to be set for the specified client identity.
Definition C_networkType.inl:606
bool check() const override
Check if the value have been modified.
Definition C_networkType.inl:629
void forceUncheckClient(Identity const &id) override
Reset the modification flag for the specified client identity.
Definition C_networkType.inl:617
The default network type for most trivial types.
Definition C_networkType.hpp:268
NetworkType(fge::DataAccessor< T > source)
NetworkType.
Definition C_networkType.inl:23
void packData(Packet &pck, Identity const &id) override
Pack the data into a packet and reset the modification flag of the identity.
Definition C_networkType.inl:47
void forceCheck() override
Force the value to be modified (even if it is not)
Definition C_networkType.inl:65
void forceUncheck() override
Remove the forced modification of the value.
Definition C_networkType.inl:70
bool applyData(Packet const &pck) override
Apply the data packed by the same network type from a server.
Definition C_networkType.inl:34
void const * getSource() const override
Get the source pointer that have been used to create this network type.
Definition C_networkType.inl:29
bool check() const override
Check if the value have been modified.
Definition C_networkType.inl:60
Definition C_packet.hpp:52
Definition C_networkType.hpp:523
Definition C_dataAccessor.hpp:27
A class to represent a client or server identity with an IP address and a port.
Definition C_identity.hpp:31
Definition C_networkType.hpp:55
Definition C_networkType.hpp:513