diff Player.cpp @ 1362:d6cf8ead9242

Condition checking functions slightly renamed, some final changes in Player::SetCondition
author Grumpy7
date Mon, 15 Jul 2013 00:42:50 +0200
parents b3ac17fd12de
children fd661c9e7f97
line wrap: on
line diff
--- a/Player.cpp	Sun Jul 14 23:22:43 2013 +0200
+++ b/Player.cpp	Mon Jul 15 00:42:50 2013 +0200
@@ -663,9 +663,9 @@
 //----- (00492C0B) --------------------------------------------------------
 bool Player::CanAct()
 {
-  if ( this->pConditions[Condition_Sleep] || this->pConditions[Condition_Paralyzed] || 
-       this->pConditions[Condition_Unconcious] || this->pConditions[Condition_Dead] || 
-       this->pConditions[Condition_Pertified] || this->pConditions[Condition_Eradicated] )
+  if ( this->IsAsleep() || this->IsParalyzed() || 
+       this->IsUnconcious() || this->IsDead() || 
+       this->IsPertified() || this->IsEradicated() )
     return false;
   else
     return true;
@@ -708,14 +708,6 @@
 
   if ( pConditions[uConditionIdx] )
       return;
-
-  players_before = 0;
-
-  for (int i = 1; i < 5; ++i)
-  {
-      if ( pPlayers[i]->CanAct() )
-          ++players_before;
-  }
   
   if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3))
   {
@@ -750,7 +742,7 @@
         sMana = 0;
     break;
     case Condition_Pertified:
-      PlaySound((PlayerSpeech)34, 0);
+      PlaySound(SPEECH_34, 0);
     break;
     case Condition_Eradicated:
       PlaySound(SPEECH_35, 0);
@@ -760,7 +752,7 @@
         sMana = 0;
     break;
     case Condition_Zombie:
-      if ( classType == PLAYER_CLASS_LICH || Eradicated() || Zombie() || !Dead())
+      if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead())
         return;
       memset(&pConditions[0], 0, sizeof(pConditions));
       sHealth = GetMaxHealth();
@@ -782,8 +774,16 @@
     break;
   }
 
+  players_before = 0;
+  for (int i = 1; i < 5; ++i)
+  {
+    if ( pPlayers[i]->CanAct() )
+      ++players_before;
+  }
+
+  pConditions[uConditionIdx] = 1;
+
   remainig_player = 0;
-  pConditions[uConditionIdx] = 1;
   players_after = 0;
   for (int i = 1; i < 5; ++i)
   {
@@ -9780,41 +9780,51 @@
 }
 
 
-bool Player::Weak()
+bool Player::IsWeak()
 {
   return pConditions[Condition_Weak] != 0;
 }
 
-bool Player::Dead()
+bool Player::IsDead()
 {
   return pConditions[Condition_Dead] != 0;
 }
 
-bool Player::Eradicated()
+bool Player::IsEradicated()
 {
   return pConditions[Condition_Eradicated] != 0;
 }
 
-bool Player::Zombie()
+bool Player::IsZombie()
 {
   return pConditions[Condition_Zombie] != 0;
 }
 
-bool Player::Cursed()
+bool Player::IsCursed()
 {
   return pConditions[Condition_Cursed] != 0;
 }
 
-bool Player::Pertified()
+bool Player::IsPertified()
 {
   return pConditions[Condition_Pertified] != 0;
 }
 
-bool Player::Unconcious()
+bool Player::IsUnconcious()
 {
   return pConditions[Condition_Unconcious] != 0;
 }
 
+bool Player::IsAsleep()
+{
+  return pConditions[Condition_Sleep] != 0;
+}
+
+bool Player::IsParalyzed()
+{
+  return pConditions[Condition_Paralyzed] != 0;
+}
+
 void Player::SetCursed( bool state )
 {
   pConditions[Condition_Cursed] = state;
@@ -9918,4 +9928,4 @@
 void Player::SetCondDeadWithBlockCheck( int blockable )
 {
   SetCondition(Condition_Dead, blockable);
-}
\ No newline at end of file
+}