Make BaseLibraries use shared_ptr.
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:
@@ -32,7 +32,7 @@ CreateCreature CreateCreature::WithAttack(const Arbutils::CaseInsensitiveConstSt
|
||||
|
||||
Creature* CreateCreature::Create() {
|
||||
auto rand = Arbutils::Random();
|
||||
auto species = this->_library->GetSpeciesLibrary()->Get(this->_species);
|
||||
auto& species = this->_library->GetSpeciesLibrary()->Get(this->_species);
|
||||
auto variant = species->GetVariant(this->_variant);
|
||||
Library::TalentIndex talent;
|
||||
if (this->_talent.Empty()) {
|
||||
@@ -48,9 +48,9 @@ Creature* CreateCreature::Create() {
|
||||
if (gender == static_cast<Library::Gender>(-1)) {
|
||||
gender = species->GetRandomGender(rand);
|
||||
}
|
||||
const Library::Item* heldItem = nullptr;
|
||||
std::shared_ptr<const Library::Item> heldItem = nullptr;
|
||||
if (!this->_heldItem.Empty()) {
|
||||
if (!_library->GetItemLibrary()->TryGet(this->_heldItem, heldItem)) {
|
||||
if (!_library->GetItemLibrary()->TryGet(this->_heldItem.GetHash(), heldItem)) {
|
||||
throw CreatureException("Invalid held item.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user