Skip to content
This repository was archived by the owner on May 6, 2023. It is now read-only.

Commit 8eb6f34

Browse files
authored
Bugfixes (#21)
- Fix NPE in Military Regulations when checking blacklist against pristine ships. - Fix Stelnet compatiblity. - Add support for auto-updater in Mod Manager.
1 parent 61b26f9 commit 8eb6f34

File tree

6 files changed

+10
-96
lines changed

6 files changed

+10
-96
lines changed

assets/mod_info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Starpocalypse",
44
"author": "Jaghaimo",
55
"utility": true,
6-
"version": "2.1.0",
6+
"version": "2.1.1",
77
"description": "More apocalyptic settings for Starsector",
88
"gameVersion": "0.95.1a-RC6",
99
"modPlugin": "starpocalypse.StarpocalypseMod",

assets/starpocalypse.version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"modVersion": {
66
"major": 2,
77
"minor": 1,
8-
"patch": 0
8+
"patch": 1
99
},
10-
"directDownloadURL": "https://github.com/jaghaimo/starpocalypse/releases/download/2.1.0/starpocalypse-2.1.0.zip"
10+
"directDownloadURL": "https://github.com/jaghaimo/starpocalypse/releases/download/2.1.1/starpocalypse-2.1.1.zip"
1111
}

src/starpocalypse/submarket/MilitaryRegulation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.fs.starfarer.api.campaign.CargoStackAPI;
55
import com.fs.starfarer.api.campaign.FleetDataAPI;
66
import com.fs.starfarer.api.campaign.econ.SubmarketAPI;
7+
import com.fs.starfarer.api.combat.ShipHullSpecAPI;
78
import com.fs.starfarer.api.combat.ShipHullSpecAPI.ShipTypeHints;
89
import com.fs.starfarer.api.fleet.FleetMemberAPI;
910
import com.fs.starfarer.api.impl.campaign.ids.HullMods;
@@ -72,7 +73,11 @@ protected boolean isBlacklisted(SimpleSet blacklist, CargoStackAPI stack) {
7273
}
7374

7475
protected boolean isBlacklisted(SimpleSet blacklist, FleetMemberAPI ship) {
75-
return blacklist.has(ship.getHullSpec().getBaseHull().getHullName());
76+
ShipHullSpecAPI hullSpec = ship.getHullSpec().getBaseHull();
77+
if (hullSpec == null) {
78+
hullSpec = ship.getHullSpec();
79+
}
80+
return blacklist.has(hullSpec.getHullName());
7681
}
7782

7883
private void addToMilitary(CargoStackAPI stack) {

src/starpocalypse/submarket/ShyBlackMarketListener.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/starpocalypse/submarket/ShyBlackMarketPlugin.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/starpocalypse/submarket/SubmarketListener.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.fs.starfarer.api.campaign.econ.SubmarketAPI;
88
import com.fs.starfarer.api.campaign.listeners.ColonyInteractionListener;
99
import com.fs.starfarer.api.impl.campaign.ids.Submarkets;
10-
import com.fs.starfarer.api.impl.campaign.submarkets.BaseSubmarketPlugin;
1110
import java.util.Collections;
1211
import java.util.Comparator;
1312
import java.util.LinkedList;
@@ -46,34 +45,19 @@ public void reportPlayerMarketTransaction(PlayerMarketTransaction transaction) {
4645

4746
private void processSubmarkets(MarketAPI market) {
4847
for (SubmarketAPI submarket : getSortedSubmarkets(market)) {
48+
update(submarket);
4949
process(submarket);
5050
}
5151
}
5252

5353
private void process(SubmarketAPI submarket) {
54-
if (!okToUpdate(submarket)) {
55-
log.debug("Skipping already updated submarket " + submarket.getNameOneLine());
56-
return;
57-
}
58-
update(submarket);
5954
log.debug("Processing submarket " + submarket.getNameOneLine());
6055
for (SubmarketChanger changer : changers) {
6156
log.debug("Trying " + changer.getClass().getSimpleName());
6257
changer.change(submarket);
6358
}
6459
}
6560

66-
private boolean okToUpdate(SubmarketAPI submarket) {
67-
boolean okToUpdate = true;
68-
try {
69-
SubmarketPlugin plugin = submarket.getPlugin();
70-
okToUpdate = ((BaseSubmarketPlugin) plugin).okToUpdateShipsAndWeapons();
71-
} catch (ClassCastException exception) {
72-
log.warn("Incompatible plugin for submarket " + submarket.getNameOneLine());
73-
}
74-
return okToUpdate;
75-
}
76-
7761
private void update(SubmarketAPI submarket) {
7862
SubmarketPlugin plugin = submarket.getPlugin();
7963
if (plugin == null) {

0 commit comments

Comments
 (0)