From: PilzAdam Date: Wed, 19 Jun 2013 21:09:18 +0000 (+0000) Subject: Play placing sound only if place prediction was successful X-Git-Tag: 0.4.8~394^2~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=81c8b404e7ab6d56079eb8cc51065bf07f1c2c8a;p=oweals%2Fminetest.git Play placing sound only if place prediction was successful --- diff --git a/src/game.cpp b/src/game.cpp index f00e4c949..833117959 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 " <