1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[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

@@ -35,6 +35,8 @@
#include "scene/main/multiplayer_api.h"
class SceneMultiplayer;
class SceneCacheInterface;
class SceneReplicationInterface;
class Node;
class SceneRPCInterface : public RefCounted {
@@ -77,6 +79,9 @@ private:
};
SceneMultiplayer *multiplayer = nullptr;
SceneCacheInterface *multiplayer_cache = nullptr;
SceneReplicationInterface *multiplayer_replicator = nullptr;
Vector<uint8_t> packet_cache;
HashMap<ObjectID, RPCConfigCache> rpc_cache;
@@ -99,7 +104,11 @@ public:
void process_rpc(int p_from, const uint8_t *p_packet, int p_packet_len);
String get_rpc_md5(const Object *p_obj);
SceneRPCInterface(SceneMultiplayer *p_multiplayer) { multiplayer = p_multiplayer; }
SceneRPCInterface(SceneMultiplayer *p_multiplayer, SceneCacheInterface *p_cache, SceneReplicationInterface *p_replicator) {
multiplayer = p_multiplayer;
multiplayer_cache = p_cache;
multiplayer_replicator = p_replicator;
}
};
#endif // SCENE_RPC_INTERFACE_H