1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Remove Queue class which uses std::list and use native std::queue

This commit is contained in:
Loic Blot 2015-03-04 17:48:07 +01:00 committed by Craig Robbins
parent 9e67579315
commit b214cde5b4
11 changed files with 85 additions and 139 deletions

View file

@ -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();
}