mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 20:53:28 +08:00
fix crash
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user