From ed593cd0cbb3c80b161a1ec9311c7b884d5d6e2c Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Thu, 27 Jan 2022 23:13:47 +0200 Subject: [PATCH] =?UTF-8?q?Adress=20review=20=E2=84=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/rtsim/entity.rs | 1 + server/src/sys/terrain.rs | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/server/src/rtsim/entity.rs b/server/src/rtsim/entity.rs index 97a268525d..e16c6f7cd3 100644 --- a/server/src/rtsim/entity.rs +++ b/server/src/rtsim/entity.rs @@ -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 { diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index 5bd71de438..d7b0c26ef9 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -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