Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
starfi5h committed Apr 11, 2024
1 parent f6d5304 commit c959817
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected override void ProcessPacket(DFGActivateBasePacket packet, NebulaConnec

if (!packet.SetToSeekForm)
{
if (packet.BaseId >= factory.enemySystem.bases.capacity) return;
var dFBase = factory.enemySystem.bases.buffer[packet.BaseId];
if (dFBase == null) return;
dFBase.activeTick = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected override void ProcessPacket(DFGActivateUnitPacket packet, NebulaConnec
using (Multiplayer.Session.Combat.IsIncomingRequest.On())
{
EnemyManager.SetPlanetFactoryNextEnemyId(factory, packet.EnemyId);
if (packet.BaseId >= factory.enemySystem.bases.capacity) return;
var dfBase = factory.enemySystem.bases.buffer[packet.BaseId];
if (dfBase == null) return;
var gameTick = GameMain.gameTick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected override void ProcessPacket(DFGDeferredCreateEnemyPacket packet, Nebul
using (Multiplayer.Session.Combat.IsIncomingRequest.On())
{
EnemyManager.SetPlanetFactoryNextEnemyId(factory, packet.EnemyId);
if (packet.BaseId >= factory.enemySystem.bases.capacity) return;
if (factory.enemySystem.bases.buffer[packet.BaseId] == null) return;
var enemyId = factory.CreateEnemyFinal(packet.BaseId, packet.BuilderIndex);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected override void ProcessPacket(DFGFormationAddUnitPacket packet, NebulaCo
var factory = GameMain.galaxy.PlanetById(packet.PlanetId)?.factory;
if (factory == null) return;

if (packet.BaseId >= factory.enemySystem.bases.capacity) return;
var dFBase = factory.enemySystem.bases.buffer[packet.BaseId];
if (dFBase == null) return;
using (Multiplayer.Session.Combat.IsIncomingRequest.On())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protected override void ProcessPacket(DFGLaunchAssaultPacket packet, NebulaConne
// Set enemyRecycle pool to make enemyId stay in sync
EnemyManager.SetPlanetFactoryRecycle(factory, packet.EnemyCursor, packet.EnemyRecyle);

if (packet.BaseId >= factory.enemySystem.bases.capacity) return;
var dFBase = factory.enemySystem.bases.buffer[packet.BaseId];
if (dFBase == null) return;
dFBase.turboTicks = 60;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected override void ProcessPacket(DFGUpdateBaseStatusPacket packet, NebulaCo
var factory = GameMain.galaxy.PlanetById(packet.PlanetId)?.factory;
if (factory == null) return;

if (packet.BaseId >= factory.enemySystem.bases.capacity) return;
var dFBase = factory.enemySystem.bases.buffer[packet.BaseId];
if (dFBase == null) return;
ref var evolveData = ref dFBase.evolve;
Expand Down
4 changes: 3 additions & 1 deletion NebulaWorld/Combat/CombatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using NebulaModel.Packets.Combat.Mecha;
using UnityEngine;
#pragma warning disable IDE1006 // Naming Styles
#pragma warning disable CA1822 // Mark members as static

#endregion

Expand Down Expand Up @@ -279,7 +280,8 @@ public void OnFactoryLoadFinished(PlanetFactory factory)
var combatStatbuffer = combatStats.buffer;
for (var i = 1; i < combatStatCursor; i++)
{
if (combatStatbuffer[i].id == i && combatStatbuffer[i].astroId == astroId)
ref var ptr = ref combatStatbuffer[i];
if (ptr.id == i && ptr.astroId == astroId)
{
combatStats.Remove(i);
count++;
Expand Down

0 comments on commit c959817

Please sign in to comment.