Skip to content

Commit

Permalink
Own faction bonus: Fix crash from not explicitly specifying industry …
Browse files Browse the repository at this point in the history
…upgrade target
  • Loading branch information
Histidine91 committed Jun 17, 2023
1 parent 6d19c75 commit 0a8208a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.CargoTransferHandlerAPI;
import com.fs.starfarer.api.campaign.SpecialItemPlugin;
import com.fs.starfarer.api.campaign.econ.Industry;
import com.fs.starfarer.api.campaign.econ.MarketAPI;
import com.fs.starfarer.api.graphics.SpriteAPI;
import com.fs.starfarer.api.ui.TooltipMakerAPI;
import com.fs.starfarer.api.util.Misc;
import exerelin.utilities.NexUtilsMarket;
import exerelin.world.factionsetup.FactionSetupHandler.FactionSetupItemDef;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -25,8 +27,13 @@ public void apply() {

String toUpgrade = (String)def.params.get("upgrade");
if (home.hasIndustry(toUpgrade)) {
Industry ind = home.getIndustry(toUpgrade);
String target = (String)def.params.get("upgradeTo");
NexUtilsMarket.upgradeIndustryToTarget(home.getIndustry(toUpgrade), target, true, true);
if (target == null) target = ind.getSpec().getUpgrade();
if (target == null) {
Global.getLogger(this.getClass()).error("No upgrade target for industry " + ind.getCurrentName());
}
NexUtilsMarket.upgradeIndustryToTarget(ind, target, true, true);
return;
}

Expand Down

0 comments on commit 0a8208a

Please sign in to comment.