summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/viewport.cpp3
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.h3
-rw-r--r--src/gui/windows/inventorywindow.cpp17
-rw-r--r--src/gui/windows/inventorywindow.h2
-rw-r--r--src/gui/windows/updaterwindow.cpp18
6 files changed, 27 insertions, 18 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 46d47ab4a..c7e2b31df 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -270,13 +270,12 @@ void Viewport::logic()
BLOCK_START("Viewport::logic")
// Make the player follow the mouse position
// if the mouse is dragged elsewhere than in a window.
- followMouse();
+ Gui::getMouseState(&mMouseX, &mMouseY);
BLOCK_END("Viewport::logic")
}
void Viewport::followMouse()
{
- return;
if (!gui)
return;
const uint8_t button = Gui::getMouseState(&mMouseX, &mMouseY);
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index ee2e35920..f24be7737 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -507,7 +507,7 @@ void ItemContainer::mouseReleased(MouseEvent &event)
Net::getInventoryHandler()->moveItem(mSelectedIndex, index);
selectNone();
}
- else
+ else if (mInventory)
{
const DragDropSource src = dragDrop.getSource();
DragDropSource dst = DRAGDROP_SOURCE_EMPTY;
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index f7bc44849..06e9fd459 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -131,6 +131,9 @@ class ItemContainer final : public Widget,
bool getClickCount() const A_WARN_UNUSED
{ return mClicks; }
+ void unsetInventory()
+ { mInventory = nullptr; }
+
private:
enum Direction
{
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index c2a4b4636..01e5e052d 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -271,7 +271,8 @@ void InventoryWindow::postInit()
InventoryWindow::~InventoryWindow()
{
invInstances.remove(this);
- mInventory->removeInventoyListener(this);
+ if (mInventory)
+ mInventory->removeInventoyListener(this);
if (!invInstances.empty())
invInstances.front()->updateDropButton();
@@ -681,7 +682,10 @@ void InventoryWindow::close()
else
{
if (Net::getInventoryHandler())
+ {
Net::getInventoryHandler()->closeStorage(Inventory::STORAGE);
+ Net::getInventoryHandler()->forgotStorage();
+ }
scheduleDelete();
}
}
@@ -806,3 +810,14 @@ void InventoryWindow::setVisible(bool visible)
mSortDropDown->hideDrop();
Window::setVisible(visible);
}
+
+void InventoryWindow::unsetInventory()
+{
+ if (mInventory)
+ {
+ mInventory->removeInventoyListener(this);
+ if (mItems)
+ mItems->unsetInventory();
+ }
+ mInventory = nullptr;
+}
diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h
index 7e47e0362..10e1e21e2 100644
--- a/src/gui/windows/inventorywindow.h
+++ b/src/gui/windows/inventorywindow.h
@@ -152,6 +152,8 @@ class InventoryWindow final : public Window,
void setVisible(bool visible) override final;
+ void unsetInventory();
+
static bool isAnyInputFocused();
private:
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 824d8e0f6..75460cf78 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -840,21 +840,11 @@ void UpdaterWindow::logic()
if (mUpdateIndex < mUpdateFiles.size())
{
UpdateFile thisFile = mUpdateFiles[mUpdateIndex];
- if (!thisFile.required)
+ if (thisFile.type == "music"
+ && !config.getBoolValue("download-music"))
{
- // This statement checks to see if the file type
- // is music, and if download-music is true
- // If it fails, this statement returns true,
- // and results in not downloading the file
- // Else it will ignore the break,
- // and download the file.
-
- if (!(thisFile.type == "music"
- && config.getBoolValue("download-music")))
- {
- mUpdateIndex++;
- break;
- }
+ mUpdateIndex++;
+ break;
}
mCurrentFile = thisFile.name;
std::string checksum;