1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Make inventory GUI do sane things when server-side inventory acts unusually

This commit is contained in:
Perttu Ahola 2012-09-02 22:51:38 +03:00
parent 6495007924
commit e1a495ee30
4 changed files with 105 additions and 4 deletions

View file

@ -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)