void ItemContainer::mouseReleased(gcn::MouseEvent &event) { if (mClicks == 2) return; switch (mSelectionStatus) { case SEL_SELECTING: mSelectionStatus = SEL_SELECTED; return; case SEL_DESELECTING: selectNone(); return; case SEL_DRAGGING: mSelectionStatus = SEL_SELECTED; break; case SEL_NONE: case SEL_SELECTED: default: return; }; int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) return; if (index == mSelectedIndex || mSelectedIndex == -1) return; Net::getInventoryHandler()->moveItem(mSelectedIndex, index); selectNone(); }
bool IScriptTable::setValueAny( char const* key , ScriptAnyValue const& value ) { int slotIndex = getSlotIndex( key , -1 ); if ( slotIndex == -1 ) return false; return assignSlotValue( mSlotTable[ slotIndex ] , value ); }
bool IScriptTable::getValueAny( char const* key , ScriptAnyValue& value ) { int slotIndex = getSlotIndex( key , -1 ); if ( slotIndex == -1 ) { if ( !mDefaultTable ) return false; int slot; return mDefaultTable->getValueAny( key , value , slot ); } value = mSlotTable[ slotIndex ].value; return true; }
// Show ItemTooltip void ItemContainer::mouseMoved(gcn::MouseEvent &event) { Item *item = mInventory->getItem(getSlotIndex(event.getX(), event.getY())); if (item) { mItemPopup->setItem(item->getInfo()); mItemPopup->view(viewport->getMouseX(), viewport->getMouseY()); } else { mItemPopup->setVisible(false); } }
void ItemContainer::mousePressed(gcn::MouseEvent &event) { if (!mInventory) return; const int button = event.getButton(); mClicks = event.getClickCount(); if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT) { const int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) return; Item *item = mInventory->getItem(index); // put item name into chat window if (item && mDescItems && chatWindow) chatWindow->addItemText(item->getInfo().getName()); if (mSelectedIndex == index && mClicks != 2) { mSelectionStatus = SEL_DESELECTING; } else if (item && item->getId()) { setSelectedIndex(index); mSelectionStatus = SEL_SELECTING; int num = itemShortcutWindow->getTabIndex(); if (num >= 0 && num < SHORTCUT_TABS) { if (itemShortcut[num]) itemShortcut[num]->setItemSelected(item); } if (dropShortcut) dropShortcut->setItemSelected(item); if (item->isEquipment() && outfitWindow) outfitWindow->setItemSelected(item); if (shopWindow) shopWindow->setItemSelected(item->getId()); } else { selectNone(); } } }
// Show ItemTooltip void ItemContainer::mouseMoved(gcn::MouseEvent &event) { if (!mInventory) return; Item *item = mInventory->getItem(getSlotIndex(event.getX(), event.getY())); if (item && viewport) { mItemPopup->setItem(item); mItemPopup->position(viewport->getMouseX(), viewport->getMouseY()); } else { mItemPopup->setVisible(false); } }
int getFrameDpyOrder( unsigned long long encoding_count, /*Input, the encoding order, start from 0*/ int bframes, /*Input, The number of B frames between P and I */ int intracnt, /*Input, Intra period*/ int idrcnt, /*INput, IDR period. 0: only one IDR; */ FRAME_ORDER_INFO *p_last_info, /*Input & Output. Reset to 0 on first call*/ unsigned long long *displaying_order) /* Output. The displaying order */ { IMG_FRAME_TYPE frame_type; /*Output. Frame type. 0: I frame. 1: P frame. 2: B frame*/ int slot; /*Output. The corresponding slot index */ // int i; unsigned long long disp_index; unsigned long long val; if ((intracnt % (bframes + 1)) != 0 || bframes == 0) return -1; val = ((idrcnt == 0) ? encoding_count : encoding_count % (intracnt * idrcnt + 1)); if ((idrcnt == 0 && encoding_count == 0) || (idrcnt != 0 && (encoding_count % (intracnt * idrcnt + 1) == 0))) { frame_type = IMG_INTRA_IDR; disp_index = encoding_count; } else if (((val - 1) % (bframes + 1)) != 0) { frame_type = IMG_INTER_B; disp_index = encoding_count - 1; } else if (p_last_info->last_frame_type == IMG_INTRA_IDR || ((val - 1) / (bframes + 1) % (intracnt / (bframes + 1))) != 0) { frame_type = IMG_INTER_P; disp_index = encoding_count + bframes; } else { frame_type = IMG_INTRA_FRAME; disp_index = encoding_count + bframes; } *displaying_order = disp_index; slot = getSlotIndex(bframes, intracnt, idrcnt, disp_index, encoding_count, p_last_info); p_last_info->last_frame_type = frame_type; p_last_info->last_slot = slot; return 0; }
void ItemContainer::mousePressed(gcn::MouseEvent &event) { const int button = event.getButton(); if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT) { const int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) return; Item *item = mInventory->getItem(index); // put item name into chat window if (mDescItems) { chatWindow->addItemText(item->getInfo().getName()); } if (mSelectedIndex == index) { mSelectionStatus = SEL_DESELECTING; } else if (item && item->getId()) { setSelectedIndex(index); mSelectionStatus = SEL_SELECTING; itemShortcut->setItemSelected(item->getId()); if (item->isEquipment()) outfitWindow->setItemSelected(item->getId()); } else { selectNone(); } } }
List* getListFromHashMap(Hashmap* hash,void* key){ Slot *slotOfElement; int slotNumber = getSlotIndex(hash,key); slotOfElement = get(&hash->bucket,slotNumber); return slotOfElement->list; }