1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 13:15:32 +00:00

fix crash on simultaneous key presses

This commit is contained in:
Finbar Crago 2018-06-28 22:55:02 +10:00
parent d790a27060
commit 24d5fb09da

View file

@ -303,7 +303,8 @@ namespace MWGui
void QuickKeysMenu::activateQuickKey(int index) void QuickKeysMenu::activateQuickKey(int index)
{ {
assert(index > 0); assert(index >= 1 && index <= 9);
struct keyData *key = &mKey[index-1]; struct keyData *key = &mKey[index-1];
MWWorld::Ptr player = MWMechanics::getPlayer(); MWWorld::Ptr player = MWMechanics::getPlayer();
@ -318,15 +319,12 @@ namespace MWGui
bool isReturnNeeded = playerStats.isParalyzed() || playerStats.isDead(); bool isReturnNeeded = playerStats.isParalyzed() || playerStats.isDead();
if (isReturnNeeded && key->type != Type_Item) if (isReturnNeeded)
{
return; return;
}
else if(isDelayNeeded && key->type != Type_Item) else if (isDelayNeeded)
{
mActivated = key; mActivated = key;
return;
}
else else
mActivated = nullptr; mActivated = nullptr;
@ -367,12 +365,6 @@ namespace MWGui
// delay weapon switching if player is busy // delay weapon switching if player is busy
if (isDelayNeeded && (isWeapon || isTool)) if (isDelayNeeded && (isWeapon || isTool))
{
mActivated = key;
return;
}
// disable weapon switching if player is dead or paralyzed
else if (isReturnNeeded && (isWeapon || isTool))
{ {
return; return;
} }