Mercurial > mm7
changeset 2485:45102c9132e1
Changed ternary operators to else-if chain for INPUT_CastReady
author | Grumpy7 |
---|---|
date | Sun, 07 Sep 2014 01:35:33 +0200 |
parents | cc7019a533fc |
children | 1e70f8470638 |
files | Keyboard.cpp |
diffstat | 1 files changed, 36 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/Keyboard.cpp Sat Sep 06 21:45:26 2014 +0200 +++ b/Keyboard.cpp Sun Sep 07 01:35:33 2014 +0200 @@ -705,30 +705,44 @@ } break; case INPUT_CastReady: - if (pCurrentScreen != SCREEN_GAME) - break; - if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT) { - pTurnEngine->field_18 |= TE_FLAG_8; - break; + if (pCurrentScreen != SCREEN_GAME) + break; + if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT) + { + pTurnEngine->field_18 |= TE_FLAG_8; + break; + } + if ( !uActiveCharacter ) + break; + uchar quickSpellNumber = pPlayers[uActiveCharacter]->uQuickSpell; + v9 = pPlayers[uActiveCharacter]->pActiveSkills[quickSpellNumber / 11 + 12]; + bool enoughMana = false; + if ((v9 & 0x100) != 0) + { + enoughMana = pSpellDatas[quickSpellNumber].uMagisterLevelMana < pPlayers[uActiveCharacter]->sMana; + } + else if ((v9 & 0x80) != 0) + { + enoughMana = pSpellDatas[quickSpellNumber].uMasterLevelMana < pPlayers[uActiveCharacter]->sMana; + } + else if ((v9 & 0x40) != 0) + { + enoughMana = pSpellDatas[quickSpellNumber].uExpertLevelMana < pPlayers[uActiveCharacter]->sMana; + } + else + { + enoughMana = pSpellDatas[quickSpellNumber].uNormalLevelMana < pPlayers[uActiveCharacter]->sMana; + } + if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater || !enoughMana) + { + pPartyActionQueue = pPartyActionQueue; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0); + break; + } + else + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0); } - if ( !uActiveCharacter ) - break; - v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12]; - if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater - || (( !(HIBYTE(v9) & 1)) ? - ((v9 & 0x80) == 0 ? - ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) : - spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) : - spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana, - spell_price > pPlayers[uActiveCharacter]->sMana) ) - { - pPartyActionQueue = pPartyActionQueue; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0); - break; - } - else - pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0); break; case INPUT_Attack: if (pCurrentScreen != SCREEN_GAME)