From 9e198fc22c34a4c9635013d19dc34a0a0d8657b2 Mon Sep 17 00:00:00 2001 From: grorp Date: Sat, 31 Aug 2024 20:45:32 +0200 Subject: [PATCH] TouchControls: Fix outdated player controls in TOSERVER_INTERACT --- src/client/game.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/game.cpp b/src/client/game.cpp index 3dd829d53..701504a31 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1446,7 +1446,7 @@ void Game::copyServerClientCache() { // It would be possible to let the client directly read the media files // from where the server knows they are. But aside from being more complicated - // it would also *not* fill the media cache and cause slower joining of + // it would also *not* fill the media cache and cause slower joining of // remote servers. // (Imagine that you launch a game once locally and then connect to a server.) @@ -3351,6 +3351,10 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud) if (g_touchscreengui) { auto mode = selected_def.touch_interaction.getMode(pointed.type); g_touchscreengui->applyContextControls(mode); + // applyContextControls may change dig/place input. + // Update again so that TOSERVER_INTERACT packets have the correct controls set. + player->control.dig = isKeyDown(KeyType::DIG); + player->control.place = isKeyDown(KeyType::PLACE); } // Note that updating the selection mesh every frame is not particularly efficient,