summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2017-08-26 07:11:59 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-08-26 08:11:59 +0200
commitad9677a14fb8ad1b4048e83a779e5ad36a99f2d0 (patch)
tree154f892044018b81a3c8fa614fafe9f8b53783dc /src
parent3cea7a349ac55df93b3eac1bf40365e00e472480 (diff)
downloadminetest-ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0.tar.gz
minetest-ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0.tar.bz2
minetest-ad9677a14fb8ad1b4048e83a779e5ad36a99f2d0.zip
Check item_drop amount clientside (#6242)
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 4a26bc844..43495e8a6 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1251,7 +1251,7 @@ protected:
void processKeyInput();
void processItemSelection(u16 *new_playeritem);
- void dropSelectedItem();
+ void dropSelectedItem(bool single_item = false);
void openInventory();
void openConsole(float scale, const wchar_t *line=NULL);
void toggleFreeMove();
@@ -2499,7 +2499,7 @@ void Game::processUserInput(f32 dtime)
void Game::processKeyInput()
{
if (wasKeyDown(KeyType::DROP)) {
- dropSelectedItem();
+ dropSelectedItem(isKeyDown(KeyType::SNEAK));
} else if (wasKeyDown(KeyType::AUTOFORWARD)) {
toggleAutoforward();
} else if (wasKeyDown(KeyType::INVENTORY)) {
@@ -2645,10 +2645,10 @@ void Game::processItemSelection(u16 *new_playeritem)
}
-void Game::dropSelectedItem()
+void Game::dropSelectedItem(bool single_item)
{
IDropAction *a = new IDropAction();
- a->count = 0;
+ a->count = single_item ? 1 : 0;
a->from_inv.setCurrentPlayer();
a->from_list = "main";
a->from_i = client->getPlayerItem();