From 81c8b404e7ab6d56079eb8cc51065bf07f1c2c8a Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 19 Jun 2013 21:09:18 +0000 Subject: [PATCH] Play placing sound only if place prediction was successful --- src/game.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index f00e4c94..83311795 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -834,7 +834,7 @@ public: } }; -void nodePlacementPrediction(Client &client, +bool nodePlacementPrediction(Client &client, const ItemDefinition &playeritem_def, v3s16 nodepos, v3s16 neighbourpos) { @@ -854,7 +854,7 @@ void nodePlacementPrediction(Client &client, if(nodedef->get(n_under).buildable_to) p = nodepos; else if (!nodedef->get(map.getNode(p)).buildable_to) - return; + return false; }catch(InvalidPositionException &e){} // Find id of predicted node content_t id; @@ -864,7 +864,7 @@ void nodePlacementPrediction(Client &client, <get(map.getNode(pp)).walkable) - return; + return false; } // Add node to client map MapNode n(id, 0, param2); try{ // This triggers the required mesh update too client.addNode(p, n); + return true; }catch(InvalidPositionException &e){ errorstream<<"Node placement prediction failed for " <