Mercurial > mm7
diff Player.cpp @ 1545:c4ab816fcc5e
assert, Abortf, AbortWithError -> Assert, Error
refactors here and there
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 20:05:20 +0200 |
parents | 5cf28ec7322d |
children | e303d8a9bcdc |
line wrap: on
line diff
--- a/Player.cpp Sat Sep 07 15:20:57 2013 +0200 +++ b/Player.cpp Sat Sep 07 20:05:20 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"); - return 1; - } + + Assert(slotHeight && slotWidth, "Items should have nonzero dimensions"); if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) { int startOfInnerLoop = uSlot; @@ -1091,7 +1085,7 @@ return 4; break; default: - assert(false); + Error("(%u)", building_type); break; } if (pItem->Stolen()) @@ -1116,7 +1110,7 @@ price = this->GetPriceRepair(itemValue, multiplier); break; default: - assert(false); + Assert("(%u)", ShopMenuType); break; } if ( merchantLevel ) @@ -3199,7 +3193,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; @@ -3593,7 +3587,7 @@ //----- (0048E96A) -------------------------------------------------------- void Player::SetRecoveryTime(signed int rec) { - assert(rec >= 0); + Assert(rec >= 0); if (rec > uTimeToRecovery) uTimeToRecovery = rec; @@ -5040,7 +5034,7 @@ case 3: return mult3; case 4: return mult4; } - assert(false); + Error("(%u)", masteryLvl); return 0; } //----- (00490109) -------------------------------------------------------- @@ -5123,7 +5117,7 @@ case 0x18u: return SEX_FEMALE; } - assert(false); + Error("(%u)", this->uVoiceID); return SEX_MALE; } @@ -5373,7 +5367,7 @@ } } - assert(false); + Error("(%u)", order); } @@ -5467,9 +5461,7 @@ case 6: statToChange = &this->uLuck; default: - assert(false); - return; - break; + Error("(%u)", eAttribute); } if ( *statToChange < baseValue ) { @@ -6777,7 +6769,8 @@ break; } } - assert(currPlayerId != -1); + + Assert(currPlayerId != -1); if ( var_type > VAR_AutoNotes ) { if ( var_type <= VAR_GoldInBank ) @@ -7228,14 +7221,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; } @@ -7982,7 +7975,7 @@ pParty->uNumArenaLordWins -= (char)pValue; break; } - assert(false && "Function not returning any value!"); + Error("Function not returning any value! (%u)", VarNum); } else { @@ -8564,7 +8557,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);