void MenuManager::closeAll(bool play_sound) { if (!dragging) { closeLeft(play_sound); closeRight(false); vendor->talker_visible = false; } }
void MenuManager::closeAll() { if (!dragging) { closeLeft(); closeRight(); vendor->talker_visible = false; } }
Doors_Controller::Doors_Controller(SubteStatus *subte, SingleButton *openLeftDoors, SingleButton *closeLeftDoors, SingleButton *selectLeftDoors, SingleButton *openRightDoors, SingleButton *closeRightDoors, SingleButton *selectRightDoors, SingleButton *silbato) : Base_Controller(subte) { m_selectLeftDoors = selectLeftDoors; m_openLeftDoors = openLeftDoors; m_closeLeftDoors = closeLeftDoors; m_selectRightDoors = selectRightDoors; m_openRightDoors = openRightDoors; m_closeRightDoors = closeRightDoors; m_silbato = silbato; m_closeRightDoors->setButtonImage(QUrl("qrc:/resources/greenON.png"),QUrl("qrc:/resources/green.png")); m_closeLeftDoors->setButtonImage(QUrl("qrc:/resources/greenON.png"),QUrl("qrc:/resources/green.png")); m_openRightDoors->setButtonImage(QUrl("qrc:/resources/greenON.png"),QUrl("qrc:/resources/green.png")); m_openLeftDoors->setButtonImage(QUrl("qrc:/resources/greenON.png"),QUrl("qrc:/resources/green.png")); m_silbato->setButtonImage(QUrl("qrc:/resources/blueON.png"),QUrl("qrc:/resources/blueplane.png")); m_closeLeftDoors->setLightManagement(false); m_closeRightDoors->setLightManagement(false); m_openLeftDoors->setLightManagement(false); m_openRightDoors->setLightManagement(false); turnOn(); connect(m_closeLeftDoors,SIGNAL(buttonClicked()),this,SLOT(closeLeft())); connect(m_openLeftDoors,SIGNAL(buttonClicked()),this,SLOT(openLeft())); connect(m_closeRightDoors,SIGNAL(buttonClicked()),this,SLOT(closeRight())); connect(m_openRightDoors,SIGNAL(buttonClicked()),this,SLOT(openRight())); connect(m_selectLeftDoors,SIGNAL(buttonClicked()),this,SLOT(enableLeftPanel())); connect(m_selectRightDoors,SIGNAL(buttonClicked()),this,SLOT(enableRightPanel())); connect(m_subte,SIGNAL(DoorsChanged(bool)),this,SLOT(updatePanel(bool))); }
void MenuManager::logic() { bool clicking_character = false; bool clicking_inventory = false; bool clicking_powers = false; bool clicking_log = false; ItemStack stack; hp->update(stats->hp,stats->maxhp,inpt->mouse,""); mp->update(stats->mp,stats->maxmp,inpt->mouse,""); xp->update((stats->xp - stats->xp_table[stats->level-1]),(stats->xp_table[stats->level] - stats->xp_table[stats->level-1]),inpt->mouse,msg->get("XP: %d/%d", stats->xp, stats->xp_table[stats->level])); effects->update(stats); hudlog->logic(); enemy->logic(); chr->logic(); inv->logic(); vendor->logic(); pow->logic(); log->logic(); talker->logic(); stash->logic(); if (chr->checkUpgrade() || stats->level_up) { // apply equipment and max hp/mp inv->applyEquipment(inv->inventory[EQUIPMENT].storage); stats->hp = stats->maxhp; stats->mp = stats->maxmp; stats->level_up = false; } // only allow the vendor window to be open if the inventory is open if (vendor->visible && !(inv->visible)) { snd->play(vendor->sfx_close); closeLeft(); if (vendor->talker_visible && !(inv->visible)) closeRight(); } if (!inpt->pressing[INVENTORY] && !inpt->pressing[POWERS] && !inpt->pressing[CHARACTER] && !inpt->pressing[LOG]) key_lock = false; // handle npc action menu if (npc->visible) { npc->logic(); } // check if mouse-clicking a menu button act->checkMenu(inpt->mouse, clicking_character, clicking_inventory, clicking_powers, clicking_log); if (exit->visible) { exit->logic(); if (exit->isExitRequested()) { done = true; } } // exit menu toggle if ((!key_lock && !dragging) && !(stats->corpse && stats->permadeath)) { if (inpt->pressing[CANCEL] && !inpt->lock[CANCEL]) { inpt->lock[CANCEL] = true; key_lock = true; if (menus_open) { closeAll(); } else { exit->visible = !exit->visible; } } } // inventory menu toggle if ((inpt->pressing[INVENTORY] && !key_lock && !dragging) || clicking_inventory) { key_lock = true; if (inv->visible) { snd->play(inv->sfx_close); closeRight(); } else { closeRight(); act->requires_attention[MENU_INVENTORY] = false; inv->visible = true; snd->play(inv->sfx_open); } } // powers menu toggle if (((inpt->pressing[POWERS] && !key_lock && !dragging) || clicking_powers) && stats->humanoid) { key_lock = true; if (pow->visible) { snd->play(pow->sfx_close); closeRight(); } else { closeRight(); act->requires_attention[MENU_POWERS] = false; pow->visible = true; snd->play(pow->sfx_open); } } act->requires_attention[MENU_POWERS] = pow->getUnspent() > 0; // character menu toggleggle if (((inpt->pressing[CHARACTER] && !key_lock && !dragging) || clicking_character)) { key_lock = true; if (chr->visible) { snd->play(chr->sfx_close); closeLeft(); } else { closeLeft(); act->requires_attention[MENU_CHARACTER] = false; chr->visible = true; snd->play(chr->sfx_open); // Make sure the stat list isn't scrolled when we open the character menu inpt->resetScroll(); } } act->requires_attention[MENU_CHARACTER] = chr->getUnspent() > 0; // log menu toggle if ((inpt->pressing[LOG] && !key_lock && !dragging) || clicking_log) { key_lock = true; if (log->visible) { snd->play(log->sfx_close); closeLeft(); } else { closeLeft(); act->requires_attention[MENU_LOG] = false; log->visible = true; snd->play(log->sfx_open); // Make sure the log isn't scrolled when we open the log menu inpt->resetScroll(); } } if (MENUS_PAUSE) { pause = (inv->visible || pow->visible || chr->visible || log->visible || vendor->visible || talker->visible || npc->visible); } menus_open = (inv->visible || pow->visible || chr->visible || log->visible || vendor->visible || talker->visible || npc->visible); if (ENABLE_JOYSTICK && (menus_open || exit->visible)) inpt->enableMouseEmulation(); else inpt->disableMouseEmulation(); if (stats->alive) { // handle right-click if (!dragging && inpt->pressing[MAIN2] && !inpt->lock[MAIN2]) { // exit menu if (exit->visible && isWithin(exit->window_area, inpt->mouse)) { inpt->lock[MAIN2] = true; } // activate inventory item else if (inv->visible && isWithin(inv->window_area, inpt->mouse)) { inpt->lock[MAIN2] = true; if (isWithin(inv->carried_area, inpt->mouse)) { inv->activate(inpt); } } } // handle left-click if (!dragging && inpt->pressing[MAIN1] && !inpt->lock[MAIN1]) { // exit menu if (exit->visible && isWithin(exit->window_area, inpt->mouse)) { inpt->lock[MAIN1] = true; } if (chr->visible && isWithin(chr->window_area, inpt->mouse)) { inpt->lock[MAIN1] = true; } if (vendor->visible && isWithin(vendor->window_area,inpt->mouse)) { inpt->lock[MAIN1] = true; vendor->tabsLogic(); if (inpt->pressing[CTRL]) { // buy item from a vendor stack = vendor->click(inpt); if (stack.item > 0) { if (!inv->buy(stack,vendor->getTab())) { log->add(msg->get("Not enough money."), LOG_TYPE_MESSAGES); hudlog->add(msg->get("Not enough money.")); vendor->itemReturn( stack); } else { if (inv->full(stack.item)) { log->add(msg->get("Inventory is full."), LOG_TYPE_MESSAGES); hudlog->add(msg->get("Inventory is full.")); drop_stack = stack; } else { inv->add(stack); } } } } else { // start dragging a vendor item drag_stack = vendor->click(inpt); if (drag_stack.item > 0) { dragging = true; drag_src = DRAG_SRC_VENDOR; } } } if (stash->visible && isWithin(stash->window_area,inpt->mouse)) { inpt->lock[MAIN1] = true; if (inpt->pressing[CTRL]) { // take an item from the stash stack = stash->click(inpt); if (stack.item > 0) { if (inv->full(stack.item)) { log->add(msg->get("Inventory is full."), LOG_TYPE_MESSAGES); hudlog->add(msg->get("Inventory is full.")); drop_stack = stack; } else { inv->add(stack); } stash->updated = true; } } else { // start dragging a stash item drag_stack = stash->click(inpt); if (drag_stack.item > 0) { dragging = true; drag_src = DRAG_SRC_STASH; } } } if (log->visible && isWithin(log->window_area,inpt->mouse)) { inpt->lock[MAIN1] = true; } // pick up an inventory item if (inv->visible && isWithin(inv->window_area,inpt->mouse)) { if (inpt->pressing[CTRL]) { inpt->lock[MAIN1] = true; stack = inv->click(inpt); if (stack.item > 0) { if (stash->visible) { if (inv->stashAdd(stack) && !stash->full(stack.item)) { stash->add(stack); stash->updated = true; } else { inv->itemReturn(stack); } } else { // The vendor could have a limited amount of money in the future. It will be tested here. if ((SELL_WITHOUT_VENDOR || vendor->visible) && inv->sell(stack)) { vendor->setTab(VENDOR_SELL); vendor->add(stack); } else { inv->itemReturn(stack); } } } } else { inpt->lock[MAIN1] = true; drag_stack = inv->click(inpt); if (drag_stack.item > 0) { dragging = true; drag_src = DRAG_SRC_INVENTORY; } } } // pick up a power if (pow->visible && isWithin(pow->window_area,inpt->mouse)) { inpt->lock[MAIN1] = true; // check for unlock first if (!pow->unlockClick(inpt->mouse)) { // otherwise, check for dragging drag_power = pow->click(inpt->mouse); if (drag_power > 0) { dragging = true; drag_src = DRAG_SRC_POWERS; } } } // action bar if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse) || isWithin(act->menuArea, inpt->mouse)) { inpt->lock[MAIN1] = true; // ctrl-click action bar to clear that slot if (inpt->pressing[CTRL]) { act->remove(inpt->mouse); } // allow drag-to-rearrange action bar else if (!isWithin(act->menuArea, inpt->mouse)) { drag_power = act->checkDrag(inpt->mouse); if (drag_power > 0) { dragging = true; drag_src = DRAG_SRC_ACTIONBAR; } } // else, clicking action bar to use a power? // this check is done by GameEngine when calling Avatar::logic() } } // handle dropping if (dragging && !inpt->pressing[MAIN1]) { // putting a power on the Action Bar if (drag_src == DRAG_SRC_POWERS) { if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse)) { act->drop(inpt->mouse, drag_power, 0); } } // rearranging the action bar else if (drag_src == DRAG_SRC_ACTIONBAR) { if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse)) { act->drop(inpt->mouse, drag_power, 1); // for locked slots forbid power dropping } else if (act->locked[act->drag_prev_slot]) { act->hotkeys[act->drag_prev_slot] = drag_power; } } // rearranging inventory or dropping items else if (drag_src == DRAG_SRC_INVENTORY) { if (inv->visible && isWithin(inv->window_area, inpt->mouse)) { inv->drop(inpt->mouse, drag_stack); drag_stack.item = 0; } else if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse)) { // The action bar is not storage! inv->itemReturn(drag_stack); // put an item with a power on the action bar if (items->items[drag_stack.item].power != 0) { act->drop(inpt->mouse, items->items[drag_stack.item].power, false); } } else if (vendor->visible && isWithin(vendor->slots_area, inpt->mouse)) { if (inv->sell( drag_stack)) { vendor->setTab(VENDOR_SELL); vendor->add( drag_stack); } else { inv->itemReturn(drag_stack); } drag_stack.item = 0; } else if (stash->visible && isWithin(stash->slots_area, inpt->mouse)) { if (inv->stashAdd( drag_stack) && !stash->full(drag_stack.item)) { stash->drop(inpt->mouse, drag_stack); stash->updated = true; } else { inv->itemReturn(drag_stack); } drag_stack.item = 0; } else { // if dragging and the source was inventory, drop item to the floor // quest items cannot be dropped if (items->items[drag_stack.item].type != "quest") { drop_stack = drag_stack; drag_stack.item = 0; drag_stack.quantity = 0; inv->clearHighlight(); } else { inv->itemReturn(drag_stack); } } } else if (drag_src == DRAG_SRC_VENDOR) { // dropping an item from vendor (we only allow to drop into the carried area) if (inv->visible && isWithin( inv->carried_area, inpt->mouse)) { if (!inv->buy(drag_stack,vendor->getTab())) { log->add(msg->get("Not enough money."), LOG_TYPE_MESSAGES); hudlog->add(msg->get("Not enough money.")); vendor->itemReturn( drag_stack); } else { if (inv->full(drag_stack.item)) { log->add(msg->get("Inventory is full."), LOG_TYPE_MESSAGES); hudlog->add(msg->get("Inventory is full.")); drop_stack = drag_stack; } else { inv->drop(inpt->mouse,drag_stack); } } drag_stack.item = 0; drag_stack.quantity = 0; } else { vendor->itemReturn(drag_stack); } } else if (drag_src == DRAG_SRC_STASH) { // dropping an item from stash (we only allow to drop into the carried area) if (inv->visible && isWithin( inv->carried_area, inpt->mouse)) { if (inv->full(drag_stack.item)) { log->add(msg->get("Inventory is full."), LOG_TYPE_MESSAGES); hudlog->add(msg->get("Inventory is full.")); // quest items cannot be dropped if (items->items[drag_stack.item].type != "quest") { drop_stack = drag_stack; } else { stash->itemReturn(drag_stack); } } else { inv->drop(inpt->mouse,drag_stack); } stash->updated = true; drag_stack.item = 0; drag_stack.quantity = 0; } else if (stash->visible && isWithin(stash->slots_area, inpt->mouse)) { stash->drop(inpt->mouse,drag_stack); } else { stash->itemReturn( drag_stack); } } dragging = false; } } else { if (dragging) { if (drag_src == DRAG_SRC_VENDOR) vendor->itemReturn(drag_stack); else if (drag_src == DRAG_SRC_STASH) stash->itemReturn(drag_stack); else if (drag_src == DRAG_SRC_INVENTORY) inv->itemReturn(drag_stack); else if (drag_src == DRAG_SRC_ACTIONBAR) act->actionReturn(drag_power); drag_src = -1; dragging = false; } } // handle equipment changes affecting hero stats if (inv->changed_equipment || inv->changed_artifact) { inv->applyEquipment(inv->inventory[EQUIPMENT].storage); inv->changed_artifact = false; // the equipment flag is reset after the new sprites are loaded } // for action-bar powers that represent items, lookup the current item count for (int i=0; i<12; i++) { act->slot_enabled[i] = true; act->slot_item_count[i] = -1; if (act->hotkeys[i] != -1) { int item_id = powers->powers[act->hotkeys[i]].requires_item; if (item_id != -1 && items->items[item_id].type == "consumable") { act->slot_item_count[i] = inv->getItemCountCarried(item_id); if (act->slot_item_count[i] == 0) { act->slot_enabled[i] = false; } } else if (item_id != -1) { // if a non-consumable item power is unequipped, disable that slot if (!inv->isItemEquipped(item_id)) { act->slot_enabled[i] = false; } } } } }
void MenuManager::closeAll(bool play_sound) { if (!dragging) { closeLeft(play_sound); closeRight(false); } }
void MenuManager::logic() { bool clicking_character = false; bool clicking_inventory = false; bool clicking_powers = false; bool clicking_log = false; ItemStack stack; hudlog->logic(); enemy->logic(); chr->logic(); inv->logic(); vendor->logic(); pow->logic(); log->logic(); talker->logic(); // only allow the vendor window to be open if the inventory is open if (vendor->visible && !(inv->visible)) { closeLeft(true); } if (!inpt->pressing[INVENTORY] && !inpt->pressing[POWERS] && !inpt->pressing[CHARACTER] && !inpt->pressing[LOG]) key_lock = false; // check if mouse-clicking a menu button act->checkMenu(inpt->mouse, clicking_character, clicking_inventory, clicking_powers, clicking_log); if (exit->visible) { exit->logic(); if (exit->isExitRequested()) { done = true; } } // exit menu toggle if ((inpt->pressing[CANCEL] && !inpt->lock[CANCEL] && !key_lock && !dragging) && !(stats->corpse && stats->permadeath)) { inpt->lock[CANCEL] = true; key_lock = true; if (menus_open) { closeAll(true); } else { exit->visible = !exit->visible; } } // inventory menu toggle if (((inpt->pressing[INVENTORY] && !key_lock && !dragging) || clicking_inventory) && !stats->transformed) { key_lock = true; if (inv->visible) { closeRight(true); } else { closeRight(false); act->requires_attention[MENU_INVENTORY] = false; inv->visible = true; if (sfx_open) Mix_PlayChannel(-1, sfx_open, 0); } } // powers menu toggle if (((inpt->pressing[POWERS] && !key_lock && !dragging) || clicking_powers) && !stats->transformed) { key_lock = true; if (pow->visible) { closeRight(true); } else { closeRight(false); act->requires_attention[MENU_POWERS] = false; pow->visible = true; if (sfx_open) Mix_PlayChannel(-1, sfx_open, 0); } } // character menu toggleggle if (((inpt->pressing[CHARACTER] && !key_lock && !dragging) || clicking_character) && !stats->transformed) { key_lock = true; if (chr->visible) { closeLeft(true); } else { closeLeft(false); act->requires_attention[MENU_CHARACTER] = false; chr->visible = true; if (sfx_open) Mix_PlayChannel(-1, sfx_open, 0); } } // log menu toggle if (((inpt->pressing[LOG] && !key_lock && !dragging) || clicking_log) && !stats->transformed) { key_lock = true; if (log->visible) { closeLeft(true); } else { closeLeft(false); act->requires_attention[MENU_LOG] = false; log->visible = true; if (sfx_open) Mix_PlayChannel(-1, sfx_open, 0); } } if (MENUS_PAUSE) { pause = (inv->visible || pow->visible || chr->visible || log->visible || vendor->visible || talker->visible); } menus_open = (inv->visible || pow->visible || chr->visible || log->visible || vendor->visible || talker->visible); if (stats->alive) { int offset_x = (VIEW_W - 320); int offset_y = (VIEW_H - 416)/2; // handle right-click if (!dragging && inpt->pressing[MAIN2] && !inpt->lock[MAIN2]) { // exit menu if (exit->visible && isWithin(exit->window_area, inpt->mouse)) { inpt->lock[MAIN2] = true; } // activate inventory item else if (inv->visible && isWithin(inv->window_area, inpt->mouse)) { inpt->lock[MAIN2] = true; if (isWithin(inv->carried_area, inpt->mouse)) { inv->activate(inpt); } } } // handle left-click if (!dragging && inpt->pressing[MAIN1] && !inpt->lock[MAIN1]) { // exit menu if (exit->visible && isWithin(exit->window_area, inpt->mouse)) { inpt->lock[MAIN1] = true; } // left side menu else if (inpt->mouse.x <= 320 && inpt->mouse.y >= offset_y && inpt->mouse.y <= offset_y+416) { if (chr->visible) { inpt->lock[MAIN1] = true; // applied a level-up if (chr->checkUpgrade()) { // apply equipment and max hp/mp inv->applyEquipment(inv->inventory[EQUIPMENT].storage); stats->hp = stats->maxhp; stats->mp = stats->maxmp; } } else if (vendor->visible) { inpt->lock[MAIN1] = true; if (inpt->pressing[CTRL]) { // buy item from a vendor if (!inv->full()) { stack = vendor->click(inpt); if (stack.item > 0) { if( inv->full()) { // Can we say "Not enough place" ? vendor->itemReturn( stack); } else if( ! inv->buy( stack)) { // Can we say "Not enough money" ? (here or in MenuInventory::buy()) vendor->itemReturn( stack); } } } } else { // start dragging a vendor item drag_stack = vendor->click(inpt); if (drag_stack.item > 0) { dragging = true; drag_src = DRAG_SRC_VENDOR; } } } else if(log->visible) { inpt->lock[MAIN1] = true; log->tabsLogic(); } } // right side menu else if (inpt->mouse.x >= offset_x && inpt->mouse.y >= offset_y && inpt->mouse.y <= offset_y+416) { // pick up an inventory item if (inv->visible) { if (inpt->pressing[CTRL]) { inpt->lock[MAIN1] = true; stack = inv->click(inpt); if( stack.item > 0) { if (vendor->visible) { if( vendor->full()) { // Can we say "Not enough place" ? inv->itemReturn( stack); } else { // The vendor could have a limited amount of money in the future. It will be tested here. if (inv->sell(stack)) { vendor->add(stack); } else { inv->itemReturn(stack); } } } else { if (!inv->sell(stack)) { inv->itemReturn(stack); } } } } else { inpt->lock[MAIN1] = true; drag_stack = inv->click(inpt); if (drag_stack.item > 0) { dragging = true; drag_src = DRAG_SRC_INVENTORY; } } } // pick up a power else if (pow->visible) { inpt->lock[MAIN1] = true; drag_power = pow->click(inpt->mouse); if (drag_power > -1) { dragging = true; drag_src = DRAG_SRC_POWERS; } } } // action bar else if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse) || isWithin(act->menuArea, inpt->mouse)) { inpt->lock[MAIN1] = true; // ctrl-click action bar to clear that slot if (inpt->pressing[CTRL] && !stats->transformed) { act->remove(inpt->mouse); } // allow drag-to-rearrange action bar else if (!isWithin(act->menuArea, inpt->mouse) && !stats->transformed) { drag_power = act->checkDrag(inpt->mouse); if (drag_power > -1) { dragging = true; drag_src = DRAG_SRC_ACTIONBAR; } } // else, clicking action bar to use a power? // this check is done by GameEngine when calling Avatar::logic() } } // handle dropping if (dragging && !inpt->pressing[MAIN1]) { // putting a power on the Action Bar if (drag_src == DRAG_SRC_POWERS) { if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse)) { act->drop(inpt->mouse, drag_power, 0); } } // rearranging the action bar else if (drag_src == DRAG_SRC_ACTIONBAR) { if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse)) { act->drop(inpt->mouse, drag_power, 1); } } // rearranging inventory or dropping items else if (drag_src == DRAG_SRC_INVENTORY) { if (inv->visible && inpt->mouse.x >= offset_x && inpt->mouse.y >= offset_y && inpt->mouse.y <= offset_y+416) { inv->drop(inpt->mouse, drag_stack); drag_stack.item = 0; } else if (isWithin(act->numberArea,inpt->mouse) || isWithin(act->mouseArea,inpt->mouse)) { // The action bar is not storage! inv->itemReturn(drag_stack); // put an item with a power on the action bar if (items->items[drag_stack.item].power != -1) { act->drop(inpt->mouse, items->items[drag_stack.item].power, false); } } else if (vendor->visible && isWithin(vendor->slots_area, inpt->mouse)) { // vendor sell item if( vendor->full()) { // Can we say "Not enough place" ? inv->itemReturn( drag_stack); } else { if (inv->sell( drag_stack)) { vendor->add( drag_stack); } else { inv->itemReturn(drag_stack); } } drag_stack.item = 0; } else { // if dragging and the source was inventory, drop item to the floor // quest items cannot be dropped if (items->items[drag_stack.item].type != ITEM_TYPE_QUEST) { drop_stack = drag_stack; drag_stack.item = 0; drag_stack.quantity = 0; } else { inv->itemReturn(drag_stack); } } } else if (drag_src == DRAG_SRC_VENDOR) { // dropping an item from vendor (we only allow to drop into the carried area) if (inv->visible && isWithin( inv->carried_area, inpt->mouse)) { if( inv->full()) { // Can we say "Not enough place" ? vendor->itemReturn( drag_stack); } else if( ! inv->buy( drag_stack, inpt->mouse)) { // Can we say "Not enough money" ? (here or in MenuInventory::buy()) vendor->itemReturn( drag_stack); } drag_stack.item = 0; } else { vendor->itemReturn(drag_stack); } } dragging = false; } } // handle equipment changes affecting hero stats if (inv->changed_equipment || inv->changed_artifact) { inv->applyEquipment(inv->inventory[EQUIPMENT].storage); inv->changed_artifact = false; // the equipment flag is reset after the new sprites are loaded } // for action-bar powers that represent items, lookup the current item count for (int i=0; i<12; i++) { act->slot_enabled[i] = true; act->slot_item_count[i] = -1; if (act->hotkeys[i] != -1) { int item_id = powers->powers[act->hotkeys[i]].requires_item; if (item_id != -1 && items->items[item_id].type == ITEM_TYPE_CONSUMABLE) { act->slot_item_count[i] = inv->getItemCountCarried(item_id); if (act->slot_item_count[i] == 0) { act->slot_enabled[i] = false; } } else if (item_id != -1) { // if a non-consumable item power is unequipped, disable that slot if (!inv->isItemEquipped(item_id)) { act->slot_enabled[i] = false; } } } } }
void MenuManager::closeAll() { closeLeft(); closeRight(); }