summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-03-04 17:48:07 +0100
committerCraig Robbins <kde.psych@gmail.com>2015-03-05 16:49:51 +1000
commitb214cde5b4a833e1826ec6850b95bf1938c8b0a0 (patch)
tree1692546699da08769e7d5e6c10435fb037924aa3 /src/client.cpp
parent9e675793155d7cd56bbd2222df7b45245008c647 (diff)
downloadminetest-b214cde5b4a833e1826ec6850b95bf1938c8b0a0.tar.gz
minetest-b214cde5b4a833e1826ec6850b95bf1938c8b0a0.tar.bz2
minetest-b214cde5b4a833e1826ec6850b95bf1938c8b0a0.zip
Remove Queue class which uses std::list and use native std::queue
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 68815e8e6..d476f920d 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -512,7 +512,7 @@ void Client::step(float dtime)
ClientEvent event;
event.type = CE_PLAYER_DAMAGE;
event.player_damage.amount = damage;
- m_client_event_queue.push_back(event);
+ m_client_event_queue.push(event);
}
}
else if(event.type == CEE_PLAYER_BREATH) {
@@ -1429,7 +1429,8 @@ bool Client::getChatMessage(std::wstring &message)
{
if(m_chat_queue.size() == 0)
return false;
- message = m_chat_queue.pop_front();
+ message = m_chat_queue.front();
+ m_chat_queue.pop();
return true;
}
@@ -1445,14 +1446,14 @@ void Client::typeChatMessage(const std::wstring &message)
// Show locally
if (message[0] == L'/')
{
- m_chat_queue.push_back((std::wstring)L"issued command: " + message);
+ m_chat_queue.push((std::wstring)L"issued command: " + message);
}
else
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
std::wstring name = narrow_to_wide(player->getName());
- m_chat_queue.push_back((std::wstring)L"<" + name + L"> " + message);
+ m_chat_queue.push((std::wstring)L"<" + name + L"> " + message);
}
}
@@ -1545,13 +1546,15 @@ void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool ur
ClientEvent Client::getClientEvent()
{
- if(m_client_event_queue.size() == 0)
- {
- ClientEvent event;
+ ClientEvent event;
+ if(m_client_event_queue.size() == 0) {
event.type = CE_NONE;
- return event;
}
- return m_client_event_queue.pop_front();
+ else {
+ event = m_client_event_queue.front();
+ m_client_event_queue.pop();
+ }
+ return event;
}
float Client::mediaReceiveProgress()
@@ -1669,7 +1672,7 @@ void Client::makeScreenshot(IrrlichtDevice *device)
} else {
sstr << "Failed to save screenshot '" << filename << "'";
}
- m_chat_queue.push_back(narrow_to_wide(sstr.str()));
+ m_chat_queue.push(narrow_to_wide(sstr.str()));
infostream << sstr.str() << std::endl;
image->drop();
}