diff options
author | Stijn Buys <ingar@osirion.org> | 2012-11-25 12:06:13 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-11-25 12:06:13 +0000 |
commit | d8be908233fd7b85492d7a9e87f07bb207173990 (patch) | |
tree | 70d9103a867688838fc517290bb370366c69fedb /src/client/inventorywindow.cc | |
parent | edc5ddce817244111b302e449c28a052f2746cc4 (diff) |
Moved core::EntityGlobe into a separate file,
added various methods to core::Item and core::Slot,
added r_slots cvar to draw entity slots and docks,
added game methods for mounting and umounting of weapons,
added playerlist to chat window.
Diffstat (limited to 'src/client/inventorywindow.cc')
-rw-r--r-- | src/client/inventorywindow.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/client/inventorywindow.cc b/src/client/inventorywindow.cc index 7912d0d..9539061 100644 --- a/src/client/inventorywindow.cc +++ b/src/client/inventorywindow.cc @@ -68,6 +68,7 @@ InventoryWindow::InventoryWindow(ui::Widget *parent) : ui::Window(parent) inventorywindow_shipbutton = new ui::IconButton(this, "bitmaps/icons/button_ship"); inventorywindow_ejectbutton = new ui::IconButton(this, "bitmaps/icons/button_eject"); + inventorywindow_mountbutton = new ui::IconButton(this, "bitmaps/icons/button_mount"); // eject dialog inventorywindow_ejectconfirmbutton = new ui::Button(inventorywindow_scrollpane, "Eject"); @@ -209,6 +210,9 @@ void InventoryWindow::resize() inventorywindow_ejectbutton->set_size(icon_size, icon_size); inventorywindow_ejectbutton->set_location(inventorywindow_inventorytext->right() - icon_size, height() - icon_size - padding); + inventorywindow_mountbutton->set_size(icon_size, icon_size); + inventorywindow_mountbutton->set_location(inventorywindow_ejectbutton->left() - icon_size - padding, height() - icon_size - padding); + // resize modelview inventorywindow_modelview->set_size( width() - inventorywindow_listview->right() - padding * 2.0f ,ui::UI::elementsize.width()); inventorywindow_modelview->set_location(inventorywindow_listview->right() + padding, padding * 3.0f); @@ -335,12 +339,29 @@ void InventoryWindow::act_eject() show_item_info(0); } +void InventoryWindow::act_mount() +{ + if (!inventorywindow_listview->selected()) { + return; + } + if (!inventorywindow_listview->selected()->item()) { + return; + } + + std::ostringstream cmdstr; + + cmdstr << "remote mount "; + cmdstr << inventorywindow_listview->selected()->item()->id(); + core::CommandBuffer::exec(cmdstr.str()); +} + void InventoryWindow::show_item_info(const ui::ListItem *listitem) { if (listitem) { set_info(listitem->info(), listitem->item()->amount()); if (listitem->item()->amount()) { inventorywindow_ejectbutton->enable(); + inventorywindow_mountbutton->enable(); } } else { set_info(0, 0); @@ -353,6 +374,7 @@ void InventoryWindow::set_info(const core::Info *info, const int amount) inventorywindow_infotext.clear(); inventorywindow_amount = amount; inventorywindow_ejectbutton->disable(); + inventorywindow_mountbutton->disable(); inventorywindow_ejectconfirmbutton->hide(); inventorywindow_ejectcancelbutton->hide(); @@ -393,8 +415,9 @@ bool InventoryWindow::on_emit(Widget *sender, const Event event, void *data) } else if (sender == inventorywindow_ejectcancelbutton) { show_item_info(inventorywindow_listview->selected()); } else if (sender == inventorywindow_ejectconfirmbutton) { - // TODO do actual eject act_eject(); + } else if (sender == inventorywindow_mountbutton) { + act_mount(); } else if (sender == inventorywindow_closebutton) { hide(); } |