summaryrefslogtreecommitdiff
path: root/modules/enet
diff options
context:
space:
mode:
Diffstat (limited to 'modules/enet')
-rw-r--r--modules/enet/enet_multiplayer_peer.h4
-rw-r--r--modules/enet/register_types.cpp14
-rw-r--r--modules/enet/register_types.h6
3 files changed, 17 insertions, 7 deletions
diff --git a/modules/enet/enet_multiplayer_peer.h b/modules/enet/enet_multiplayer_peer.h
index e7b61169fb..18eca18e51 100644
--- a/modules/enet/enet_multiplayer_peer.h
+++ b/modules/enet/enet_multiplayer_peer.h
@@ -70,8 +70,8 @@ private:
ConnectionStatus connection_status = CONNECTION_DISCONNECTED;
- Map<int, Ref<ENetConnection>> hosts;
- Map<int, Ref<ENetPacketPeer>> peers;
+ HashMap<int, Ref<ENetConnection>> hosts;
+ HashMap<int, Ref<ENetPacketPeer>> peers;
struct Packet {
ENetPacket *packet = nullptr;
diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp
index 36a4e6e6e7..14f3374e24 100644
--- a/modules/enet/register_types.cpp
+++ b/modules/enet/register_types.cpp
@@ -36,7 +36,11 @@
static bool enet_ok = false;
-void register_enet_types() {
+void initialize_enet_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
+
if (enet_initialize() != 0) {
ERR_PRINT("ENet initialization failure");
} else {
@@ -44,11 +48,15 @@ void register_enet_types() {
}
GDREGISTER_CLASS(ENetMultiplayerPeer);
- GDREGISTER_VIRTUAL_CLASS(ENetPacketPeer);
+ GDREGISTER_ABSTRACT_CLASS(ENetPacketPeer);
GDREGISTER_CLASS(ENetConnection);
}
-void unregister_enet_types() {
+void uninitialize_enet_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
+
if (enet_ok) {
enet_deinitialize();
}
diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h
index a94ecccc61..b4f491287d 100644
--- a/modules/enet/register_types.h
+++ b/modules/enet/register_types.h
@@ -31,7 +31,9 @@
#ifndef ENET_REGISTER_TYPES_H
#define ENET_REGISTER_TYPES_H
-void register_enet_types();
-void unregister_enet_types();
+#include "modules/register_module_types.h"
+
+void initialize_enet_module(ModuleInitializationLevel p_level);
+void uninitialize_enet_module(ModuleInitializationLevel p_level);
#endif // ENET_REGISTER_TYPES_H