summaryrefslogtreecommitdiff
path: root/src/inventorymanager.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-09-02 22:51:38 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-09-02 22:51:38 +0300
commite1a495ee306290b3bec2de9aa298aac1528e9243 (patch)
tree352db0aedb58fa4a26790227c388d0773f05279f /src/inventorymanager.h
parent6495007924d8907ddfff14be09d38a4b1745b95a (diff)
downloadminetest-e1a495ee306290b3bec2de9aa298aac1528e9243.tar.gz
minetest-e1a495ee306290b3bec2de9aa298aac1528e9243.tar.bz2
minetest-e1a495ee306290b3bec2de9aa298aac1528e9243.zip
Make inventory GUI do sane things when server-side inventory acts unusually
Diffstat (limited to 'src/inventorymanager.h')
-rw-r--r--src/inventorymanager.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/inventorymanager.h b/src/inventorymanager.h
index dae14f1a6..f81f5b972 100644
--- a/src/inventorymanager.h
+++ b/src/inventorymanager.h
@@ -66,6 +66,29 @@ struct InventoryLocation
name = name_;
}
+ bool operator==(const InventoryLocation &other) const
+ {
+ if(type != other.type)
+ return false;
+ switch(type){
+ case UNDEFINED:
+ return false;
+ case CURRENT_PLAYER:
+ return true;
+ case PLAYER:
+ return (name == other.name);
+ case NODEMETA:
+ return (p == other.p);
+ case DETACHED:
+ return (name == other.name);
+ }
+ return false;
+ }
+ bool operator!=(const InventoryLocation &other) const
+ {
+ return !(*this == other);
+ }
+
void applyCurrentPlayer(const std::string &name_)
{
if(type == CURRENT_PLAYER)