diff Player.cpp @ 1554:e303d8a9bcdc

Merge
author Grumpy7
date Sat, 07 Sep 2013 21:14:48 +0200
parents b98812ead5d9 c4ab816fcc5e
children 9c4cf5b07e98
line wrap: on
line diff
--- a/Player.cpp	Sat Sep 07 21:00:02 2013 +0200
+++ b/Player.cpp	Sat Sep 07 21:14:48 2013 +0200
@@ -2,11 +2,8 @@
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 
-#include <assert.h>
-
 #include "stru6.h"
 
-
 #include "Player.h"
 #include "PlayerFrameTable.h"
 #include "AudioPlayer.h"
@@ -343,7 +340,7 @@
 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
 {
   uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100);
-  assert (price > 0);
+  Assert (price > 0);
 
   if (price < uRealValue)
     price = uRealValue;
@@ -650,7 +647,7 @@
         return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79));
         break;
       default:
-        assert("Should not be able to get here" && false);
+        Error("Should not be able to get here (%u)", uClass);
         break;
     }
     return false;
@@ -813,11 +810,8 @@
     texture->Release();
     pIcons_LOD->SyncLoadedFilesCount();
   }
-  if ( slotHeight == 0 || slotWidth == 0)
-  {
-    assert("Items should have nonzero dimensions" && false);
-    return 1;
-  }
+
+    assert("Items should have nonzero dimensions");
   if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT )
   {
       for (unsigned int x = 0; x < slotWidth; x++)
@@ -1078,7 +1072,7 @@
         return 4;
     break;
     default:
-      assert(false);
+      Error("(%u)", building_type);
     break;
   }
   if (pItem->Stolen())
@@ -1103,7 +1097,7 @@
       price = this->GetPriceRepair(itemValue, multiplier);
       break;
     default:
-      assert(false);
+      Assert("(%u)", ShopMenuType);
     break;
   }
   if ( merchantLevel )
@@ -2836,7 +2830,7 @@
     }
     else
     {
-      assert(false && "Unknown armour type"); // what kind of armour is that?
+      Error("Unknown armour type"); // what kind of armour is that?
       armour_recovery_multipliers[0] = 1.0f;
       armour_recovery_multipliers[1] = 1.0f;
       armour_recovery_multipliers[2] = 1.0f;
@@ -3230,7 +3224,7 @@
 //----- (0048E96A) --------------------------------------------------------
 void Player::SetRecoveryTime(signed int rec)
 {
-  assert(rec >= 0);
+  Assert(rec >= 0);
 
   if (rec > uTimeToRecovery)
     uTimeToRecovery = rec;
@@ -4677,7 +4671,7 @@
     case 3: return mult3;
     case 4: return mult4;
   }
-  assert(false);
+  Error("(%u)", masteryLvl);
   return 0;
 }
 //----- (00490109) --------------------------------------------------------
@@ -4760,7 +4754,7 @@
     case 0x18u:
       return SEX_FEMALE;
   }
-  assert(false);
+  Error("(%u)", this->uVoiceID);
   return SEX_MALE;
 }
 
@@ -5104,9 +5098,7 @@
   case 6:
     statToChange = &this->uLuck;
   default:
-    assert(false);
-    return;
-    break;
+    Error("(%u)", eAttribute);
   }
   if ( *statToChange < baseValue )
   {
@@ -6414,7 +6406,8 @@
       break;
     }
   }
-  assert(currPlayerId != -1);
+
+  Assert(currPlayerId != -1);
   if ( var_type > VAR_AutoNotes )
   {
     if ( var_type <= VAR_GoldInBank )
@@ -6865,14 +6858,14 @@
         this->sResDarkBonus = (unsigned __int8)var_value;
         break;
       case VAR_PhysicalResistanceBonus:
-        assert("VAR_PhysicalResistanceBonus variable unsupported" && false);
+        Assert("VAR_PhysicalResistanceBonus variable unsupported" && false);
         return;
         break;
       case VAR_MagicResistanceBonus:
         this->sResMagicBonus = (unsigned __int8)var_value;
         break;
       default:
-          assert("Unexpected var_type" && false);
+          Assert("Unexpected var_type: %u", var_type);
           return;
         break;
     }
@@ -7619,7 +7612,7 @@
         pParty->uNumArenaLordWins -= (char)pValue;
         break;
     }
-    assert(false && "Function not returning any value!");
+    Error("Function not returning any value! (%u)", VarNum);
   }
   else
   {
@@ -8201,7 +8194,7 @@
       //pPlayers = &::pPlayers[1];
       //v5 = 604;
       //while ( 1 )
-  assert ( a1 > 0 && a1 < 5 );
+  Assert ( a1 > 0 && a1 < 5 );
       for ( uint i = 1; i < 5; ++i )
       {
         //item_flag = Player_has_item(604, *pPlayers, 0);