diff options
-rw-r--r-- | src/client/inventorywindow.cc | 12 | ||||
-rw-r--r-- | src/game/base/game.cc | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/client/inventorywindow.cc b/src/client/inventorywindow.cc index 9539061..1483325 100644 --- a/src/client/inventorywindow.cc +++ b/src/client/inventorywindow.cc @@ -7,6 +7,7 @@ #include "core/application.h" #include "client/inventorywindow.h" #include "ui/label.h" +#include "ui/bitmap.h" #include "ui/listitem.h" #include "ui/paint.h" #include "ui/ui.h" @@ -135,6 +136,17 @@ void InventoryWindow::update_inventory() sortkey += item->info()->label(); listitem->set_sortkey(sortkey); + // mount indicator + if (item->has_flag(core::Item::Mounted)) { + const float icon_size = 24.0f; // small icons + const float padding = ui::root()->font_large()->height(); + + ui::Bitmap *icon = new ui::Bitmap(listitem, "bitmaps/icons/button_unmount"); + icon->set_background(true); + icon->set_size(icon_size, icon_size); + icon->set_location(ui::UI::elementsize.width() - icon_size - padding, padding); + } + // preserve previous selection during update if (item == selecteditem) { inventorywindow_listview->select(listitem); diff --git a/src/game/base/game.cc b/src/game/base/game.cc index e9ea476..db03e4e 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -1229,7 +1229,9 @@ void Game::func_mount(core::Player *player, const std::string &args) slot->set_item(0); slot->unset_flag(core::Slot::Active); slot->unset_flag(core::Slot::Mounted); - item->unset_flag(core::Item::Mounted); + item->unset_flag(core::Item::Mounted); + + ship->inventory()->set_dirty(); if (ship->owner()) { std::stringstream msgstr; msgstr << "^BUnmounted " << weapon->name(); @@ -1259,6 +1261,8 @@ void Game::func_mount(core::Player *player, const std::string &args) slot->set_flag(core::Slot::Active); slot->set_flag(core::Slot::Mounted); item->set_flag(core::Item::Mounted); + + ship->inventory()->set_dirty(); if (ship->owner()) { std::stringstream msgstr; msgstr << "^BMounted " << weapon->name(); |