mirror of
https://github.com/bdnugget/freeminer.git
synced 2026-11-07 06:57:27 +00:00
net wip
This commit is contained in:
1 parent
1e665e6b97
commit
053542fd71
7 files changed
+13
-27
No files matched your search
@@ -498,10 +498,6 @@ bool ClientLauncher::launch_game(std::string &error_message,
|
||||
start_data.world_spec = worldspecs[world_index];
|
||||
}
|
||||
|
||||
//fm:
|
||||
if (menudata.name.empty()) {
|
||||
menudata.name = std::string("Guest") + itos(myrand_range(100000, 999999));
|
||||
}
|
||||
|
||||
start_data.name = menudata.name;
|
||||
start_data.password = menudata.password;
|
||||
@@ -523,14 +519,15 @@ bool ClientLauncher::launch_game(std::string &error_message,
|
||||
if (!start_data.isSinglePlayer() && start_data.name.empty()) {
|
||||
error_message = gettext("Please choose a name!");
|
||||
errorstream << error_message << std::endl;
|
||||
error_message.clear();
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
start_data.name = std::string("Guest") + itos(myrand_range(100000, 999999));
|
||||
//resolve(false);
|
||||
//return;
|
||||
#else
|
||||
return false;
|
||||
// fm:
|
||||
auto num_add = 0;
|
||||
#if __EMSCRIPTEN__
|
||||
num_add = 1000000;
|
||||
#endif
|
||||
start_data.name = std::string("Guest") + itos(myrand_range(num_add + 100000, num_add + 999999));
|
||||
// ===
|
||||
}
|
||||
|
||||
// If using simple singleplayer mode, override
|
||||
|
||||
@@ -92,10 +92,9 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
|
||||
|
||||
ConnectionEnet::ConnectionEnet(
|
||||
u32 max_packet_size, float timeout, bool ipv6, con::PeerHandler *peerhandler) :
|
||||
thread_vector("Connection", 90), m_max_packet_size(max_packet_size),
|
||||
m_timeout(timeout), m_enet_host(nullptr), m_peer_id(0),
|
||||
m_bc_peerhandler(peerhandler), m_last_recieved(0), m_last_recieved_warn(0),
|
||||
timeout_mul(0)
|
||||
thread_vector("Connection", 90), m_timeout(timeout), m_enet_host(nullptr),
|
||||
m_peer_id(0), m_bc_peerhandler(peerhandler), m_last_recieved(0),
|
||||
m_last_recieved_warn(0), timeout_mul(0)
|
||||
{
|
||||
timeout_mul = g_settings->getU16("timeout_mul");
|
||||
if (!timeout_mul)
|
||||
@@ -461,7 +460,7 @@ ConnectionEventPtr ConnectionEnet::waitEvent(u32 timeout_ms)
|
||||
if (!timeout_ms && m_event_queue.empty()) {
|
||||
return ConnectionEvent::create(CONNEVENT_NONE);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
return m_event_queue.pop_front(timeout_ms);
|
||||
} catch (const ItemNotFoundException &ex) {
|
||||
|
||||
@@ -95,8 +95,6 @@ private:
|
||||
MutexedQueue<ConnectionEventPtr> m_event_queue;
|
||||
MutexedQueue<ConnectionCommandPtr> m_command_queue;
|
||||
|
||||
//u32 m_protocol_id {PROTOCOL_ID};
|
||||
u32 m_max_packet_size;
|
||||
float m_timeout;
|
||||
ENetHost *m_enet_host;
|
||||
// ENetPeer *m_peer;
|
||||
|
||||
@@ -52,7 +52,7 @@ ConnectionMulti::ConnectionMulti(
|
||||
#endif
|
||||
#if USE_WEBSOCKET
|
||||
m_con_ws(std::make_shared<con_ws::Connection>(
|
||||
max_packet_size, timeout, ipv6, peerhandler)),
|
||||
1000000, timeout, ipv6, peerhandler)),
|
||||
#endif
|
||||
#if USE_WEBSOCKET_SCTP
|
||||
m_con_ws_sctp(std::make_shared<con_ws_sctp::Connection>(
|
||||
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
#if MINETEST_TRANSPORT
|
||||
std::shared_ptr<IConnection> m_con;
|
||||
#endif
|
||||
bool dummy;
|
||||
[[maybe_unused]] bool dummy;
|
||||
enum class proto_name
|
||||
{
|
||||
none = 0,
|
||||
|
||||
@@ -52,13 +52,6 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t p
|
||||
m_armor_groups["immortal"] = 1;
|
||||
}
|
||||
|
||||
PlayerSAO::~PlayerSAO()
|
||||
{
|
||||
/*if (!m_player)
|
||||
return;
|
||||
--m_player->refs;*/
|
||||
}
|
||||
|
||||
void PlayerSAO::finalize(RemotePlayer *player, const std::set<std::string> &privs)
|
||||
{
|
||||
assert(player);
|
||||
|
||||
@@ -61,7 +61,6 @@ public:
|
||||
PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
|
||||
bool is_singleplayer);
|
||||
|
||||
~PlayerSAO();
|
||||
ActiveObjectType getType() const override { return ACTIVEOBJECT_TYPE_PLAYER; }
|
||||
ActiveObjectType getSendType() const override { return ACTIVEOBJECT_TYPE_GENERIC; }
|
||||
std::string getDescription() override;
|
||||
|
||||
Reference in new issue
Block a user