[Cllient] Update multiplayer code for handling quick keys

0.6.3
David Cernat 7 years ago
parent 3438061b55
commit 7775780ad7

@ -169,7 +169,7 @@ namespace MWGui
*/ */
if (mwmp::Main::get().getLocalPlayer()->hasFinishedCharGen() && !mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys) if (mwmp::Main::get().getLocalPlayer()->hasFinishedCharGen() && !mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys)
{ {
mwmp::Main::get().getLocalPlayer()->sendQuickKey(index, Type_Unassigned); mwmp::Main::get().getLocalPlayer()->sendQuickKey(key->index, Type_Unassigned);
} }
/* /*
End of tes3mp addition End of tes3mp addition
@ -183,7 +183,7 @@ namespace MWGui
*/ */
void QuickKeysMenu::unassignIndex(int index) void QuickKeysMenu::unassignIndex(int index)
{ {
unassign(mQuickKeyButtons[index], index); unassign(&mKey[index]);
} }
/* /*
End of tes3mp addition End of tes3mp addition
@ -281,7 +281,7 @@ namespace MWGui
by a player, not by a packet received from the server by a player, not by a packet received from the server
*/ */
if (!mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys) if (!mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys)
mwmp::Main::get().getLocalPlayer()->sendQuickKey(mSelectedIndex, Type_Item, item.getCellRef().getRefId()); mwmp::Main::get().getLocalPlayer()->sendQuickKey(mSelected->index, Type_Item, item.getCellRef().getRefId());
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -316,7 +316,7 @@ namespace MWGui
Send a PLAYER_QUICKKEYS packet whenever a key is assigned to an item's magic Send a PLAYER_QUICKKEYS packet whenever a key is assigned to an item's magic
*/ */
if (!mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys) if (!mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys)
mwmp::Main::get().getLocalPlayer()->sendQuickKey(mSelectedIndex, Type_MagicItem, item.getCellRef().getRefId()); mwmp::Main::get().getLocalPlayer()->sendQuickKey(mSelected->index, Type_MagicItem, item.getCellRef().getRefId());
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -360,7 +360,7 @@ namespace MWGui
Send a PLAYER_QUICKKEYS packet whenever a key is assigned to a spell Send a PLAYER_QUICKKEYS packet whenever a key is assigned to a spell
*/ */
if (!mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys) if (!mwmp::Main::get().getLocalPlayer()->isReceivingQuickKeys)
mwmp::Main::get().getLocalPlayer()->sendQuickKey(mSelectedIndex, Type_Magic, spellId); mwmp::Main::get().getLocalPlayer()->sendQuickKey(mSelected->index, Type_Magic, spellId);
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -517,7 +517,7 @@ namespace MWGui
*/ */
void QuickKeysMenu::setSelectedIndex(int index) void QuickKeysMenu::setSelectedIndex(int index)
{ {
mSelectedIndex = index; mSelected = &mKey[index];
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -1565,10 +1565,14 @@ namespace MWGui
*/ */
void WindowManager::setQuickKey(int slot, int quickKeyType, MWWorld::Ptr item, const std::string& spellId) void WindowManager::setQuickKey(int slot, int quickKeyType, MWWorld::Ptr item, const std::string& spellId)
{ {
mQuickKeysMenu->setSelectedIndex(slot); if (slot > 0)
switch (quickKeyType)
{ {
// The actual indexes recorded for quick keys are always 1 higher than their
// indexes in the mKey vector, so adjust for the latter
mQuickKeysMenu->setSelectedIndex(slot - 1);
switch (quickKeyType)
{
case QuickKeysMenu::Type_Unassigned: case QuickKeysMenu::Type_Unassigned:
mQuickKeysMenu->unassignIndex(slot); mQuickKeysMenu->unassignIndex(slot);
break; break;
@ -1581,6 +1585,7 @@ namespace MWGui
case QuickKeysMenu::Type_Magic: case QuickKeysMenu::Type_Magic:
mQuickKeysMenu->onAssignMagic(spellId); mQuickKeysMenu->onAssignMagic(spellId);
break; break;
}
} }
} }
/* /*

Loading…
Cancel
Save