Browse Source

* fixed bugs 66, 74 from VCMI 0.73 bug thread

mateuszb 16 years ago
parent
commit
bab07c0ab3
3 changed files with 31 additions and 2 deletions
  1. 28 0
      client/CBattleInterface.cpp
  2. 1 0
      client/CBattleInterface.h
  3. 2 2
      lib/NetPacksLib.cpp

+ 28 - 0
client/CBattleInterface.cpp

@@ -1936,6 +1936,9 @@ void CBattleInterface::clickRight(tribool down, bool previousState)
 
 void CBattleInterface::bOptionsf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	CGI->curh->changeGraphic(0,0);
 
 	SDL_Rect temp_rect = genRect(431, 481, 160, 84);
@@ -1945,10 +1948,15 @@ void CBattleInterface::bOptionsf()
 
 void CBattleInterface::bSurrenderf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
 }
 
 void CBattleInterface::bFleef()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	if( LOCPLINT->cb->battleCanFlee() )
 	{
 		CFunctionList<void()> ony = boost::bind(&CBattleInterface::reallyFlee,this);
@@ -1982,10 +1990,15 @@ void CBattleInterface::reallyFlee()
 
 void CBattleInterface::bAutofightf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
 }
 
 void CBattleInterface::bSpellf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	CGI->curh->changeGraphic(0,0);
 
 	const CGHeroInstance * chi = NULL;
@@ -1999,23 +2012,35 @@ void CBattleInterface::bSpellf()
 
 void CBattleInterface::bWaitf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	if(activeStack != -1)
 		giveCommand(8,0,activeStack);
 }
 
 void CBattleInterface::bDefencef()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	if(activeStack != -1)
  		giveCommand(3,0,activeStack);
 }
 
 void CBattleInterface::bConsoleUpf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	console->scrollUp();
 }
 
 void CBattleInterface::bConsoleDownf()
 {
+	if(spellDestSelectMode) //we are casting a spell
+		return;
+
 	console->scrollDown();
 }
 
@@ -2967,6 +2992,9 @@ void CBattleHero::setPhase(int newPhase)
 
 void CBattleHero::clickLeft(tribool down, bool previousState)
 {
+	if(myOwner->spellDestSelectMode) //we are casting a spell
+		return;
+
 	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

+ 1 - 0
client/CBattleInterface.h

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

+ 2 - 2
lib/NetPacksLib.cpp

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