Skip to content

Instantly share code, notes, and snippets.

View sapier's full-sized avatar

sapier

View GitHub Profile
function hash_to_pos(testpos)
local hash = minetest.hash_node_position(testpos)
local raw_x = (hash % 65536)
local raw_y = ((hash - raw_x) % (65536*65536)) / 65536
local raw_z = ((hash - raw_x - raw_y) / 65546) / 65536
local mobpos = {}
mobpos.x = raw_x - 32768
diff --git a/src/nodemetadata.h b/src/nodemetadata.h
index ce2c9e6..c9f3933 100644
--- a/src/nodemetadata.h
+++ b/src/nodemetadata.h
@@ -55,7 +55,7 @@ class NodeMetadata
i = m_stringvars.find(name);
if(i == m_stringvars.end())
return "";
- return resolveString(i->second);
+ return i->second;
diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp
index 12e203e..a0dae80 100644
--- a/src/httpfetch.cpp
+++ b/src/httpfetch.cpp
@@ -539,6 +539,7 @@ class CurlFetchThread : public JThread
void * Thread()
{
+ ThreadStarted();
log_register_thread("CurlFetchThread");
diff --git a/src/client.cpp b/src/client.cpp
index 1d3c623..852b8e2 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -286,6 +286,20 @@ void * MeshUpdateThread::Thread()
}
}
+void Client::Stop()
+{
diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp
index 176a3b2..3d94473 100644
--- a/src/httpfetch.cpp
+++ b/src/httpfetch.cpp
@@ -548,7 +548,7 @@ class CurlFetchThread : public JThread
if (select_timeout > 0) {
// in Winsock it is forbidden to pass three empty
// fd_sets to select(), so in that case use sleep_ms
- if (max_fd == -1) {
+ if (max_fd != -1) {
diff --git a/src/server.cpp b/src/server.cpp
index b257448..9d17016 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3772,7 +3772,7 @@ void Server::SendHUDChange(u16 peer_id, u32 id, HudElementStat stat, void *value
std::string s = os.str();
SharedBuffer<u8> data((u8 *)s.c_str(), s.size());
// Send as reliable
- m_con.Send(peer_id, 0, data, true);
+ m_con.Send(peer_id, 1, data, true);
diff --git a/src/connection.cpp b/src/connection.cpp
index ee03b21..b32a965 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -1985,11 +1985,10 @@ void * ConnectionReceiveThread::Thread()
// Receive packets from the network and buffers and create ConnectionEvents
void ConnectionReceiveThread::receive()
{
- /* now reorder reliables */
- u32 datasize = m_max_packet_size * 2; // Double it just to be safe
-- minetest.lua
-- Packet dissector for the UDP-based Minetest protocol
-- Copy this to $HOME/.wireshark/plugins/
--
-- Minetest
-- Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
--
-- This program is free software; you can redistribute it and/or modify
diff --git a/src/client.cpp b/src/client.cpp
index 1c7ecf3..e50804f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1016,6 +1016,14 @@ void Client::Receive()
}
//TimeTaker t1("ProcessData", m_device);
ProcessData(*data, datasize, sender_peer_id);
+
+ if(m_server_ser_ver != SER_FMT_VER_INVALID) {
diff --git a/src/log.cpp b/src/log.cpp
index 97f25cc..630c142 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -57,13 +57,15 @@ void log_remove_output(ILogOutput *out)
log_outputs[i].erase(it);
}
}
-
+#include <sys/prctl.h>