Files
devilutionX/Source/dvlnet/abstract_net.cpp
T
Gleb Mazovetskiy 3d308983a8 Migrate to libmpq
libmpq is a much simpler alternative to StormLib for reading MPQ archives.

We use our own fork of libmpq: https://github.com/diasurgical/libmpq

Impact:

* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
  needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.
2021-11-06 23:51:42 +00:00

43 lines
882 B
C++

#include "dvlnet/abstract_net.h"
#include "utils/stubs.h"
#ifndef NONET
#include "dvlnet/base_protocol.h"
#include "dvlnet/cdwrap.h"
#ifndef DISABLE_ZERO_TIER
#include "dvlnet/protocol_zt.h"
#endif
#ifndef DISABLE_TCP
#include "dvlnet/tcp_client.h"
#endif
#endif
#include "dvlnet/loopback.h"
namespace devilution {
namespace net {
std::unique_ptr<abstract_net> abstract_net::MakeNet(provider_t provider)
{
#ifdef NONET
return std::make_unique<loopback>();
#else
switch (provider) {
#ifndef DISABLE_TCP
case SELCONN_TCP:
return std::make_unique<cdwrap<tcp_client>>();
#endif
#ifndef DISABLE_ZERO_TIER
case SELCONN_ZT:
return std::make_unique<cdwrap<base_protocol<protocol_zt>>>();
#endif
case SELCONN_LOOPBACK:
return std::make_unique<loopback>();
default:
ABORT();
}
#endif
}
} // namespace net
} // namespace devilution