aboutsummaryrefslogtreecommitdiff
path: root/src/inventorymanager.h
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2020-09-04 20:49:07 +0200
committerGitHub <noreply@github.com>2020-09-04 20:49:07 +0200
commit050964bed6005f8d816ddf362b9fc8675581d190 (patch)
tree3229276c2c989597da4a052aa67373c8b887accb /src/inventorymanager.h
parent4ba5046308d6bdf7b38394770c6f82b6927393f2 (diff)
downloadminetest-050964bed6005f8d816ddf362b9fc8675581d190.tar.gz
minetest-050964bed6005f8d816ddf362b9fc8675581d190.tar.bz2
minetest-050964bed6005f8d816ddf362b9fc8675581d190.zip
Fix inventory swapping not calling all callbacks (#9923)
"Predicts" whether something will be swapped for allow callbacks, then calls callbacks a second time with swapped properties. Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Diffstat (limited to 'src/inventorymanager.h')
-rw-r--r--src/inventorymanager.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/inventorymanager.h b/src/inventorymanager.h
index 69bf30169..4ad5d3f49 100644
--- a/src/inventorymanager.h
+++ b/src/inventorymanager.h
@@ -183,6 +183,18 @@ struct IMoveAction : public InventoryAction, public MoveAction
void apply(InventoryManager *mgr, ServerActiveObject *player, IGameDef *gamedef);
void clientApply(InventoryManager *mgr, IGameDef *gamedef);
+
+ void swapDirections();
+
+ void onPutAndOnTake(const ItemStack &src_item, ServerActiveObject *player) const;
+
+ void onMove(int count, ServerActiveObject *player) const;
+
+ int allowPut(const ItemStack &dst_item, ServerActiveObject *player) const;
+
+ int allowTake(const ItemStack &src_item, ServerActiveObject *player) const;
+
+ int allowMove(int try_take_count, ServerActiveObject *player) const;
};
struct IDropAction : public InventoryAction, public MoveAction