mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 14:36:39 +00:00
Validate Quick Keys
This commit is contained in:
parent
3ea4305a60
commit
1b1de86b4a
2 changed files with 39 additions and 31 deletions
|
@ -79,15 +79,12 @@ namespace MWGui
|
||||||
delete mMagicSelectionDialog;
|
delete mMagicSelectionDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickKeysMenu::onOpen()
|
// Check if quick keys are still valid
|
||||||
|
void QuickKeysMenu::validate(MWWorld::Ptr player)
|
||||||
{
|
{
|
||||||
WindowBase::onOpen();
|
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
||||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||||
|
|
||||||
// Check if quick keys are still valid
|
for (int i = 0; i < 10; ++i)
|
||||||
for (int i=0; i<10; ++i)
|
|
||||||
{
|
{
|
||||||
switch (mKey[i].type)
|
switch (mKey[i].type)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +114,14 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onOpen()
|
||||||
|
{
|
||||||
|
WindowBase::onOpen();
|
||||||
|
|
||||||
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
validate(player);
|
||||||
|
}
|
||||||
|
|
||||||
void QuickKeysMenu::unassign(keyData* key)
|
void QuickKeysMenu::unassign(keyData* key)
|
||||||
{
|
{
|
||||||
key->button->clearUserStrings();
|
key->button->clearUserStrings();
|
||||||
|
@ -334,6 +339,8 @@ namespace MWGui
|
||||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||||
const MWMechanics::CreatureStats &playerStats = player.getClass().getCreatureStats(player);
|
const MWMechanics::CreatureStats &playerStats = player.getClass().getCreatureStats(player);
|
||||||
|
|
||||||
|
validate(player);
|
||||||
|
|
||||||
// Delay action executing,
|
// Delay action executing,
|
||||||
// if player is busy for now (casting a spell, attacking someone, etc.)
|
// if player is busy for now (casting a spell, attacking someone, etc.)
|
||||||
bool isDelayNeeded = MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player)
|
bool isDelayNeeded = MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player)
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace MWGui
|
||||||
void onAssignMagicItem (MWWorld::Ptr item);
|
void onAssignMagicItem (MWWorld::Ptr item);
|
||||||
void onAssignMagic (const std::string& spellId);
|
void onAssignMagic (const std::string& spellId);
|
||||||
void onAssignMagicCancel ();
|
void onAssignMagicCancel ();
|
||||||
|
void validate(MWWorld::Ptr player);
|
||||||
void onOpen() override;
|
void onOpen() override;
|
||||||
|
|
||||||
void activateQuickKey(int index);
|
void activateQuickKey(int index);
|
||||||
|
|
Loading…
Reference in a new issue