Adress review №2

This commit is contained in:
juliancoffee 2022-01-27 23:13:47 +02:00
parent 6ae25d5956
commit ed593cd0cb
2 changed files with 13 additions and 10 deletions

View File

@ -135,6 +135,7 @@ impl Entity {
/// Escape hatch for runtime creation of loadout not covered by entity
/// config.
// NOTE: Signature is part of interface of EntityInfo
pub fn get_adhoc_loadout(
&self,
) -> fn(LoadoutBuilder, Option<&trade::SiteInformation>) -> LoadoutBuilder {

View File

@ -448,16 +448,18 @@ impl NpcData {
let loadout = loadout_builder.build();
let mut inventory = comp::inventory::Inventory::new_with_loadout(loadout);
for (num, mut item) in items {
tracing::warn!(
"error during creating inventory for {name} at {pos}: {e:?}",
name = &stats.name,
e = item.set_amount(num)
);
tracing::warn!(
"error during creating inventory for {name} at {pos}: {e:?}",
name = &stats.name,
e = inventory.push(item)
);
if let Err(e) = item.set_amount(num) {
tracing::warn!(
"error during creating inventory for {name} at {pos}: {e:?}",
name = &stats.name,
);
}
if let Err(e) = inventory.push(item) {
tracing::warn!(
"error during creating inventory for {name} at {pos}: {e:?}",
name = &stats.name,
);
}
}
inventory