MCPcopy Create free account
hub / github.com/TurningWheel/Barony / warpMouseToSelectedSpell

Method warpMouseToSelectedSpell

src/player.cpp:5620–5661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5618}
5619
5620bool Player::Inventory_t::warpMouseToSelectedSpell(Item* snapToItem, Uint32 flags)
5621{
5622 if ( spellFrame )
5623 {
5624 int x = getSelectedSpellX();
5625 int y = getSelectedSpellY();
5626 if ( snapToItem )
5627 {
5628 x = snapToItem->x;
5629 y = snapToItem->y;
5630 }
5631
5632 if ( spellPanel.isInteractable )
5633 {
5634 if ( abs(spellPanel.scrollAnimateX - spellPanel.scrollSetpoint) > 0.00001 )
5635 {
5636 int diff = (spellPanel.scrollAnimateX - spellPanel.scrollSetpoint) / getSlotSize();
5637 y += diff; // if we have a scroll in the works, then manipulate y to pretend where we'd be ahead of time.
5638 }
5639 }
5640
5641 if ( auto slot = getSpellSlotFrame(x, y) )
5642 {
5643 if ( !spellPanel.isInteractable )
5644 {
5645 //messagePlayer(0, "[Debug]: select spell queued");
5646 cursor.queuedModule = Player::GUI_t::MODULE_SPELLS;
5647 cursor.queuedFrameToWarpTo = slot;
5648 return false;
5649 }
5650 else
5651 {
5652 //messagePlayer(0, "[Debug]: select spell warped");
5653 slot->warpMouseToFrame(player.playernum, flags);
5654 cursor.queuedModule = Player::GUI_t::MODULE_NONE;
5655 cursor.queuedFrameToWarpTo = nullptr;
5656 }
5657 return true;
5658 }
5659 }
5660 return false;
5661}
5662
5663bool Player::Inventory_t::warpMouseToSelectedChestSlot(Item* snapToItem, Uint32 flags)
5664{

Callers 2

releaseItemFunction · 0.80

Calls 1

warpMouseToFrameMethod · 0.80

Tested by

no test coverage detected