summaryrefslogtreecommitdiff
path: root/src/clientiface.cpp
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2016-02-15 16:05:40 +0100
committerest31 <MTest31@outlook.com>2016-03-12 23:59:44 +0100
commit089f9bbe817debc5c30f1d845170909f638c9642 (patch)
treeb5f14a06e4659fd47e3d3c1f74d20ea859df9d5b /src/clientiface.cpp
parent2c72f6da7b7595d2e180937f05f902c510ef1c14 (diff)
downloadminetest-089f9bbe817debc5c30f1d845170909f638c9642.tar.gz
minetest-089f9bbe817debc5c30f1d845170909f638c9642.tar.bz2
minetest-089f9bbe817debc5c30f1d845170909f638c9642.zip
Resend blocks when modified while sending to client
Diffstat (limited to 'src/clientiface.cpp')
-rw-r--r--src/clientiface.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index 8a1a62694..a3a17d435 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -370,17 +370,21 @@ queue_full_break:
void RemoteClient::GotBlock(v3s16 p)
{
- if(m_blocks_sending.find(p) != m_blocks_sending.end())
- m_blocks_sending.erase(p);
- else
- {
- m_excess_gotblocks++;
+ if (m_blocks_modified.find(p) == m_blocks_modified.end()) {
+ if (m_blocks_sending.find(p) != m_blocks_sending.end())
+ m_blocks_sending.erase(p);
+ else
+ m_excess_gotblocks++;
+
+ m_blocks_sent.insert(p);
}
- m_blocks_sent.insert(p);
}
void RemoteClient::SentBlock(v3s16 p)
{
+ if (m_blocks_modified.find(p) != m_blocks_modified.end())
+ m_blocks_modified.erase(p);
+
if(m_blocks_sending.find(p) == m_blocks_sending.end())
m_blocks_sending[p] = 0.0;
else
@@ -397,6 +401,7 @@ void RemoteClient::SetBlockNotSent(v3s16 p)
m_blocks_sending.erase(p);
if(m_blocks_sent.find(p) != m_blocks_sent.end())
m_blocks_sent.erase(p);
+ m_blocks_modified.insert(p);
}
void RemoteClient::SetBlocksNotSent(std::map<v3s16, MapBlock*> &blocks)
@@ -409,6 +414,7 @@ void RemoteClient::SetBlocksNotSent(std::map<v3s16, MapBlock*> &blocks)
i != blocks.end(); ++i)
{
v3s16 p = i->first;
+ m_blocks_modified.insert(p);
if(m_blocks_sending.find(p) != m_blocks_sending.end())
m_blocks_sending.erase(p);