Skip to content

Commit

Permalink
Merge pull request #5773 from IllianiCBT/resupply_warehouseShenanigans
Browse files Browse the repository at this point in the history
Log Prohibited Unit Skips in Resupplies & Prevent Invalid Part Additions
  • Loading branch information
HammerGS authored Jan 15, 2025
2 parents a2a95c3 + 695e34d commit 778679b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ private Map<String, PartDetails> collectParts() {
}

if (isProhibitedUnitType(entity, false)) {
logger.info("skipping " + unit.getName() + " as it is prohibited.");
continue;
}

Expand Down Expand Up @@ -727,8 +728,12 @@ private void applyWarehouseWeightModifiers(Map<String, PartDetails> partsList) {
continue;
}

PartDetails partDetails = new PartDetails(part, weight);
// This prevents us accidentally adding new items to the pool
if (!partsList.containsKey(getPartKey(part))) {
continue;
}

PartDetails partDetails = new PartDetails(part, weight);
partsList.merge(getPartKey(part), partDetails, (oldValue, newValue) -> {
oldValue.setWeight(oldValue.getWeight() - newValue.getWeight());
return oldValue;
Expand Down

0 comments on commit 778679b

Please sign in to comment.