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

Client & ClientEnvirnment: don't create fake events (#5676)

Instead of create fake events on the stack on each loop call (Game::run), verify is queue is empty or not and handle event directly if there is.

This prevents fake ClientEvent creation & memory allocations

Same fix is also applied on ClientEnvironment, & rename getClientEvent to getClientEnvEvent to match ClientEnvEvent object
This commit is contained in:
Loïc Blot 2017-04-29 17:25:25 +02:00 committed by GitHub
parent f727f54192
commit 3db66b4531
5 changed files with 27 additions and 33 deletions

View file

@ -414,7 +414,8 @@ public:
void updateCameraOffset(v3s16 camera_offset)
{ m_mesh_update_thread.m_camera_offset = camera_offset; }
// Get event from queue. CE_NONE is returned if queue is empty.
bool hasClientEvents() const { return !m_client_event_queue.empty(); }
// Get event from queue. If queue is empty, it triggers an assertion failure.
ClientEvent getClientEvent();
bool accessDenied() const { return m_access_denied; }