diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp index 658b10393..6fd007181 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "network/connection.h" #include "network/networkpacket.h" #include "threading/mutex_auto_lock.h" +#include "client/clientevent.h" #include "client/renderingengine.h" #include "util/auth.h" #include "util/directiontables.h" @@ -425,9 +426,9 @@ void Client::step(float dtime) sendDamage(damage); // Add to ClientEvent queue - ClientEvent event; - event.type = CE_PLAYER_DAMAGE; - event.player_damage.amount = damage; + ClientEvent *event = new ClientEvent(); + event->type = CE_PLAYER_DAMAGE; + event->player_damage.amount = damage; m_client_event_queue.push(event); } } @@ -1661,12 +1662,12 @@ void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool ur } } -ClientEvent Client::getClientEvent() +ClientEvent *Client::getClientEvent() { FATAL_ERROR_IF(m_client_event_queue.empty(), "Cannot getClientEvent, queue is empty."); - ClientEvent event = m_client_event_queue.front(); + ClientEvent *event = m_client_event_queue.front(); m_client_event_queue.pop(); return event; } @@ -1865,6 +1866,11 @@ bool Client::shouldShowMinimap() const return !m_minimap_disabled_by_server; } +void Client::pushToEventQueue(ClientEvent *event) +{ + m_client_event_queue.push(event); +} + void Client::showGameChat(const bool show) { m_game_ui_flags->show_chat = show; |