mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
avoid:
``` PHI nodes not grouped at top of basic block! %246 = phi <4 x float> [ <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, %114 ], [ %241, <badref> ], !dbg !961029 label %243 in function _ZN14veloren_common4comp9inventory4item7modular11ModularBase4kind17h0950571ff74739d8E LLVM ERROR: Broken function found, compilation aborted! ```
This commit is contained in:
parent
95bca5418a
commit
377787e3c8
@ -105,24 +105,6 @@ impl ModularBase {
|
||||
msm: &MaterialStatManifest,
|
||||
durability_multiplier: DurabilityMultiplier,
|
||||
) -> Cow<ItemKind> {
|
||||
fn resolve_stats(
|
||||
components: &[Item],
|
||||
msm: &MaterialStatManifest,
|
||||
durability_multiplier: DurabilityMultiplier,
|
||||
) -> tool::Stats {
|
||||
components
|
||||
.iter()
|
||||
.filter_map(|comp| {
|
||||
if let ItemKind::ModularComponent(mod_comp) = &*comp.kind() {
|
||||
mod_comp.tool_stats(comp.components(), msm)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.fold(tool::Stats::one(), |a, b| a * b)
|
||||
* durability_multiplier
|
||||
}
|
||||
|
||||
let toolkind = components
|
||||
.iter()
|
||||
.find_map(|comp| match &*comp.kind() {
|
||||
@ -134,11 +116,23 @@ impl ModularBase {
|
||||
})
|
||||
.unwrap_or(ToolKind::Empty);
|
||||
|
||||
let stats: tool::Stats = components
|
||||
.iter()
|
||||
.filter_map(|comp| {
|
||||
if let ItemKind::ModularComponent(mod_comp) = &*comp.kind() {
|
||||
mod_comp.tool_stats(comp.components(), msm)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.fold(tool::Stats::one(), |a, b| a * b)
|
||||
* durability_multiplier;
|
||||
|
||||
match self {
|
||||
ModularBase::Tool => Cow::Owned(ItemKind::Tool(Tool::new(
|
||||
toolkind,
|
||||
Self::resolve_hands(components),
|
||||
resolve_stats(components, msm, durability_multiplier),
|
||||
stats,
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user