1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Fix missing clear

This commit is contained in:
SmallJoker 2025-06-15 16:52:10 +02:00
parent 0fe91a7a23
commit 4b3a809021

View file

@ -326,18 +326,20 @@ void GameFormSpec::showPlayerInventory(const std::string *fs_override)
InventoryLocation inventoryloc; InventoryLocation inventoryloc;
inventoryloc.setCurrentPlayer(); inventoryloc.setCurrentPlayer();
if (fs_override)
player->inventory_formspec_override = *fs_override;
else
player->inventory_formspec_override.clear();
if (m_client->modsLoaded() && m_client->getScript()->on_inventory_open(m_client->getInventory(inventoryloc))) { if (m_client->modsLoaded() && m_client->getScript()->on_inventory_open(m_client->getInventory(inventoryloc))) {
delete fs_src; delete fs_src;
return; return;
} }
const std::string &formspec = fs_override ? *fs_override : fs_src->getForm(); if (fs_src->getForm().empty() || (fs_override && fs_override->empty())) {
if (formspec.empty()) {
delete fs_src; delete fs_src;
return; return;
} }
if (fs_override)
player->inventory_formspec_override = *fs_override;
TextDest *txt_dst = new TextDestPlayerInventory(m_client); TextDest *txt_dst = new TextDestPlayerInventory(m_client);
@ -345,7 +347,7 @@ void GameFormSpec::showPlayerInventory(const std::string *fs_override)
&m_input->joystick, fs_src, txt_dst, m_client->getFormspecPrepend(), &m_input->joystick, fs_src, txt_dst, m_client->getFormspecPrepend(),
m_client->getSoundManager()); m_client->getSoundManager());
m_formspec->setFormSpec(formspec, inventoryloc); m_formspec->setFormSpec(fs_src->getForm(), inventoryloc);
} }
#define SIZE_TAG "size[11,5.5,true]" // Fixed size (ignored in touchscreen mode) #define SIZE_TAG "size[11,5.5,true]" // Fixed size (ignored in touchscreen mode)