[MP] Avoid unnecessary internal ref/unrefs

Access the various internal components (cache/replicator) via pointer,
to avoid unnecessary overhead.
This commit is contained in:
Fabio Alessandrelli
2023-09-27 01:47:23 +02:00
parent 9ce423914e
commit 311a27281f
6 changed files with 32 additions and 20 deletions

View File

@@ -37,6 +37,7 @@
#include "core/object/ref_counted.h"
class SceneMultiplayer;
class SceneCacheInterface;
class SceneReplicationInterface : public RefCounted {
GDCLASS(SceneReplicationInterface, RefCounted);
@@ -87,6 +88,7 @@ private:
// Replicator config.
SceneMultiplayer *multiplayer = nullptr;
SceneCacheInterface *multiplayer_cache = nullptr;
PackedByteArray packet_cache;
int sync_mtu = 1350; // Highly dependent on underlying protocol.
int delta_mtu = 65535;
@@ -144,8 +146,9 @@ public:
void set_max_delta_packet_size(int p_size);
int get_max_delta_packet_size() const;
SceneReplicationInterface(SceneMultiplayer *p_multiplayer) {
SceneReplicationInterface(SceneMultiplayer *p_multiplayer, SceneCacheInterface *p_cache) {
multiplayer = p_multiplayer;
multiplayer_cache = p_cache;
}
};