Further work on better exceptions.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-07-26 17:41:11 +02:00
parent 29eb7c603a
commit 36f1e5beeb
12 changed files with 30 additions and 37 deletions

View File

@@ -22,7 +22,7 @@ CreateCreature CreateCreature::WithGender(Library::Gender gender) {
CreateCreature CreateCreature::WithAttack(const ArbUt::StringView& attackName, AttackLearnMethod learnMethod) {
if (_attacks.Count() >= _library->GetSettings()->GetMaximalMoves())
throw CreatureException("You have already set the maximum amount of allowed moves.");
THROW_CREATURE("You have already set the maximum amount of allowed moves.");
auto attackData = _library->GetAttackLibrary()->Get(attackName.GetHash());
_attacks.Append(std::tuple(attackData, learnMethod));
@@ -50,7 +50,7 @@ Creature* CreateCreature::Create() {
ArbUt::BorrowedPtr<const Library::Item> heldItem;
if (!this->_heldItem.Empty()) {
if (!_library->GetItemLibrary()->TryGet(this->_heldItem.GetHash(), heldItem)) {
throw CreatureException("Invalid held item.");
THROW_CREATURE("Invalid held item '" << this->_heldItem.c_str() << "'.");
}
}
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);