diff Actor.cpp @ 1873:a53bd0511de2

Actor::ApplyFineForKillingPeasant cleaned up
author Grumpy7
date Thu, 17 Oct 2013 07:46:11 +0200
parents e26d8d15ef30
children a6276dda8804
line wrap: on
line diff
--- a/Actor.cpp	Thu Oct 17 03:47:31 2013 +0200
+++ b/Actor.cpp	Thu Oct 17 07:46:11 2013 +0200
@@ -1299,67 +1299,40 @@
 //----- (00438CF3) --------------------------------------------------------
 void Actor::ApplyFineForKillingPeasant(unsigned int uActorID)
 {
-  unsigned int v1; // esi@1
-  unsigned int v2; // edi@2
-  char v3; // bl@3
-  //char *v4; // ecx@16
-  //signed int v5; // eax@18
-  Player **ppPlayers; // esi@20
+  if ( uLevelMapStatsID == 0 || !pActors[uActorID].IsPeasant())
+    return;
 
-  v1 = uLevelMapStatsID;
-  if ( !uLevelMapStatsID || !pActors[uActorID].IsPeasant())
+  if ( (uLevelMapStatsID == 6 || uLevelMapStatsID == 7) && pParty->IsPartyEvil())   //celeste and bracada
+    return;
+
+  if ( (uLevelMapStatsID == 5 || uLevelMapStatsID == 8) && pParty->IsPartyGood())   // the pit and deyja
     return;
 
-  v2 = uActorID;
-  v3 = 1;
-  if ( v1 != 5 )
+  pParty->uFine += 100 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm + pActors[uActorID].pMonsterInfo.uLevel + pParty->GetPartyReputation());
+  if ( pParty->uFine < 0 )
+    pParty->uFine = 0;
+  if ( pParty->uFine > 4000000 )
+    pParty->uFine = 4000000;
+
+  if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
   {
-    if ( v1 == 6 || v1 == 7 )
-    {
-      pParty->IsPartyGood(); //the binary file contains this call. if someone finds out whether it's supposed to be here or not, feel free to apply the appropriate change
-      if ( pParty->IsPartyEvil() )
-        return;
-      goto LABEL_12;
-    }
-    if ( v1 != 8 )
-      goto LABEL_12;
+    if (pOutdoor->ddm.uReputation < 10000)
+      pOutdoor->ddm.uReputation++;
   }
-  if ( pParty->IsPartyGood() )
-    v3 = 0;
-  if ( pParty->IsPartyEvil() )
-    v3 = 1;
-  if ( v3 )
+  else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
   {
-LABEL_12:
-    pParty->uFine += 100 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm + pActors[v2].pMonsterInfo.uLevel + pParty->GetPartyReputation());
-    if ( pParty->uFine < 0 )
-      pParty->uFine = 0;
-    if ( pParty->uFine > 4000000 )
-      pParty->uFine = 4000000;
+    if (pIndoor->dlv.uReputation < 10000)
+      pIndoor->dlv.uReputation++;
+  }
+  else assert(false);
 
-    if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    {
-      if (pOutdoor->ddm.uReputation < 10000)
-        pOutdoor->ddm.uReputation++;
-    }
-    else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+  if ( pParty->uFine )
+  {
+    for ( int i = 1; i <= 4; i++)
     {
-      if (pIndoor->dlv.uReputation < 10000)
-        pIndoor->dlv.uReputation++;
+      if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) )
+        _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1u);
     }
-    else assert(false);
-
-    ppPlayers = &pPlayers[1];
-    do
-    {
-      if ( pParty->uFine )
-      {
-        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_achieved_awards_bits, 1) )
-          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_achieved_awards_bits, 1, 1u);
-      }
-      ++ppPlayers;
-    }
-    while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] );
   }
 }