mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
comments
This commit is contained in:
parent
4b3a809021
commit
25a319bb23
4 changed files with 22 additions and 16 deletions
|
@ -321,33 +321,35 @@ void GameFormSpec::showPlayerInventory(const std::string *fs_override)
|
|||
|
||||
infostream << "Game: Launching inventory" << std::endl;
|
||||
|
||||
PlayerInventoryFormSource *fs_src = new PlayerInventoryFormSource(m_client);
|
||||
auto fs_src = std::make_unique<PlayerInventoryFormSource>(m_client);
|
||||
|
||||
InventoryLocation inventoryloc;
|
||||
inventoryloc.setCurrentPlayer();
|
||||
|
||||
if (fs_override)
|
||||
if (fs_override) {
|
||||
// Temporary overwrite for this specific formspec.
|
||||
player->inventory_formspec_override = *fs_override;
|
||||
else
|
||||
} else {
|
||||
// Show the regular inventory formspec
|
||||
player->inventory_formspec_override.clear();
|
||||
|
||||
if (m_client->modsLoaded() && m_client->getScript()->on_inventory_open(m_client->getInventory(inventoryloc))) {
|
||||
delete fs_src;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fs_src->getForm().empty() || (fs_override && fs_override->empty())) {
|
||||
delete fs_src;
|
||||
// If preventedd by Client-Side Mods
|
||||
if (m_client->modsLoaded() && m_client->getScript()->on_inventory_open(m_client->getInventory(inventoryloc)))
|
||||
return;
|
||||
|
||||
// Empty formspec -> do not show.
|
||||
if (fs_src->getForm().empty())
|
||||
return;
|
||||
}
|
||||
|
||||
TextDest *txt_dst = new TextDestPlayerInventory(m_client);
|
||||
|
||||
GUIFormSpecMenu::create(m_formspec, m_client, m_rendering_engine->get_gui_env(),
|
||||
&m_input->joystick, fs_src, txt_dst, m_client->getFormspecPrepend(),
|
||||
&m_input->joystick, fs_src.get(), txt_dst, m_client->getFormspecPrepend(),
|
||||
m_client->getSoundManager());
|
||||
|
||||
m_formspec->setFormSpec(fs_src->getForm(), inventoryloc);
|
||||
fs_src.release(); // owned by GUIFormSpecMenu
|
||||
}
|
||||
|
||||
#define SIZE_TAG "size[11,5.5,true]" // Fixed size (ignored in touchscreen mode)
|
||||
|
|
|
@ -34,8 +34,8 @@ struct GameFormSpec
|
|||
// Currently only used for the in-game settings menu.
|
||||
void showPauseMenuFormSpec(const std::string &formspec, const std::string &formname);
|
||||
void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos);
|
||||
/// If ` fs_override`: Uses `player->inventory_formspec`.
|
||||
/// If `!fs_override`: Uses a temporary formspec until an update is received.
|
||||
/// If `!fs_override`: Uses `player->inventory_formspec`.
|
||||
/// If ` fs_override`: Uses a temporary formspec until an update is received.
|
||||
void showPlayerInventory(const std::string *fs_override);
|
||||
void showDeathFormspecLegacy();
|
||||
// Shows the hardcoded "main" pause menu.
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
|
||||
std::string hotbar_image = "";
|
||||
std::string hotbar_selected_image = "";
|
||||
/// Temporary player inventory formspec. Empty value = feature inactive.
|
||||
std::string inventory_formspec_override;
|
||||
|
||||
video::SColor light_color = video::SColor(255, 255, 255, 255);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue