1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

* fixed bugs 66, 74 from VCMI 0.73 bug thread

This commit is contained in:
mateuszb 2009-09-19 09:57:37 +00:00
parent 763571062d
commit bab07c0ab3
3 changed files with 31 additions and 2 deletions

View File

@ -1936,6 +1936,9 @@ void CBattleInterface::clickRight(tribool down, bool previousState)
void CBattleInterface::bOptionsf() void CBattleInterface::bOptionsf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
CGI->curh->changeGraphic(0,0); CGI->curh->changeGraphic(0,0);
SDL_Rect temp_rect = genRect(431, 481, 160, 84); SDL_Rect temp_rect = genRect(431, 481, 160, 84);
@ -1945,10 +1948,15 @@ void CBattleInterface::bOptionsf()
void CBattleInterface::bSurrenderf() void CBattleInterface::bSurrenderf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
} }
void CBattleInterface::bFleef() void CBattleInterface::bFleef()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
if( LOCPLINT->cb->battleCanFlee() ) if( LOCPLINT->cb->battleCanFlee() )
{ {
CFunctionList<void()> ony = boost::bind(&CBattleInterface::reallyFlee,this); CFunctionList<void()> ony = boost::bind(&CBattleInterface::reallyFlee,this);
@ -1982,10 +1990,15 @@ void CBattleInterface::reallyFlee()
void CBattleInterface::bAutofightf() void CBattleInterface::bAutofightf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
} }
void CBattleInterface::bSpellf() void CBattleInterface::bSpellf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
CGI->curh->changeGraphic(0,0); CGI->curh->changeGraphic(0,0);
const CGHeroInstance * chi = NULL; const CGHeroInstance * chi = NULL;
@ -1999,23 +2012,35 @@ void CBattleInterface::bSpellf()
void CBattleInterface::bWaitf() void CBattleInterface::bWaitf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
if(activeStack != -1) if(activeStack != -1)
giveCommand(8,0,activeStack); giveCommand(8,0,activeStack);
} }
void CBattleInterface::bDefencef() void CBattleInterface::bDefencef()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
if(activeStack != -1) if(activeStack != -1)
giveCommand(3,0,activeStack); giveCommand(3,0,activeStack);
} }
void CBattleInterface::bConsoleUpf() void CBattleInterface::bConsoleUpf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
console->scrollUp(); console->scrollUp();
} }
void CBattleInterface::bConsoleDownf() void CBattleInterface::bConsoleDownf()
{ {
if(spellDestSelectMode) //we are casting a spell
return;
console->scrollDown(); console->scrollDown();
} }
@ -2967,6 +2992,9 @@ void CBattleHero::setPhase(int newPhase)
void CBattleHero::clickLeft(tribool down, bool previousState) void CBattleHero::clickLeft(tribool down, bool previousState)
{ {
if(myOwner->spellDestSelectMode) //we are casting a spell
return;
if(!down && myHero && LOCPLINT->cb->battleCanCastSpell()) //check conditions if(!down && myHero && LOCPLINT->cb->battleCanCastSpell()) //check conditions
{ {
for(int it=0; it<BFIELD_SIZE; ++it) //do nothing when any hex is hovered - hero's animation overlaps battlefield for(int it=0; it<BFIELD_SIZE; ++it) //do nothing when any hex is hovered - hero's animation overlaps battlefield

View File

@ -487,6 +487,7 @@ public:
friend class CMeleeAttack; friend class CMeleeAttack;
friend class CShootingAnim; friend class CShootingAnim;
friend class CSpellEffectAnim; friend class CSpellEffectAnim;
friend class CBattleHero;
}; };
#endif // __CBATTLEINTERFACE_H__ #endif // __CBATTLEINTERFACE_H__

View File

@ -608,9 +608,9 @@ DLL_EXPORT void BattleNextRound::applyGs( CGameState *gs )
s->counterAttacks = 1 + s->valOfFeatures(StackFeature::ADDITIONAL_RETALIATION); s->counterAttacks = 1 + s->valOfFeatures(StackFeature::ADDITIONAL_RETALIATION);
//regeneration //regeneration
if( s->hasFeatureOfType(StackFeature::HP_REGENERATION) ) if( s->hasFeatureOfType(StackFeature::HP_REGENERATION) && s->alive() )
s->firstHPleft = std::min<ui32>( s->MaxHealth(), s->valOfFeatures(StackFeature::HP_REGENERATION) ); s->firstHPleft = std::min<ui32>( s->MaxHealth(), s->valOfFeatures(StackFeature::HP_REGENERATION) );
if( s->hasFeatureOfType(StackFeature::FULL_HP_REGENERATION) ) if( s->hasFeatureOfType(StackFeature::FULL_HP_REGENERATION) && s->alive() )
s->firstHPleft = s->MaxHealth(); s->firstHPleft = s->MaxHealth();
//remove effects and restore only those with remaining turns in duration //remove effects and restore only those with remaining turns in duration