summaryrefslogtreecommitdiff
path: root/modules/enet
diff options
context:
space:
mode:
Diffstat (limited to 'modules/enet')
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp11
-rw-r--r--modules/enet/networked_multiplayer_enet.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index c05c86d9ae..738bd27ed3 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -575,6 +575,9 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
case COMPRESS_ZLIB: {
mode = Compression::MODE_DEFLATE;
} break;
+ case COMPRESS_ZSTD: {
+ mode = Compression::MODE_ZSTD;
+ } break;
default: { ERR_FAIL_V(0); }
}
@@ -608,6 +611,10 @@ size_t NetworkedMultiplayerENet::enet_decompress(void *context, const enet_uint8
ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_DEFLATE);
} break;
+ case COMPRESS_ZSTD: {
+
+ ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_ZSTD);
+ } break;
default: {}
}
if (ret < 0) {
@@ -629,7 +636,8 @@ void NetworkedMultiplayerENet::_setup_compressor() {
enet_host_compress_with_range_coder(host);
} break;
case COMPRESS_FASTLZ:
- case COMPRESS_ZLIB: {
+ case COMPRESS_ZLIB:
+ case COMPRESS_ZSTD: {
enet_host_compress(host, &enet_compressor);
} break;
@@ -654,6 +662,7 @@ void NetworkedMultiplayerENet::_bind_methods() {
BIND_CONSTANT(COMPRESS_RANGE_CODER);
BIND_CONSTANT(COMPRESS_FASTLZ);
BIND_CONSTANT(COMPRESS_ZLIB);
+ BIND_CONSTANT(COMPRESS_ZSTD);
}
NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index c20c1af68e..8b971adf55 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -43,7 +43,8 @@ public:
COMPRESS_NONE,
COMPRESS_RANGE_CODER,
COMPRESS_FASTLZ,
- COMPRESS_ZLIB
+ COMPRESS_ZLIB,
+ COMPRESS_ZSTD
};
private: