Further work on better exceptions.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -227,14 +227,14 @@ ArbUt::BorrowedPtr<const Library::SpeciesVariant> Battling::Creature::GetDisplay
|
||||
void Battling::Creature::SetHeldItem(const ArbUt::BasicStringView& itemName) {
|
||||
ArbUt::BorrowedPtr<const Library::Item> item;
|
||||
if (!_library->GetItemLibrary()->TryGet(itemName.GetHash(), item)) {
|
||||
throw CreatureException("Item not found.");
|
||||
THROW_CREATURE("Item not found '" << itemName.c_str() << "'.");
|
||||
}
|
||||
_heldItem = item;
|
||||
}
|
||||
void Battling::Creature::SetHeldItem(uint32_t itemNameHash) {
|
||||
ArbUt::BorrowedPtr<const Library::Item> item;
|
||||
if (!_library->GetItemLibrary()->TryGet(itemNameHash, item)) {
|
||||
throw CreatureException("Item not found.");
|
||||
THROW_CREATURE("Item not found.");
|
||||
}
|
||||
_heldItem = item;
|
||||
}
|
||||
@@ -247,9 +247,7 @@ void Battling::Creature::AddVolatileScript(const ArbUt::StringView& name) {
|
||||
}
|
||||
script = this->_library->LoadScript(ScriptCategory::Creature, name);
|
||||
if (script == nullptr) {
|
||||
std::stringstream ss;
|
||||
ss << "Invalid volatile script requested for creature: '" << name.c_str() << "'.";
|
||||
throw CreatureException(ss.str());
|
||||
THROW_CREATURE("Invalid volatile script requested for creature: '" << name.c_str() << "'.");
|
||||
}
|
||||
_volatile.Add(script.GetRaw());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user