1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 22:53:33 +08:00

fix crash

This commit is contained in:
2025-05-02 19:59:51 +08:00
parent 780ad3d3ec
commit 0d5a07b1ac
2 changed files with 22 additions and 22 deletions

View File

@@ -93,6 +93,28 @@ public static class PlanetFunctions
planet.audio?.RemoveAudioData(ed.audioId);
}
var hives = GameMain.spaceSector?.dfHives;
if (hives != null)
{
var hive = hives[planet.star.index];
var relays = hive?.relays?.buffer;
if (relays != null)
{
var astroId = planet.astroId;
for (var i = relays.Length - 1; i >= 0; i--)
{
var relay = relays[i];
if (relay == null || relay.id != i) continue;
if (relay.targetAstroId != astroId && relay.searchAstroId != astroId) continue;
relay.targetAstroId = 0;
relay.searchAstroId = 0;
if (relay.baseId > 0)
hive.relayNeutralizedCounter++;
relay.LeaveBase();
}
}
}
if (planet.factory.enemyPool != null)
{
for (var i = planet.factory.enemyCursor - 1; i > 0; i--)
@@ -151,27 +173,6 @@ public static class PlanetFunctions
if (warningPool[i].id == i && warningPool[i].factoryId == index)
warningSystem.RemoveWarningData(warningPool[i].id);
}
var hives = GameMain.spaceSector?.dfHives;
if (hives != null)
{
var hive = hives[planet.star.index];
var relays = hive?.relays?.buffer;
if (relays != null)
{
var astroId = planet.astroId;
for (var i = relays.Length - 1; i >= 0; i--)
{
var relay = relays[i];
if (relay != null && relay.id != i) continue;
if (relay.targetAstroId != astroId && relay.searchAstroId != astroId) continue;
relay.targetAstroId = 0;
relay.searchAstroId = 0;
if (relay.baseId > 0)
hive.relayNeutralizedCounter++;
relay.LeaveBase();
}
}
}
var isCombatMode = factory.gameData.gameDesc.isCombatMode;
factory.entityCursor = 1;
factory.entityRecycleCursor = 0;

View File

@@ -3,4 +3,3 @@
* Set battlefield analysis base power charging
* Auto-navigation: avoid darkfogs
* Auto-navigation: do not use warper if the tech is not researched
* Recreate planet: crash fix