mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make players check inventory modification properly
This commit is contained in:
parent
8b3135a643
commit
e9c9b66ae9
6 changed files with 39 additions and 9 deletions
|
@ -64,6 +64,7 @@ Player::Player(IGameDef *gamedef, const char *name):
|
|||
craft->setWidth(3);
|
||||
inventory.addList("craftpreview", 1);
|
||||
inventory.addList("craftresult", 1);
|
||||
inventory.setModified(false);
|
||||
|
||||
// Can be redefined via Lua
|
||||
inventory_formspec = "size[8,7.5]"
|
||||
|
@ -203,6 +204,7 @@ void Player::deSerialize(std::istream &is, std::string playername)
|
|||
playername + " not found!");
|
||||
}
|
||||
|
||||
m_dirty = true;
|
||||
//args.getS32("version"); // Version field value not used
|
||||
std::string name = args.get("name");
|
||||
strlcpy(m_name, name.c_str(), PLAYERNAME_SIZE);
|
||||
|
@ -235,8 +237,6 @@ void Player::deSerialize(std::istream &is, std::string playername)
|
|||
inventory.getList("craftresult")->changeItem(0, ItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
m_dirty = false;
|
||||
}
|
||||
|
||||
u32 Player::addHud(HudElement *toadd)
|
||||
|
@ -299,7 +299,7 @@ void RemotePlayer::save(std::string savedir)
|
|||
if (!fs::safeWriteToFile(path, ss.str())) {
|
||||
infostream << "Failed to write " << path << std::endl;
|
||||
}
|
||||
m_dirty = false;
|
||||
setModified(false);
|
||||
return;
|
||||
}
|
||||
// Open file and deserialize
|
||||
|
@ -317,7 +317,7 @@ void RemotePlayer::save(std::string savedir)
|
|||
if (!fs::safeWriteToFile(path, ss.str())) {
|
||||
infostream << "Failed to write " << path << std::endl;
|
||||
}
|
||||
m_dirty = false;
|
||||
setModified(false);
|
||||
return;
|
||||
}
|
||||
path = savedir + m_name + itos(i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue