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:
parent
6495007924
commit
e1a495ee30
4 changed files with 105 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue